org.rhq.core.domain.configuration
Class PropertySimple

java.lang.Object
  extended by org.rhq.core.domain.configuration.Property
      extended by org.rhq.core.domain.configuration.PropertySimple
All Implemented Interfaces:
Externalizable, Serializable

public class PropertySimple
extends Property
implements Externalizable

This type of Property stores a simple Java primitive value in string form. Null values are allowed.

See Also:
Serialized Form

Field Summary
static int MAX_VALUE_LENGTH
           
 
Fields inherited from class org.rhq.core.domain.configuration.Property
QUERY_DELETE_BY_PROPERTY_IDS
 
Constructor Summary
  PropertySimple()
          Constructor for PropertySimple that stores a null value.
protected PropertySimple(PropertySimple original)
           
  PropertySimple(String name, Object value)
          Constructs a property that has the given name with the given value.
 
Method Summary
protected  void appendToStringInternals(StringBuilder str)
          Subclasses can override this to add things it wants to see in the toString.
 PropertySimple deepCopy()
           
 boolean equals(Object obj)
           
 Boolean getBooleanValue()
          Returns this property value as a Boolean.
 Double getDoubleValue()
          Returns this property value as a Double.
 Float getFloatValue()
          Returns this property value as a Float.
 Integer getIntegerValue()
          Returns this property value as a Integer.
 Long getLongValue()
          Returns this property value as a Long.
 Boolean getOverride()
           
 String getStringValue()
          Returns the value (in string form) of this property, which may be null.
 String getUnmaskedStringValue()
           
 int hashCode()
           
 void readExternal(ObjectInput in)
           
 void setBooleanValue(Boolean value)
          Sets the value of this property to the toString form of the given value.
 void setDoubleValue(Double value)
          Sets the value of this property to the toString form of the given value.
 void setFloatValue(Float value)
          Sets the value of this property to the toString form of the given value.
 void setIntegerValue(Integer value)
          Sets the value of this property to the toString form of the given value.
 void setLongValue(Long value)
          Sets the value of this property to the toString form of the given value.
 void setOverride(Boolean override)
           
 void setStringValue(String value)
          Sets the value of this property to the given value.
 void setUnmaskedStringValue(String unmaskedStringValue)
           
 void setValue(Object value)
          Sets the value of this property to the toString form of the given value.
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class org.rhq.core.domain.configuration.Property
getConfiguration, getErrorMessage, getId, getName, getParentList, getParentMap, readExternalAgent, readExternalRemote, setConfiguration, setErrorMessage, setErrorMessageFromThrowable, setId, setName, setParentList, setParentMap, toString, writeExternalAgent, writeExternalRemote
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_VALUE_LENGTH

public static final int MAX_VALUE_LENGTH
See Also:
Constant Field Values
Constructor Detail

PropertySimple

public PropertySimple()
Constructor for PropertySimple that stores a null value. NOTE: When using this constructor, you need to supply a name via #setName manually.


PropertySimple

protected PropertySimple(PropertySimple original)

PropertySimple

public PropertySimple(@NotNull
                      String name,
                      @Nullable
                      Object value)
Constructs a property that has the given name with the given value. The value's toString representation will be stored in this object - value itself will not be stored (that is, this object will not hold a reference to value).

Parameters:
name -
value -
Method Detail

setValue

public void setValue(@Nullable
                     Object value)
Sets the value of this property to the toString form of the given value. This object will not hold a reference to value.

Parameters:
value -

getStringValue

@Nullable
public String getStringValue()
Returns the value (in string form) of this property, which may be null.

This may return null

Returns:
string form of the property value

setStringValue

public void setStringValue(@Nullable
                           String value)
Sets the value of this property to the given value.

Calling this method is the same as if calling setValue(Object).

Parameters:
value -

getBooleanValue

@Nullable
public Boolean getBooleanValue()
Returns this property value as a Boolean. See Boolean.parseBoolean(String) for the behavior of this method.

This may return null

Returns:
the value as a Boolean

setBooleanValue

public void setBooleanValue(@Nullable
                            Boolean value)
Sets the value of this property to the toString form of the given value. This object will not hold a reference to the value.

Calling this method is the same as if calling setValue(Object).

Parameters:
value -

getLongValue

@Nullable
public Long getLongValue()
Returns this property value as a Long. See Long.parseLong(String) for the behavior of this method.

This may return null

Returns:
the value as a Long

setLongValue

public void setLongValue(@Nullable
                         Long value)
Sets the value of this property to the toString form of the given value. This object will not hold a reference to the value.

Calling this method is the same as if calling setValue(Object).

Parameters:
value -

getIntegerValue

@Nullable
public Integer getIntegerValue()
Returns this property value as a Integer. See Integer.parseInt(String) for the behavior of this method.

This may return null

Returns:
the value as an Integer

setIntegerValue

public void setIntegerValue(@Nullable
                            Integer value)
Sets the value of this property to the toString form of the given value. This object will not hold a reference to the value.

Calling this method is the same as if calling setValue(Object).

Parameters:
value -

getFloatValue

@Nullable
public Float getFloatValue()
Returns this property value as a Float. See Float.parseFloat(String) for the behavior of this method.

This may return null

Returns:
the value as a Float

setFloatValue

public void setFloatValue(@Nullable
                          Float value)
Sets the value of this property to the toString form of the given value. This object will not hold a reference to the value.

Calling this method is the same as if calling setValue(Object).

Parameters:
value -

getDoubleValue

@Nullable
public Double getDoubleValue()
Returns this property value as a Double. See Double.parseDouble(String) for the behavior of this method.

This may return null

Returns:
the value as a Double

setDoubleValue

public void setDoubleValue(@Nullable
                           Double value)
Sets the value of this property to the toString form of the given value. This object will not hold a reference to the value.

Calling this method is the same as if calling setValue(Object).

Parameters:
value -

getOverride

public Boolean getOverride()

setOverride

public void setOverride(Boolean override)

getUnmaskedStringValue

public String getUnmaskedStringValue()

setUnmaskedStringValue

public void setUnmaskedStringValue(String unmaskedStringValue)

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Overrides:
readExternal in class Property
Throws:
IOException
ClassNotFoundException
See Also:
Property.readExternal(java.io.ObjectInput)

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Overrides:
writeExternal in class Property
Throws:
IOException
See Also:
Property.writeExternal(java.io.ObjectOutput)

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Property

deepCopy

public PropertySimple deepCopy()
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


Copyright © 2008-2009 RHQ Project Advisory Board (Red Hat, Inc.). All Rights Reserved.