Property Files

If you're touching Java, there's probably some property files in your future. We've included the PropertyFile module in CommandBox that you can call directly from CFML. There are also some commands so you can script the creation and updating of property files from the command line and CommandBox recipes.

From the CLI

propertyFile show
propertyFile set newProp=newValue
propertyFile clear newProp


// Create and load property file object
propertyFile( '' )
    .set( '', 'my value' )

// Get a property
var value = propertyFile( '' )
    .get( '' );

// Create one from scratch
    .set( 'brad', 'wood' )
    .store( '' );

A propertyFile CFC instance can also be treated as a struct as it stores the properties in its this scope.

// Create object
var propFile = propertyFile( '' );

// Access proeprties
print.line( propFile.brad );

// Change/add properties
propFile.foobar = true;
propFile[ '' ] = false;

// Save it;