Arch4J 1.1

org.arch4j.propertytree
Class Property

java.lang.Object
  |
  +--org.arch4j.propertytree.Property
All Implemented Interfaces:
ReadOnlyProperty

public class Property
extends Object
implements ReadOnlyProperty


Constructor Summary
Property(String aName)
          build a node in a property tree.
Property(String aName, String aValue)
          build a node in a property tree.
 
Method Summary
 void addChild(Property aProperty)
          add a property as a child of this property.
 Property getChild(String aName)
          retrieve the first child property found with a given name name
 Property getChild(String aName, String aValue)
          retrieve a the first property with a given name and value.
 String[] getChildNames()
          return a list of all of this property's children's names.
 Property[] getChildren()
          retrieve the complete list of this property's children.
 Property[] getChildren(String aName)
          retrieve a set of child property by name, leaving them in the list.
 String getChildValue(String aName)
          retrieve the value of the first child property found with a given name
 String getChildValue(String aName, String defaultValue)
          retrieve the value of the first child property found with a given name, or return a default value if no property is found.
 int getChildValueAsInt(String aName)
          retrieve the value of the first child property found with a given name and convert it to an integer
 int getChildValueAsInt(String aName, int defaultValue)
          retrieve the value of the first child property found with a given name and convert it to an integer, or return a default value if no property is found.
 String[] getChildValues(String aName)
          retrive values of all child propeties with a given name.
 String getName()
           
 ReadOnlyProperty getReadOnlyChild(String aName)
          retrieve the first child property found with a given name.
 ReadOnlyProperty getReadOnlyChild(String aName, String aValue)
          retrieve a read only version of the first property with a given name and value.
 ReadOnlyProperty[] getReadOnlyChildren()
          retrieve the complete read-only list of this property's children.
 ReadOnlyProperty[] getReadOnlyChildren(String aName)
          retrieve a read only set of child property by name, leaving them in the list.
 String getValue()
           
 void setValue(String newValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Property

public Property(String aName)
build a node in a property tree. Name need not be unique among sibling properties.

Parameters:
aName - name or key for this property. Example "QueueSize".

Property

public Property(String aName,
                String aValue)
build a node in a property tree. This is a convenience constructor that allows for setting of the name and value for this Property.

Parameters:
aName - name or key for this property. Example "QueueSize".
aValue - value of this property represented as a String. Example "50".
Method Detail

getName

public String getName()
Specified by:
getName in interface ReadOnlyProperty
Returns:
name (key) for this property.

setValue

public void setValue(String newValue)

getValue

public String getValue()
Specified by:
getValue in interface ReadOnlyProperty
Returns:
the values of this property String

addChild

public void addChild(Property aProperty)
add a property as a child of this property.

Parameters:
aProperty - new property to add as this property's child.

getChildren

public Property[] getChildren(String aName)
retrieve a set of child property by name, leaving them in the list.

Parameters:
aName - name (key) of child properties to retrieve.
Returns:
the child properties with the given name.

getChild

public Property getChild(String aName)
retrieve the first child property found with a given name name

Parameters:
aName - name (key) of child property to retrieve.
Returns:
the first child property with the given name.

getReadOnlyChildren

public ReadOnlyProperty[] getReadOnlyChildren(String aName)
retrieve a read only set of child property by name, leaving them in the list.

Specified by:
getReadOnlyChildren in interface ReadOnlyProperty
Parameters:
aName - name (key) of child properties to retrieve.
Returns:
the child properties with the given name.

getReadOnlyChild

public ReadOnlyProperty getReadOnlyChild(String aName)
retrieve the first child property found with a given name.

Specified by:
getReadOnlyChild in interface ReadOnlyProperty
Parameters:
aName - name (key) of child properties to retrieve.
Returns:
the child properties with the given name, null if none found

getChild

public Property getChild(String aName,
                         String aValue)
retrieve a the first property with a given name and value.

Parameters:
aName - name (key) of child property to retrieve.
aValue - value of child property to retrieve.
Returns:
the child propertY with the given name and value, null if none found

getReadOnlyChild

public ReadOnlyProperty getReadOnlyChild(String aName,
                                         String aValue)
retrieve a read only version of the first property with a given name and value.

Specified by:
getReadOnlyChild in interface ReadOnlyProperty
Parameters:
aName - name (key) of child property to retrieve.
aValue - value of child property to retrieve.
Returns:
the child property with the given name and value, null if none found

getChildren

public Property[] getChildren()
retrieve the complete list of this property's children.

Returns:
all child properties

getReadOnlyChildren

public ReadOnlyProperty[] getReadOnlyChildren()
retrieve the complete read-only list of this property's children.

Specified by:
getReadOnlyChildren in interface ReadOnlyProperty
Returns:
all child properties

getChildValues

public String[] getChildValues(String aName)
retrive values of all child propeties with a given name.

Specified by:
getChildValues in interface ReadOnlyProperty
Parameters:
aName - name (key) of child property to retrieve.
Returns:
the values of child properties with a given name. Returns an empty array if there are no children.

getChildValue

public String getChildValue(String aName)
retrieve the value of the first child property found with a given name

Specified by:
getChildValue in interface ReadOnlyProperty
Parameters:
aName - name (key) of child property to retrieve.
Returns:
the value of the first child property with the given name or null if none found.

getChildValue

public String getChildValue(String aName,
                            String defaultValue)
retrieve the value of the first child property found with a given name, or return a default value if no property is found.

Specified by:
getChildValue in interface ReadOnlyProperty
Parameters:
aName - name (key) of child property to retrieve.
Returns:
the value of the first child property with the given name or the provided default if none found.

getChildValueAsInt

public int getChildValueAsInt(String aName)
                       throws FormatException
retrieve the value of the first child property found with a given name and convert it to an integer

Specified by:
getChildValueAsInt in interface ReadOnlyProperty
Parameters:
aName - name (key) of child property to retrieve.
Returns:
the integer value of the first child property with the given name
Throws:
RecordReadError - if no field by the given name can be found
FormatException

getChildValueAsInt

public int getChildValueAsInt(String aName,
                              int defaultValue)
retrieve the value of the first child property found with a given name and convert it to an integer, or return a default value if no property is found.

Specified by:
getChildValueAsInt in interface ReadOnlyProperty
Parameters:
aName - name (key) of child property to retrieve.
Returns:
the integer value of the first child property with the given name or the provided default if none found.

getChildNames

public String[] getChildNames()
return a list of all of this property's children's names.

Specified by:
getChildNames in interface ReadOnlyProperty
Returns:
array of child names. Returns empty array (not null) if there are no children.

Arch4J 1.1

Copyright © 2000-2004 SpiderLogic, a service of Wipfli Ullrich Bertelson LLP.