com.ibm.rational.rpe.common.data
Class Value

java.lang.Object
  extended by com.ibm.rational.rpe.common.data.Value
All Implemented Interfaces:
Visitable

public class Value
extends java.lang.Object
implements Visitable

This is a wrapper class to hold a collection of data values. The data can be either object values of key-value pairs or a collection of property objects for attributes. This class can be created with the content as an object or as an object associated with a tag for XHTML values. All members are optional and are null initially.


Constructor Summary
Value()
           
Value(java.lang.Object content)
           
Value(java.lang.String tag, java.lang.Object content)
           
 
Method Summary
 void addAttribute(Property prop)
          Adds a new property to the attribute collection
 void addAttributes(java.util.Collection<Property> other)
          Adds a list of new properties to the attribute collection
 void addValue(Value value)
          Initializes the collection for the first time and inserts the value object into the collection of values.
 java.util.Collection<Property> getAttributes()
          Returns an unmodifiable collection of properties.
 java.lang.Object getContent()
          Returns the actual content that was set to the value
 java.lang.String getRawValue()
          Returns a string with the content of value, if present Returns a string with appended list of strings from the collection of values, if present
 java.lang.String getRichValue()
          Returns the attribute list for the tag in XHTML format Example -
 java.lang.String getTag()
          Returns the tag that this value has.
 Value getValue(int index)
          Returns the value object from the collection present at the index.
 java.util.Collection<Value> getValues()
          Returns an unmodifiable collection of values.
 void remove(Value toRemove)
          Removes the value object from the collection of values.
 void removeValues(java.util.Collection<Value> toRemove)
          Removes all the value objects that are passed as input from the collection of values.
 void setContent(java.lang.Object content)
          Set the actual content to the value
 void setTag(java.lang.String tag)
          Sets the tag to this class
 void visit(Visitable parent, com.ibm.rational.rpe.common.template.visitor.Visitor v)
          Visits the current visitable object
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Value

public Value()

Value

public Value(java.lang.Object content)

Value

public Value(java.lang.String tag,
             java.lang.Object content)
Method Detail

getTag

public java.lang.String getTag()
Returns the tag that this value has. The default value is null.

Returns:
The tag as a String

setTag

public void setTag(java.lang.String tag)
Sets the tag to this class


getValues

public java.util.Collection<Value> getValues()
Returns an unmodifiable collection of values. The result is never null.

Returns:
Collection of Value objects

getValue

public Value getValue(int index)
Returns the value object from the collection present at the index.

Parameters:
The - index as an int
Returns:
Value at the index
Throws:
java.lang.IndexOutOfBoundsException

addValue

public void addValue(Value value)
Initializes the collection for the first time and inserts the value object into the collection of values.

Parameters:
The - Value to be added to the Collection

remove

public void remove(Value toRemove)
Removes the value object from the collection of values.

Parameters:
The - Value to be added to the Collection

removeValues

public void removeValues(java.util.Collection<Value> toRemove)
Removes all the value objects that are passed as input from the collection of values.

Parameters:
Collection - of Value objects to be removed

getContent

public java.lang.Object getContent()
Returns the actual content that was set to the value

Returns:
Content of the Value as an Object

setContent

public void setContent(java.lang.Object content)
Set the actual content to the value

Parameters:
Content - of the Value as an Object

getRichValue

public java.lang.String getRichValue()
Returns the attribute list for the tag in XHTML format Example -

Returns:
String formatted in XHTML

getRawValue

public java.lang.String getRawValue()
Returns a string with the content of value, if present Returns a string with appended list of strings from the collection of values, if present

Returns:
String

addAttribute

public void addAttribute(Property prop)
Adds a new property to the attribute collection

Parameters:
Property - Property

getAttributes

public java.util.Collection<Property> getAttributes()
Returns an unmodifiable collection of properties. The result is never null.

Returns:
Collection of Properties

visit

public void visit(Visitable parent,
                  com.ibm.rational.rpe.common.template.visitor.Visitor v)
Visits the current visitable object

Specified by:
visit in interface Visitable
Parameters:
parent - - (optional) the parent visitable object that triggered the visit of this object
v - - the visitor

addAttributes

public void addAttributes(java.util.Collection<Property> other)
Adds a list of new properties to the attribute collection

Parameters:
Collection - containing Property Property