Class DescribedValue
java.lang.Object
uk.ac.starlink.table.DescribedValue
-
Constructor Summary
ConstructorsConstructorDescriptionDescribedValue(ValueInfo vinfo) Constructs a newDescribedValueobject to hold values described by a givenValueInfoobject.DescribedValue(ValueInfo vinfo, Object value) Constructs a newDescribedValueobject to hold values described by a givenValueInfoobject and with a given initial value. -
Method Summary
Modifier and TypeMethodDescriptiongetInfo()Returns theValueInfoobject which describes the value held by this object.<T> TgetTypedValue(Class<T> clazz) Returns the value content of this object as a specified type.getValue()Returns the actual value content of this object.getValueAsString(int maxLength) Returns a string representation of the value of this object, no longer than a given maximum length.voidSets the actual value content of this object.voidsetValueFromString(String sval) Sets the value of this object from a string representation.toString()Returns a string representation of this object no longer than a default maximum length.toString(int maxLength) Returns a string representation of this object, no longer than a given maximum length.
-
Constructor Details
-
DescribedValue
Constructs a newDescribedValueobject to hold values described by a givenValueInfoobject.- Parameters:
vinfo- the metadata handler for this value
-
DescribedValue
Constructs a newDescribedValueobject to hold values described by a givenValueInfoobject and with a given initial value.- Parameters:
vinfo- the metadata describing this object's valuevalue- the value of this object- Throws:
IllegalArgumentException- ifvalue.getClass()is not compatible withvinfo.getContentClass()
-
-
Method Details
-
getInfo
Returns theValueInfoobject which describes the value held by this object.- Returns:
- the metadata describing this object's value
-
setValue
Sets the actual value content of this object.- Parameters:
value- the value- Throws:
IllegalArgumentException- ifvalue.getClass()is not compatible withgetValueInfo().getContentClass()
-
getValue
-
getTypedValue
Returns the value content of this object as a specified type. If the value is an instance of the supplied class, it is returned; otherwise, null is returned.- Parameters:
clazz- required return type- Returns:
- value as required type, or null
-
getValueAsString
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
Sets the value of this object from a string representation.- Parameters:
sval- string representation of the new value
-
toString
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
-