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

burst.reflect.PropertyDef Class Reference

Inheritance diagram for burst.reflect.PropertyDef:

burst.reflect.PropertyDefBoolean burst.reflect.PropertyDefExpr burst.reflect.PropertyDefImageUrl burst.reflect.PropertyDefNumber burst.reflect.PropertyDefString List of all members.

Detailed Description

Abstract base class for property metadata.

There is a subclass for each property type (boolean, etc.). There is an instance for each property name.


Public Member Functions

 PropertyDef (Object values)
 Initialize a PropertyDef instance.

Object parse (String str, Object dflt)
 If the input str is null or all white, then a default is returned: if dflt is not undefined, it is returned (this includes dflt being null) if the property has a defined defaultValue, it is returned otherwise undefined is returned.

abstract Object parseImpl (String str)
 Abstract method which must be implemented by a subclass.

abstract String valueType ()
 The name of the type of the values returned by the parse method.

abstract String propertyType ()
 the name of the burst.reflect.PropertyDef subclass

Boolean setDefault (Object obj)
 If the object has no member variable by this name, and this burst.reflect.PropertyDef has a defaultValue, set it in the object and return true.

void checkMandatory (Object obj, Function handler)
 If this property is not mandatory, do nothing.


Static Public Member Functions

void setDefaultEach (Object obj, Array propdefs)
 A class method to call setDefault for each instance in an Array of burst.reflect.PropertyDef.

void checkMandatoryEach (Object obj, Array propdefs, Function handler)
 A class method to call checkMandatory for each instance in an Array of burst.reflect.PropertyDef.


Constructor & Destructor Documentation

burst.reflect.PropertyDef.PropertyDef Object  values  ) 
 

Initialize a PropertyDef instance.

The single constructor argument is an associative array with these keys:

  • 'name' mandatory.
  • 'defaultValue' optional. no default.
  • 'description' optional. no default.
  • 'isMandatory' optional. defaults to false.
  • 'isArray' optional. defaults to false.
  • 'regexp' optional. If supplied, all String values must match this.
  • 'enumArray' optional. An Array of String values.
  • 'enumMap' optional. An associative map from String value to property value.
    Parameters:
    values The associative array to initialize from


Member Function Documentation

void burst.reflect.PropertyDef.checkMandatory Object  obj,
Function  handler
 

If this property is not mandatory, do nothing.

If the object has a defined value for the property, do nothing. Otherwise, if handler is specified, call it with (propdef, obj) Otherwise throw burst.props.PropertyError complaining about the missing value.

Parameters:
obj The Object to check.
handler optional. If specified, it is called rather than the default handling.

Object burst.reflect.PropertyDef.parse String  str,
Object  dflt
 

If the input str is null or all white, then a default is returned: if dflt is not undefined, it is returned (this includes dflt being null) if the property has a defined defaultValue, it is returned otherwise undefined is returned.

  • * - * - Otherwise an attempt is made to parse the string str as a legitimate value. The function throws a burst.props.PropertyError if it is not valid.

Parameters:
str The String to parse (can also be Boolean or Number, and it is converted to String)
dflt Optional. If present, it is the value returned when str is all white or not defined.
Returns:
The Object resulting from parsing str.
Exceptions:
burst.props.PropertyError if there is a problem parsing it.

abstract Object burst.reflect.PropertyDef.parseImpl String  str  )  [pure virtual]
 

Abstract method which must be implemented by a subclass.

The passed in String str will never be null or all white.

Boolean burst.reflect.PropertyDef.setDefault Object  obj  ) 
 

If the object has no member variable by this name, and this burst.reflect.PropertyDef has a defaultValue, set it in the object and return true.

If either the object is already set, or this burst.reflect.PropertyDef has no defaultValue, return false.

Returns:
true if set.


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