org.rhq.core.domain.configuration.definition
Class PropertyDefinitionSimple

java.lang.Object
  extended by org.rhq.core.domain.configuration.definition.PropertyDefinition
      extended by org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple
All Implemented Interfaces:
Serializable

public class PropertyDefinitionSimple
extends PropertyDefinition

Defines a simple property.

See Also:
Serialized Form

Constructor Summary
protected PropertyDefinitionSimple()
           
  PropertyDefinitionSimple(String name, String description, boolean required, PropertySimpleType type)
           
 
Method Summary
 void addConstraints(Constraint... constraintsToAdd)
           
 void addEnumeratedValues(PropertyDefinitionEnumeration... enumerations)
           
 boolean getAllowCustomEnumeratedValue()
          If false and this simple property has enumerated values defined, then the value of the simple property must be one of the enumerated values.
 Set<Constraint> getConstraints()
          Return all the constraints on this simple-property no matter how they are grouped together in the XML.
 String getDefaultValue()
          Returns the default value that this property definition defines for its value.
 List<PropertyDefinitionEnumeration> getEnumeratedValues()
          Get the <options> within <property-options> for a <simple-property>
 PropertyOptionsSource getOptionsSource()
           
 PropertySimpleType getType()
           
 MeasurementUnits getUnits()
           
 void removeEnumeratedValues(PropertyDefinitionEnumeration... enumerations)
           
 void setAllowCustomEnumeratedValue(boolean allowCustomEnumValue)
          See getAllowCustomEnumeratedValue() for a description of this flag.
 void setConstraints(Set<Constraint> constraints)
           
 void setDefaultValue(String defaultValue)
          Sets the default value for this property.
 void setEnumeratedValues(List<PropertyDefinitionEnumeration> enumeratedValues, boolean allowCustomEnumValue)
           
 void setOptionsSource(PropertyOptionsSource source)
           
 void setType(PropertySimpleType type)
           
 void setUnits(MeasurementUnits units)
           
 String toString()
           
 
Methods inherited from class org.rhq.core.domain.configuration.definition.PropertyDefinition
getActivationPolicy, getConfigurationDefinition, getDescription, getDisplayName, getId, getName, getOrder, getParentPropertyListDefinition, getParentPropertyMapDefinition, getPropertyGroupDefinition, getVersion, isReadOnly, isRequired, isSummary, setActivationPolicy, setConfigurationDefinition, setDescription, setDisplayName, setId, setName, setOrder, setParentPropertyListDefinition, setParentPropertyMapDefinition, setPropertyGroupDefinition, setReadOnly, setRequired, setSummary, setVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PropertyDefinitionSimple

public PropertyDefinitionSimple(@NotNull
                                String name,
                                String description,
                                boolean required,
                                @NotNull
                                PropertySimpleType type)

PropertyDefinitionSimple

protected PropertyDefinitionSimple()
Method Detail

getType

public PropertySimpleType getType()

setType

public void setType(PropertySimpleType type)

getConstraints

@NotNull
public Set<Constraint> getConstraints()
Return all the constraints on this simple-property no matter how they are grouped together in the XML.

Returns:

setConstraints

public void setConstraints(Set<Constraint> constraints)

addConstraints

public void addConstraints(Constraint... constraintsToAdd)

getEnumeratedValues

@NotNull
public List<PropertyDefinitionEnumeration> getEnumeratedValues()
Get the <options> within <property-options> for a <simple-property>


setEnumeratedValues

public void setEnumeratedValues(List<PropertyDefinitionEnumeration> enumeratedValues,
                                boolean allowCustomEnumValue)

addEnumeratedValues

public void addEnumeratedValues(PropertyDefinitionEnumeration... enumerations)

removeEnumeratedValues

public void removeEnumeratedValues(PropertyDefinitionEnumeration... enumerations)

getAllowCustomEnumeratedValue

public boolean getAllowCustomEnumeratedValue()
If false and this simple property has enumerated values defined, then the value of the simple property must be one of the enumerated values. If true, then the value of this simple property is not required to be one of the enumerated values - a user can opt to set the value to some other custom value. This is useful, for example, when a property has an enumerated list of common JDBC drivers but allows a user to enter their own custom JDBC driver if not one of the common drivers given in the enumerated list.

Note that this flag has no effect if there are no enumerated values defined for this simple property.

Returns:
flag to indicate if the property value is not restricted to one of the enumerated values

setAllowCustomEnumeratedValue

public void setAllowCustomEnumeratedValue(boolean allowCustomEnumValue)
See getAllowCustomEnumeratedValue() for a description of this flag.

Parameters:
allowCustomEnumValue -

getDefaultValue

public String getDefaultValue()
Returns the default value that this property definition defines for its value. Note, however, you rarely want to use this directly. Under most circumstances, you should be using the configuration definition's default template. For an example of where this method is useful, see org.rhq.core.clientapi.agent.configuration.ConfigurationUtility.initializeDefaultTemplate(ConfigurationDefinition)

Returns:
property default value

setDefaultValue

public void setDefaultValue(String defaultValue)
Sets the default value for this property. Note that you normally call this only at times when you plan on building default templates with this property definition later. See getDefaultValue() for more details on this default value.

Parameters:
defaultValue -

getUnits

public MeasurementUnits getUnits()

setUnits

public void setUnits(MeasurementUnits units)

getOptionsSource

public PropertyOptionsSource getOptionsSource()

setOptionsSource

public void setOptionsSource(PropertyOptionsSource source)

toString

public String toString()
Overrides:
toString in class PropertyDefinition


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