Value object can be used without knowing the actual
* property type (STRING
, DOUBLE
, BINARY
etc.).
*
* Any implementation of this interface must match the behavior of the JCR-supplied classes ({@link BaseValue} and its * subclasses) in the following respects: *
Value
object returned by Property.getValue()
can be read using type-specific
* get
methods. These methods are divided into two groups:
* get
methods getString()
, getDate()
,
* getLong()
, getDouble()
and getBoolean()
.
* getStream()
.
* 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 {@link Property#getValue()} or {@link Property#getValues()}.
* 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.
* 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.
* Value
instances, v1
and v2
, are considered equal if and only if:
* v1.getType() == v2.getType()
, and,v1.getString().equals(v2.getString())
Value
instances by converting them to
* string form may not be practical in some cases (for example, if the values are very large
* binaries). Consequently, the above is intended as a normative definition of Value
equality
* but not as a procedural test of equality. It is assumed that implementations will have efficient means
* of determining equality that conform with the above definition.
*
* @author Markus Nix 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.
*
* @return A String
representation of the value of this property.
* @throws ValueFormatException if conversion to a String
is not possible.
* @throws IllegalStateException if getStream
has previously
* been called on this Value
instance.
* @throws RepositoryException if another error occurs.
*/
public function getString();
/**
* Returns an InputStream
representation of this value.
* USes the standard conversion to binary (see JCR specification)
* If this value cannot be converted to a stream, a
* ValueFormatException
is thrown.
*
* 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.
*
* @return An InputStream
representation of this value.
* @throws ValueFormatException if conversion to an InputStream
is not possible.
* @throws IllegalStateException if a non-stream get
method has previously
* been called on this Value
instance.
* @throws RepositoryException if another error occurs.
*/
public function getStream();
/**
* 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.
*
* @return A long
representation of this value.
* @throws ValueFormatException if conversion to a long
is not possible.
* @throws IllegalStateException if getStream
has previously
* been called on this Value
instance.
* @throws RepositoryException if another error occurs.
*/
public function getLong();
/**
* 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.
*
* @return A double
representation of this value.
* @throws ValueFormatException if conversion to a double
is not possible.
* @throws IllegalStateException if getStream
has previously
* been called on this Value
instance.
* @throws RepositoryException if another error occurs.
*/
public function getDouble();
/**
* Returns date representation of this value.
*
* 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.
*
* @return date
* @throws ValueFormatException if conversion to a Calendar
is not possible.
* @throws IllegalStateException if getStream
has previously
* been called on this Value
instance.
* @throws RepositoryException if another error occurs.
*/
public function getDate();
/**
* 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.
*
* @return A Boolean
representation of this value.
* @throws ValueFormatException if conversion to a Boolean
is not possible.
* @throws IllegalStateException if getStream
has previously
* been called on this Value
instance.
* @throws RepositoryException if another error occurs.
*/
public function getBoolean();
/**
* Returns the type
of this Value
.
* One of:
*
PropertyType::STRING
PropertyType::DATE
PropertyType::BINARY
PropertyType::DOUBLE
PropertyType::LONG
PropertyType::BOOLEAN
PropertyType::NAME
PropertyType::PATH
PropertyType::REFERENCE
{@link PropertyType}
.
* * The type returned is that which was set at property creation. */ public function getType(); } ?>