org.rhq.core.domain.configuration
Class PropertyList

java.lang.Object
  extended by org.rhq.core.domain.configuration.Property
      extended by org.rhq.core.domain.configuration.PropertyList
All Implemented Interfaces:
Serializable, Comparable<Property>, DeepCopyable<Property>

public class PropertyList
extends Property

Holds an indexed list of child properties. This can hold any number of properties, including additional lists and maps of properties (which means you can have N-levels of hierarchical data).

This list will store the properties in the order they are added.

Caution must be used when accessing this object. This class is not thread safe and, for entity persistence, the child properties must have their Property.getParentList() field set. This is done for you when using the add(Property) method.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.rhq.core.domain.configuration.Property
QUERY_DELETE_BY_PROPERTY_IDS
 
Constructor Summary
  PropertyList()
           
protected PropertyList(PropertyList original, boolean keepId)
           
  PropertyList(String name)
          Creates a new, empty PropertyList object that is associated with the given name.
  PropertyList(String name, Property... startingList)
          Creates a new PropertyList object that is associated with the given name and has the given properties as its initial list of child properties.
 
Method Summary
 void add(Property property)
          Adds a child property to the end of this list.
 void afterUnmarshal(Object u, Object parent)
          This listener runs after jaxb unmarshalling and reconnects children properties to their parent list (as we don't send them avoiding cyclic references).
protected  void appendToStringInternals(StringBuilder str)
          Subclasses can override this to add things it wants to see in the toString.
 PropertyList deepCopy(boolean keepId)
           
 boolean equals(Object obj)
          NOTE: An PropertyList containing a null list is considered equal to a PropertyList containing an empty list.
 List<Property> getList()
          Returns the children of this list.
 int hashCode()
           
 void setList(List<Property> list)
          Sets the list of child properties directly to the given list reference.
 
Methods inherited from class org.rhq.core.domain.configuration.Property
compareTo, getConfiguration, getErrorMessage, getId, getName, getParentList, getParentMap, setConfiguration, setErrorMessage, setId, setName, setParentList, setParentMap, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PropertyList

public PropertyList()

PropertyList

public PropertyList(@NotNull
                    String name)
Creates a new, empty PropertyList object that is associated with the given name.

Parameters:
name - the name of the list itself

PropertyList

protected PropertyList(PropertyList original,
                       boolean keepId)

PropertyList

public PropertyList(@NotNull
                    String name,
                    @NotNull
                    Property... startingList)
Creates a new PropertyList object that is associated with the given name and has the given properties as its initial list of child properties. All properties found in startingList will have their parent list set to this newly constructed list.

Parameters:
name - the name of the list itself
startingList - a list of properties to be immediately added to this list
Method Detail

getList

@NotNull
public List<Property> getList()
Returns the children of this list.

Warning: Caution should be used when accessing the returned list. Please see the javadoc for this class for more information.

Returns:
the list of child properties

setList

public void setList(List<Property> list)
Sets the list of child properties directly to the given list reference. This means the actual list object is stored internally in this object. Changes made to list will be reflected back into this object.

Warning: Caution should be used when setting this object's internal list. Please see the javadoc for this class for more information.

Parameters:
list - the new list used internally by this object

add

public void add(@NotNull
                Property property)
Adds a child property to the end of this list. This method also sets the parent list for the child property to make persistence work.

Parameters:
property - the property to add to this list

equals

public boolean equals(Object obj)
NOTE: An PropertyList containing a null list is considered equal to a PropertyList containing an empty list.

Overrides:
equals in class Property

hashCode

public int hashCode()
Overrides:
hashCode in class Property

deepCopy

public PropertyList deepCopy(boolean keepId)
Specified by:
deepCopy in interface DeepCopyable<Property>
Overrides:
deepCopy in class Property

appendToStringInternals

protected void appendToStringInternals(StringBuilder str)
Description copied from class: Property
Subclasses can override this to add things it wants to see in the toString.

Overrides:
appendToStringInternals in class Property
Parameters:
str - the builder to append strings to

afterUnmarshal

public void afterUnmarshal(Object u,
                           Object parent)
This listener runs after jaxb unmarshalling and reconnects children properties to their parent list (as we don't send them avoiding cyclic references).



Copyright © 2008-2011 Red Hat, Inc.. All Rights Reserved.