org.rhq.core.domain.configuration
Class Property

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

public class Property
extends Object
implements Serializable, DeepCopyable<Property>, Comparable<Property>

The abstract base class for all Configuration value property types. A property is associated with a specific getName() and can contain one or more values. Since a Configuration represents a hierarchical set of data, properties can have a parent. For example, if a property is a member of a PropertyList, it will have a parent list.

There are three different types (i.e. subclasses) of properties:

These subclasses are mapped into a single table so referential integrity is easy to maintain.

Maps may only have one value for a given key, while lists may have many and follow Bag rules.

Note that each property can have an optional error message associated with it. This is used typically when the property is stored in a configuration that is inside a AbstractResourceConfigurationUpdate object. If a property failed to get set, this property's error message can be used to indicate why it failed (e.g. the property's value was out of range or some other validation rule was not followed).

See Also:
Serialized Form

Field Summary
static String QUERY_DELETE_BY_PROPERTY_IDS
           
 
Constructor Summary
  Property()
           
protected Property(Property original, boolean keepId)
           
 
Method Summary
protected  void appendToStringInternals(StringBuilder str)
          Subclasses can override this to add things it wants to see in the toString.
 int compareTo(Property other)
           
 Property deepCopy(boolean keepId)
           
 boolean equals(Object obj)
           
 Configuration getConfiguration()
          Returns the Configuration object where this property can be found.
 String getErrorMessage()
          If the property value has been detected to be invalid for some reason, this is an error message that describes the error.
 int getId()
           
 String getName()
          Returns the name of this property.
 PropertyList getParentList()
          Returns the parent of this property, assuming this property is a child of a PropertyList.
 PropertyMap getParentMap()
          Returns the parent of this property, assuming this property is a child of a PropertyMap.
 int hashCode()
           
 void setConfiguration(Configuration configuration)
          Sets the Configuration object where this property can be found.
 void setErrorMessage(String errorMessage)
           
 void setId(int id)
           
 void setName(String name)
          Defines the name that this property will be associated with.
 void setParentList(PropertyList parentList)
          Sets the parent of this property, which will assume this property is a member of a list.
 void setParentMap(PropertyMap parentMap)
          Sets the parent of this property, which will assume this property is a member of a map.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

QUERY_DELETE_BY_PROPERTY_IDS

public static final String QUERY_DELETE_BY_PROPERTY_IDS
See Also:
Constant Field Values
Constructor Detail

Property

public Property()

Property

protected Property(Property original,
                   boolean keepId)
Method Detail

getId

public int getId()

setId

public void setId(int id)

getName

@NotNull
public String getName()
Returns the name of this property. Note that all properties, including lists and maps of properties, are associated with a name.

Returns:
the property name

setName

public void setName(@NotNull
                    String name)
Defines the name that this property will be associated with.

Parameters:
name - the name that this property will be associated with

getParentList

public PropertyList getParentList()
Returns the parent of this property, assuming this property is a child of a PropertyList. null will be returned if this property is not a child of any list.

Note that direct children of the Configuration object will return null.

Returns:
parent list or null

setParentList

public void setParentList(PropertyList parentList)
Sets the parent of this property, which will assume this property is a member of a list. Set this to null if this property is not a child of any list.

Parameters:
parentList - the parent of this property or null

getParentMap

public PropertyMap getParentMap()
Returns the parent of this property, assuming this property is a child of a PropertyMap. null will be returned if this property is not a child of any map.

Note that direct children of the Configuration object will return null.

Returns:
parent list or null

setParentMap

public void setParentMap(PropertyMap parentMap)
Sets the parent of this property, which will assume this property is a member of a map. Set this to null if this property is not a child of any map.

Parameters:
parentMap - the parent of this property or null

getConfiguration

public Configuration getConfiguration()
Returns the Configuration object where this property can be found. This will be null if this property is a child of a PropertyList or PropertyMap and not a direct child of the Configuration itself.

Returns:
this property's associated Configuration, or null

setConfiguration

public void setConfiguration(Configuration configuration)
Sets the Configuration object where this property can be found. Set this to null if this property is a child of a PropertyList or PropertyMap and not a direct child of the Configuration itself.

Parameters:
configuration - this property's associated Configuration, or null

getErrorMessage

@Nullable
public String getErrorMessage()
If the property value has been detected to be invalid for some reason, this is an error message that describes the error. This may be null if either the property is valid or it is not known if the property is valid or not. Depending on the context of where this property instance is will dictate the semantics of a null error message (see AbstractResourceConfigurationUpdate).

Returns:
error message describing how/why the property is invalid

setErrorMessage

public void setErrorMessage(@Nullable
                            String errorMessage)

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

deepCopy

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

toString

public String toString()
Overrides:
toString in class Object

appendToStringInternals

protected void appendToStringInternals(StringBuilder str)
Subclasses can override this to add things it wants to see in the toString.

Parameters:
str - the builder to append strings to

compareTo

public int compareTo(Property other)
Specified by:
compareTo in interface Comparable<Property>


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