planetj.property
Class PropertyGroup

java.lang.Object
  |
  +--java.util.AbstractMap
        |
        +--java.util.HashMap
              |
              +--planetj.property.PropertyGroup
All Implemented Interfaces:
Cloneable, Comparable, Map, Serializable
Direct Known Subclasses:
AutoRunPropertyGroup, ConnectionReportPropertyGroup, DefaultPropertyGroup, DisplayColumnsPropertyGroup, FilePropertyGroup, FramePropertyGroup, OptionalSignonPropertyGroup, ReportPropertyGroup, StoredProcedurePropertyGroup, TableDisplayPropertyGroup

public abstract class PropertyGroup
extends HashMap
implements Comparable, Cloneable

Contains any number of related Property objects. Subclasses must provide a default constructor.

See Also:
Serialized Form

Field Summary
static String ALL_FALSE
          A metaproperty which allows any number of boolean properties to be set to false in the following fashion:

allFalse: property1, property2, property3, ...
static String ALL_TRUE
          A metaproperty which allows any number of boolean properties to be set to true in the following fashion:

allTrue: property1, property2, property3, ...
static short BOOLEAN_PROPERTY
           
static short DATE_PROPERTY
           
static short DOUBLE_PROPERTY
           
static short INTEGER_PROPERTY
           
static short LIST_PROPERTY
           
static String ROW_COLLECTION_KEY
           
static short STRING_PROPERTY
           
 
Constructor Summary
PropertyGroup()
          PropertyGroup constructor comment.
PropertyGroup(int initialCapacity)
          PropertyGroup constructor comment.
PropertyGroup(String pName)
          PropertyGroup constructor comment.
 
Method Summary
 Property add(Property pProperty)
          Adds a new Property to this PropertyGroup, replacing any previous Property with the same name
 Property addProperty(Property pProperty)
          Adds a new Property to this PropertyGroup, replacing any previous Property with the same name
 Property addProperty(String pName, Object pValue)
          Creates a new Property object based on a name and value.
 StringBuffer append(StringBuffer sb)
           
 Object clone()
           
 int compareTo(Object o)
          Compares this PropertyGroup with another by examining their names, or compares this PropertyGroup to a String (in this case this PropertyGroup's name is compared with the String)
 int compareTo(PropertyGroup pPG)
          Comapres this PropertyGroup with another by examining their names
 int compareTo(String pName)
          Comapres the name of this PropertyGroup with a String.
 boolean containsProperty(String propertyName)
           
 Property createProperty(String pName, Object pValue)
          Creates a new Property object based on a name and value (the Property is not added to this PropertyGroup).
 List getAllMetapropertyNames()
          Gets a List containing the names of all the supported metaproperties.
abstract  List getAllPropertyNames()
          Gets a List containing the names of all the supported properties, not including metaproperties.
 List getAllSetBooleanPropertyNames()
          Gets a List containing the names of all the boolean properties that have been set on this PropertyGroup.
 List getAllSetIntPropertyNames()
          Gets a List containing the names of all the int properties that have been set on this PropertyGroup.
 List getAllSetListPropertyNames()
          Gets a List containing the names of all the List properties that have been set on this PropertyGroup.
 List getAllSetPropertyNames()
          Gets a List containing the names of all the properties that have been set on this PropertyGroup.
 List getAllSetStringPropertyNames()
          Gets a List containing the names of all the String properties that have been set on this PropertyGroup.
 boolean getBooleanValue(String pName)
          Gets the value of the Property with the specified name as a boolean.
 Date getDateValue(String pName)
          Gets the value of the Property with the specified name as a Date.
 double getDoubleValue(String pName)
          Gets the value of the Property with the specified name as an double.
 int getIntValue(String pName)
          Gets the value of the Property with the specified name as an int.
 List getListValue(String pName)
          Gets the value of the Property with the specified name as a List
 String getName()
          Gets the name of this PropertyGroup
 Property getProperty(String pName)
          Gets the Property with the specified name
 short getPropertyType(String pPropertyName)
          Gets the type of property for a specified property name.
abstract  List getRequiredPropertyNames()
          Gets a List containing the names of all the required properties.
 String getStringValue(String pName)
          Gets the value of the Property with the specified name as a String
 Object getValue(String pName)
          Gets the value of the Property with the specified name
 boolean isMergeableOnList(PropertyGroup pGroup, String pMergeProperty)
          Tests if this PropertyGroup can be merged with another PropertyGroup on a property.
 boolean isMetaproperty(String pPropertyName)
          Tests if a property is a metaproperty.
 Iterator iterator()
          Gets an Iterator for this PropertyGroup
 PropertyGroup mergeOnList(PropertyGroup pGroup, String pMergeProperty)
          Merges this PropertyGroup into another PropertyGroup.
 Property put(Property p)
          Adds a Property object to this PropertyGroup
 Object put(String pName, Object pValue)
          Sets the *VALUE* of a property in this PropertyGroup.
 Property put(String pName, Property p)
          Adds a Property object to this PropertyGroup
 void setName(String newName)
          Sets the name of this PropertyGroup
 String toString()
           
 Object updateProperty(String pName, Object pValue)
          Updates a Property's value.
 
Methods inherited from class java.util.HashMap
clear, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

ALL_TRUE

public static final String ALL_TRUE
A metaproperty which allows any number of boolean properties to be set to true in the following fashion:

allTrue: property1, property2, property3, ... propertyN-1, propertyN;

See Also:
Constant Field Values

ALL_FALSE

public static final String ALL_FALSE
A metaproperty which allows any number of boolean properties to be set to false in the following fashion:

allFalse: property1, property2, property3, ... propertyN-1, propertyN;

See Also:
Constant Field Values

ROW_COLLECTION_KEY

public static final String ROW_COLLECTION_KEY
See Also:
Constant Field Values

STRING_PROPERTY

public static final short STRING_PROPERTY
See Also:
Constant Field Values

LIST_PROPERTY

public static final short LIST_PROPERTY
See Also:
Constant Field Values

BOOLEAN_PROPERTY

public static final short BOOLEAN_PROPERTY
See Also:
Constant Field Values

INTEGER_PROPERTY

public static final short INTEGER_PROPERTY
See Also:
Constant Field Values

DOUBLE_PROPERTY

public static final short DOUBLE_PROPERTY
See Also:
Constant Field Values

DATE_PROPERTY

public static final short DATE_PROPERTY
See Also:
Constant Field Values
Constructor Detail

PropertyGroup

public PropertyGroup()
PropertyGroup constructor comment.


PropertyGroup

public PropertyGroup(int initialCapacity)
PropertyGroup constructor comment.

Parameters:
initialCapacity - int

PropertyGroup

public PropertyGroup(String pName)
PropertyGroup constructor comment.

Method Detail

add

public Property add(Property pProperty)
Adds a new Property to this PropertyGroup, replacing any previous Property with the same name

Returns:
The Property that was replaced, or null if there was no such Property

addProperty

public Property addProperty(String pName,
                            Object pValue)
Creates a new Property object based on a name and value. The Property is then added to this PropertyGroup). Override this method if you want a subclass of Property returned.


addProperty

public Property addProperty(Property pProperty)
Adds a new Property to this PropertyGroup, replacing any previous Property with the same name

Returns:
The Property that was replaced, or null if there was no such Property

append

public StringBuffer append(StringBuffer sb)

clone

public Object clone()
Overrides:
clone in class HashMap

compareTo

public int compareTo(Object o)
Compares this PropertyGroup with another by examining their names, or compares this PropertyGroup to a String (in this case this PropertyGroup's name is compared with the String)

Specified by:
compareTo in interface Comparable

compareTo

public int compareTo(String pName)
Comapres the name of this PropertyGroup with a String. Do not delete this method.


compareTo

public int compareTo(PropertyGroup pPG)
Comapres this PropertyGroup with another by examining their names


containsProperty

public boolean containsProperty(String propertyName)

createProperty

public Property createProperty(String pName,
                               Object pValue)
Creates a new Property object based on a name and value (the Property is not added to this PropertyGroup). Override this method if you want a subclass of Property returned.


getAllMetapropertyNames

public List getAllMetapropertyNames()
Gets a List containing the names of all the supported metaproperties. If subclasses override this method, they should include the metaproperties from the superclass in the returned List.


getAllPropertyNames

public abstract List getAllPropertyNames()
Gets a List containing the names of all the supported properties, not including metaproperties.


getAllSetBooleanPropertyNames

public List getAllSetBooleanPropertyNames()
Gets a List containing the names of all the boolean properties that have been set on this PropertyGroup.


getAllSetIntPropertyNames

public List getAllSetIntPropertyNames()
Gets a List containing the names of all the int properties that have been set on this PropertyGroup.


getAllSetListPropertyNames

public List getAllSetListPropertyNames()
Gets a List containing the names of all the List properties that have been set on this PropertyGroup.


getAllSetPropertyNames

public List getAllSetPropertyNames()
Gets a List containing the names of all the properties that have been set on this PropertyGroup.


getAllSetStringPropertyNames

public List getAllSetStringPropertyNames()
Gets a List containing the names of all the String properties that have been set on this PropertyGroup.


getBooleanValue

public boolean getBooleanValue(String pName)
Gets the value of the Property with the specified name as a boolean. If the property has not been explicitly set, the metaproperties are checked. If the property has not been set and is not in the metaproperties, false is returned.


getDateValue

public Date getDateValue(String pName)
Gets the value of the Property with the specified name as a Date. Integer.MIN_VALUE is returned if there is no property with the specified name.


getDoubleValue

public double getDoubleValue(String pName)
Gets the value of the Property with the specified name as an double. Double.NaN is returned if there is no property with the specified name.


getIntValue

public int getIntValue(String pName)
Gets the value of the Property with the specified name as an int. Integer.MIN_VALUE is returned if there is no property with the specified name.


getListValue

public List getListValue(String pName)
Gets the value of the Property with the specified name as a List


getName

public String getName()
Gets the name of this PropertyGroup


getProperty

public Property getProperty(String pName)
Gets the Property with the specified name

Returns:
The Property with the specified name, or null if there was no such Property

getPropertyType

public final short getPropertyType(String pPropertyName)
Gets the type of property for a specified property name.


getRequiredPropertyNames

public abstract List getRequiredPropertyNames()
Gets a List containing the names of all the required properties.


getStringValue

public String getStringValue(String pName)
Gets the value of the Property with the specified name as a String


getValue

public Object getValue(String pName)
Gets the value of the Property with the specified name


isMergeableOnList

public boolean isMergeableOnList(PropertyGroup pGroup,
                                 String pMergeProperty)
Tests if this PropertyGroup can be merged with another PropertyGroup on a property. This is true if all the Properties in both groups have the same values, with the exception of the Property on which the merge is taking place, which must be a List Property. Merging two PropertyGroups creates a single PropertyGroup which is equivalent to the two merged PropertyGroups.


isMetaproperty

public boolean isMetaproperty(String pPropertyName)
Tests if a property is a metaproperty. A metaproperty is a property which operates on other properties. If subclasses override this method, they should invoke it on the superclass if the property is not a recognized property of the subclass


iterator

public Iterator iterator()
Gets an Iterator for this PropertyGroup


mergeOnList

public PropertyGroup mergeOnList(PropertyGroup pGroup,
                                 String pMergeProperty)
Merges this PropertyGroup into another PropertyGroup. This method merges two PropertyGroup objects by combining the values that each PropertyGroup has for a List Property into a single ListProperty; all other properties in the two PropertyGroups must have the same values. This method should only be invoked if the isMergeableOnList() method returns true for the two PropertyGroups. This object is not altered by this method.

Merging these two PropertyGroups:
GroupA {
prop1: value1;
prop2: value2A, value2B;
prop3: value3;
prop4: value4A, value4B, value4C;
}

GroupA {
prop1: value1;
prop2: value2C;
prop3: value3;
prop4: value4A, value4B, value4C;
}

on the prop2 property (this is the only property that can be merged on) would result in the following PropertyGroup:
GroupA {
prop1: value1;
prop2: value2A, value2B, value2C;
prop3: value3;
prop4: value4A, value4B, value4C;
}

Returns:
The PropertyGroup that was passed in as an argument. All of its properties, with the expection of the merge property, will not have been altered.

put

public Object put(String pName,
                  Object pValue)
Sets the *VALUE* of a property in this PropertyGroup. The old *VALUE* is returned.


put

public Property put(String pName,
                    Property p)
Adds a Property object to this PropertyGroup


put

public Property put(Property p)
Adds a Property object to this PropertyGroup


setName

public void setName(String newName)
Sets the name of this PropertyGroup


toString

public String toString()
Overrides:
toString in class AbstractMap

updateProperty

public Object updateProperty(String pName,
                             Object pValue)
Updates a Property's value. If the property does not exist in this PropertyGroup, a new Property object is created.

Returns:
The old value of the property before it was updated