Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

burst.props.AbstractProperties Class Reference

Inheritance diagram for burst.props.AbstractProperties:

burst.props.GroupProperties burst.props.MapProperties burst.props.NodeAttributesProperties burst.props.QueryStringProperties burst.props.StyleProperties burst.props.SubProperties burst.Config List of all members.

Detailed Description

Abstract base class for anything that can hold named values.

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:

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.

Constructor & Destructor Documentation

burst.props.AbstractProperties.AbstractProperties String  implicit_prefix  ) 

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.

implicit_prefix Optional. If specified, the implicit prefix.

Member Function Documentation

abstract String burst.props.AbstractProperties.getPropertyImpl String  name  )  [pure virtual]

must be overridden by subclass.

Need not worry about trimming etc, as getProperty does that.

Object burst.props.AbstractProperties.getValue burst.reflect.PropertyDef  propdef,
Object  dflt

A convenience to lookup a property string and parse it in one step.

First calls str = getProperty( Then it returns propdef.parse(str, dflt).

propdef The property definition
dflt optional, defaults to undefined.
Same as burst.reflect.PropertyDef.parse

Boolean burst.props.AbstractProperties.setObjectValue Object  obj,
burst.reflect.PropertyDef  propdef,
String  prefix

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.

obj The object to set values in.
propdef The burst.reflect.PropertyDef defining the property in question.
prefix Optional. If specified, getSubValue is used instead of getValue.
true if a value was set.
burst.props.PropertyError If the property string is not valid.

Object burst.props.AbstractProperties.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.

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

obj The object to set.
propdefs The Array of burst.reflect.PropertyDef instances
prefix The prefix to use in front of each property name before looking up each value.
do_defaults optional. If true, also call burst.reflect.PropertyDef.setDefaultEach
do_mandatory optioal. If true, also call burst.reflect.PropertyDef.checkMandatoryEach
the obj argument
burst.props.PropertyError If any property string used is not valid.

The documentation for this class was generated from the following file:
Generated on Tue Nov 30 04:03:09 2004 for BurstProject by doxygen 1.3.4