The Value interface represents the value of a property. The methods of the Value interface are:
javax.jcr. |
|
String |
getString() Returns a String representation of this value. If this value cannot be converted to a String, a ValueFormatException is thrown. If getStream has previously been called on this Value instance, an IllegalStateException is thrown. In this case, a new Value instance must be acquired in order to successfully call getString. A RepositoryException is thrown if another error occurs. |
InputStream |
getStream() Returns an InputStream representation of this value. Uses the standard conversion to binary. If a non-stream get method has previously been called on this Value instance, an IllegalStateException is thrown. In this case, a new Value instance must be acquired in order to successfully call getStream. A RepositoryException is thrown if another error occurs. |
long |
getLong() Returns a long representation of this value. If this value cannot be converted to a long, a ValueFormatException is thrown. If getStream has previously been called on this Value instance, an IllegalStateException is thrown. In this case a new Value instance must be acquired in order to successfully call getLong. A RepositoryException is thrown if another error occurs. |
double |
getDouble() Returns a double representation of this value. If this value cannot be converted to a double, a ValueFormatException is thrown. If getStream has previously been called on this Value instance, an IllegalStateException is thrown. In this case a new Value instance must be acquired in order to successfully call getDouble. A RepositoryException is thrown if another error occurs. |
Calendar |
getDate() Returns a Calendar representation of this value. The object returned is a copy of the stored value, so changes to it are not reflected in internal storage. If this value cannot be converted to a Calendar, a ValueFormatException is thrown. If getStream has previously been called on this Value instance, an IllegalStateException is thrown. In this case a new Value instance must be acquired in order to successfully call getDate. A RepositoryException is thrown if another error occurs. |
boolean |
getBoolean() Returns a boolean representation of this value. If this value cannot be converted to a boolean, a ValueFormatException is thrown. If getStream has previously been called on this Value instance, an IllegalStateException is thrown. In this case a new Value instance must be acquired in order to successfully call getBoolean. A RepositoryException is thrown if another error occurs. |
int |
getType() Returns the type of this value. See 6.2.5 Property Types. The type returned is that which was set at property creation. |
Implementations of Value must observe the following behavioral restrictions:
A Value object can be read using type-specific get methods. These methods are divided into two groups:
The non-stream get methods getString(), getDate(), getLong(), getDouble() and getBoolean().
getStream().
Once a Value object has been read once using getStream(), all subsequent calls to getStream() will return the same stream object. This may mean, for example, that the stream returned is fully or partially consumed. In order to get a fresh stream the Value object must be reacquired via Property.getValue().
Once a Value object has been read once using getStream(), any subsequent call to any of the non-stream get methods will throw an IllegalStateException. In order to successfully invoke a non-stream get method the Value must be reacquired via Property.getValue().
Once a Value object has been read once using a non-stream get method, any subsequent call to getStream() will throw an IllegalStateException. In order to successfully invoke getStream() the Value must be reacquired via Property.getValue().