6.2.7 Value

The Value interface represents the value of a property. The methods of the Value interface are:

javax.jcr.
Value

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: