com.ibm.adt.topology.object.properties
Class PropertyArray

java.lang.Object
  extended by com.ibm.adt.topology.object.properties.PropertyObject
      extended by com.ibm.adt.topology.object.properties.PropertyArray
All Implemented Interfaces:
java.io.Serializable

public class PropertyArray
extends PropertyObject

PropertyArray is a component of the TopologyObject Properties heirachy. It is used to create a complex property definition that may contain either PropertyList or non-specified Object objects. Objects that are not a PropertyList are automatically wrapped in a PropertyValue object to maintain property hierarchy and navigability. Note that a PropertyArray may only store like objects, and may not store other Property or PropertyArray objects. For storing Property objects, use PropertyList instead. PropertyArray may only be stored as a Property value.

See Also:
PropertyList, Property, PropertyValue, Serialized Form

Field Summary
 
Fields inherited from class com.ibm.adt.topology.object.properties.PropertyObject
hashCode, name
 
Constructor Summary
PropertyArray()
          Creates a new PropertyArray instance.
 
Method Summary
 void add(java.lang.Object object)
          Stores an object in the PropertyArray.
 void copyAll(PropertyArray array)
          Copies a collection of Property(s) to this PropertyList.
 boolean equals(java.lang.Object obj)
           
(package private)  void finalizeProperty()
          Finalizes the PropertyObject structure.
(package private)  PropertyList findProperties(java.lang.String searchText, boolean isCaseSensitive, boolean isCollectionName, boolean isPropertyName, boolean isPropertyValue)
          Search the PropertyArray for occurrences of properties that match the specified criteria.
 PropertyObject get(int index)
          Returns the element in the PropertyArray corresponding to the specified index.
 java.util.Collection getAsCollection()
          Returns the PropertyArray as an Collection.
 PropertyObject getPropertyValue(java.lang.String key)
          Used to retrieve a nested property value according to the specified xpath-style key.
 java.lang.String getStoredObjectClass()
          Returns the class name of the contained elements.
 int hashCode()
           
 int indexOf(PropertyObject object)
          Returns the index of the given PropertyObject within the array.
 boolean isEmpty()
          Test whether the PropertyArray is empty.
 java.util.Iterator iterator()
          Return an Iterator for the PropertyArray.
 java.lang.String peek()
          Returns string that peeks the property value.
 int size()
          Returns the number of objects stored in the PropertyArray.
 java.lang.String toString()
           
 
Methods inherited from class com.ibm.adt.topology.object.properties.PropertyObject
getKey, getName, getOrdinal, getParent, getRoot, setParent, setRoot
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PropertyArray

public PropertyArray()
Creates a new PropertyArray instance.

Method Detail

getPropertyValue

public final PropertyObject getPropertyValue(java.lang.String key)
                                      throws TopologyException
Used to retrieve a nested property value according to the specified xpath-style key. PropertyArray key must use "[key]" notation, where "key" can be an index value or an equality test for a contained array element.

Parameters:
key - specifies the key of the Property whose value is to be retrieved
Returns:
the PropertyObject instance that corresponds to the provided key
Throws:
TopologyException

get

public final PropertyObject get(int index)
Returns the element in the PropertyArray corresponding to the specified index.

Parameters:
index -
Returns:

iterator

public final java.util.Iterator iterator()
Return an Iterator for the PropertyArray.

Returns:
iterator

size

public final int size()
Returns the number of objects stored in the PropertyArray.

Returns:
number of objects

getAsCollection

public final java.util.Collection getAsCollection()
Returns the PropertyArray as an Collection. Note: Changes to the Collection are not reflected in PropertyArray.

Returns:
a Collection

add

public final void add(java.lang.Object object)
               throws TopologyException
Stores an object in the PropertyArray. Objects that are not a subclass of PropertyObject are first wrapped in PropertyValue object to maintain property hierarchy and navigability. Note that a PropertyArray instance may only store like objects.

Parameters:
object - the object to store
Throws:
TopologyException

getStoredObjectClass

public final java.lang.String getStoredObjectClass()
Returns the class name of the contained elements.


isEmpty

public final boolean isEmpty()
Test whether the PropertyArray is empty.

Returns:
true if empty

copyAll

public final void copyAll(PropertyArray array)
                   throws TopologyException
Copies a collection of Property(s) to this PropertyList.

Parameters:
properties -
Throws:
TopologyException

indexOf

public final int indexOf(PropertyObject object)
Returns the index of the given PropertyObject within the array.

Parameters:
object -
Returns:
the index

peek

public final java.lang.String peek()
Description copied from class: PropertyObject
Returns string that peeks the property value.

Specified by:
peek in class PropertyObject
Returns:

toString

public final java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public final boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public final int hashCode()
Overrides:
hashCode in class java.lang.Object

findProperties

final PropertyList findProperties(java.lang.String searchText,
                                  boolean isCaseSensitive,
                                  boolean isCollectionName,
                                  boolean isPropertyName,
                                  boolean isPropertyValue)
                           throws TopologyException
Search the PropertyArray for occurrences of properties that match the specified criteria.

Parameters:
searchText - - a regular expression string to match against
isCaseInsensitive - - make search case insensitive
isCollectionName - - return property collection if property name matches a collection property.
isPropertyName - - search property names
isPropertyValue - - search property values
Returns:
Throws:
TopologyException

finalizeProperty

final void finalizeProperty()
Description copied from class: PropertyObject
Finalizes the PropertyObject structure.

Specified by:
finalizeProperty in class PropertyObject


© Copyright 2006 IBM Corp. 2006 All Rights Reserved