Inheritance diagram for burst.props.AbstractProperties:
Possible such sources of values are:
There are many antecedants for such an interface. Java alone seems to include yet another similar interface in every release (java.util.Properties, java.util.prefs, javax.naming, etc.)
This interface has several deliberate decisions reflected in it:
getSubProperty(prefix, name)
just does a getProperty(prefix + '.' + name)
(at least if the base class is not overridden).
This class is designed to work with burst.reflect.PropertyDef, which can be used to convert a String value from a AbstractProperties instance into some Object value. It is possible to also use a AbstractProperties without burst.reflect.PropertyDef.
Public Member Functions | |
AbstractProperties (String implicit_prefix) | |
protected constructor, only for use by subclasses. | |
String | getProperty (String name) |
Given a property name, returns either a non-empty trimmed String, or undefined. | |
String | getSubProperty (String prefix, String name) |
Same as getProperty(prefix + '.' + name) . | |
Object | getValue (burst.reflect.PropertyDef propdef, Object dflt) |
A convenience to lookup a property string and parse it in one step. | |
Object | getSubValue (String prefix, burst.reflect.PropertyDef propdef, Object dflt) |
Like getValue, but uses getSubProperty. | |
Boolean | setObjectValue (Object obj, burst.reflect.PropertyDef propdef, String prefix) |
Convenience to set a member of some object from this burst.props.AbstractProperties source. | |
Object | setObjectValues (Object obj, Array propdefs, String prefix, Boolean do_defaults, Boolean do_mandatory) |
Calls setObjectValue for each of the burst.reflect.PropertyDef in the Array. | |
abstract String | getPropertyImpl (String name) |
must be overridden by subclass. |
|
protected constructor, only for use by subclasses. If an implicit_prefix is specified, then all names looked up via getPropertyImpl must have that prefix removed, and any name not starting with that prefix are not in this instance. If specified, this must typically have a trailing '.' in it.
|
|
must be overridden by subclass. Need not worry about trimming etc, as getProperty does that. |
|
A convenience to lookup a property string and parse it in one step.
First calls
|
|
Convenience to set a member of some object from this burst.props.AbstractProperties source. If the property is already defined in the destination object, then nothing is done and false is returned. Otherwise getValue(propdef) is called. If it returns undefined, nothing is done, and false is returned. Else obj[name] is set to the result, and true is returned. Note that no defaulting is done with this function, either from a passed in default value, or a static default from propdef.
|
|
Calls setObjectValue for each of the burst.reflect.PropertyDef in the Array. Optionally, as a convenience, this function can also set any static defaults (suitable if there are no more sources for dynamic values), and/or can validate that the object has values for all mandatory properties. If prefix is specified, it is prepended to each property name in propdefs prior looking up in this burst.props.AbstractProperties instance. Note that the prefix is not used when setting values
|