public class DescribedValue
extends java.lang.Object
Object
) as well as a
ValueInfo
object which provides metadata about that value
(name, class, shape, units and so on).Constructor and Description |
---|
DescribedValue(ValueInfo vinfo)
Constructs a new
DescribedValue object to hold values
described by a given ValueInfo object. |
DescribedValue(ValueInfo vinfo,
java.lang.Object value)
Constructs a new
DescribedValue object to hold values
described by a given ValueInfo object and with a
given initial value. |
Modifier and Type | Method and Description |
---|---|
ValueInfo |
getInfo()
Returns the
ValueInfo object which describes the value
held by this object. |
<T> T |
getTypedValue(java.lang.Class<T> clazz)
Returns the value content of this object as a specified type.
|
java.lang.Object |
getValue()
Returns the actual value content of this object.
|
java.lang.String |
getValueAsString(int maxLength)
Returns a string representation of the value of this object,
no longer than a given maximum length.
|
void |
setValue(java.lang.Object value)
Sets the actual value content of this object.
|
void |
setValueFromString(java.lang.String sval)
Sets the value of this object from a string representation.
|
java.lang.String |
toString()
Returns a string representation of this object no longer than a
default maximum length.
|
java.lang.String |
toString(int maxLength)
Returns a string representation of this object, no longer than a
given maximum length.
|
public DescribedValue(ValueInfo vinfo)
DescribedValue
object to hold values
described by a given ValueInfo
object.vinfo
- the metadata handler for this valuepublic DescribedValue(ValueInfo vinfo, java.lang.Object value)
DescribedValue
object to hold values
described by a given ValueInfo
object and with a
given initial value.vinfo
- the metadata describing this object's valuevalue
- the value of this objectjava.lang.IllegalArgumentException
- if value.getClass()
is not compatible with vinfo.getContentClass()
public ValueInfo getInfo()
ValueInfo
object which describes the value
held by this object.public void setValue(java.lang.Object value)
value
- the valuejava.lang.IllegalArgumentException
- if value.getClass()
is not compatible with
getValueInfo().getContentClass()
public java.lang.Object getValue()
public <T> T getTypedValue(java.lang.Class<T> clazz)
clazz
- required return typepublic java.lang.String getValueAsString(int maxLength)
maxLength
- the maximum number of characters in the returned
stringpublic void setValueFromString(java.lang.String sval)
sval
- string representation of the new valuepublic java.lang.String toString(int maxLength)
maxLength
- the maximum number of characters in the returned
stringpublic java.lang.String toString()
toString
in class java.lang.Object