uk.ac.starlink.table
Class DescribedValue

java.lang.Object
  extended by uk.ac.starlink.table.DescribedValue

public class DescribedValue
extends Object

Contains a value (an Object) as well as a ValueInfo object which provides metadata about that value (name, class, shape, units and so on).


Constructor Summary
DescribedValue(ValueInfo vinfo)
          Constructs a new DescribedValue object to hold values described by a given ValueInfo object.
DescribedValue(ValueInfo vinfo, Object value)
          Constructs a new DescribedValue object to hold values described by a given ValueInfo object and with a given initial value.
 
Method Summary
 ValueInfo getInfo()
          Returns the ValueInfo object which describes the value held by this object.
 Object getValue()
          Returns the actual value content of this object.
 String getValueAsString(int maxLength)
          Returns a string representation of the value of this object, no longer than a given maximum length.
 void setValue(Object value)
          Sets the actual value content of this object.
 void setValueFromString(String sval)
          Sets the value of this object from a string representation.
 String toString()
          Returns a string representation of this object no longer than a default maximum length.
 String toString(int maxLength)
          Returns a string representation of this object, no longer than a given maximum length.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DescribedValue

public DescribedValue(ValueInfo vinfo)
Constructs a new DescribedValue object to hold values described by a given ValueInfo object.

Parameters:
vinfo - the metadata handler for this value

DescribedValue

public DescribedValue(ValueInfo vinfo,
                      Object value)
Constructs a new DescribedValue object to hold values described by a given ValueInfo object and with a given initial value.

Parameters:
vinfo - the metadata describing this object's value
value - the value of this object
Throws:
IllegalArgumentException - if value.getClass() is not compatible with vinfo.getContentClass()
Method Detail

getInfo

public ValueInfo getInfo()
Returns the ValueInfo object which describes the value held by this object.

Returns:
the metadata describing this object's value

setValue

public void setValue(Object value)
Sets the actual value content of this object.

Parameters:
value - the value
Throws:
IllegalArgumentException - if value.getClass() is not compatible with getValueInfo().getContentClass()

getValue

public Object getValue()
Returns the actual value content of this object.

Returns:
the value

getValueAsString

public String getValueAsString(int maxLength)
Returns a string representation of the value of this object, no longer than a given maximum length.

Parameters:
maxLength - the maximum number of characters in the returned string

setValueFromString

public void setValueFromString(String sval)
Sets the value of this object from a string representation.

Parameters:
sval - string representation of the new value

toString

public String toString(int maxLength)
Returns a string representation of this object, no longer than a given maximum length. The result indicates the object's name, class, shape and value.

Parameters:
maxLength - the maximum number of characters in the returned string
Returns:
a string representation of this object

toString

public String toString()
Returns a string representation of this object no longer than a default maximum length. The result indictes the object's name, class, shape and value.

Overrides:
toString in class Object
Returns:
a string representation of this object

Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved.