Package org.apache.jackrabbit.value
Class BaseValue
- java.lang.Object
-
- org.apache.jackrabbit.value.BaseValue
-
- All Implemented Interfaces:
Value
- Direct Known Subclasses:
BinaryValue
,BooleanValue
,DateValue
,DecimalValue
,DoubleValue
,LongValue
,NameValue
,PathValue
,ReferenceValue
,StringValue
,URIValue
,WeakReferenceValue
public abstract class BaseValue extends java.lang.Object implements Value
This class is the superclass of the type-specific classes implementing theValue
interfaces.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Binary
getBinary()
Returns aBinary
representation of this value.boolean
getBoolean()
Returns aBoolean
representation of this value.java.util.Calendar
getDate()
Returns aCalendar
representation of this value.java.math.BigDecimal
getDecimal()
Returns aBigDecimal
representation of this value.double
getDouble()
Returns adouble
representation of this value.long
getLong()
Returns along
representation of this value.java.io.InputStream
getStream()
Returns anInputStream
representation of this value.java.lang.String
getString()
Returns aString
representation of this value.int
getType()
Returns thetype
of thisValue
.
-
-
-
Method Detail
-
getType
public int getType()
Returns thetype
of thisValue
. One of:PropertyType.STRING
PropertyType.DATE
PropertyType.BINARY
PropertyType.DOUBLE
PropertyType.DECIMAL
PropertyType.LONG
PropertyType.BOOLEAN
PropertyType.NAME
PropertyType.PATH
PropertyType.REFERENCE
PropertyType.WEAKREFERENCE
PropertyType.URI
.PropertyType
The type returned is that which was set at property creation.
-
getDate
public java.util.Calendar getDate() throws ValueFormatException, java.lang.IllegalStateException, RepositoryException
Returns aCalendar
representation of this value.The object returned is a copy of the stored value, so changes to it are not reflected in internal storage.
- Specified by:
getDate
in interfaceValue
- Returns:
- A
Calendar
representation of this value. - Throws:
ValueFormatException
- if conversion to aCalendar
is not possible.RepositoryException
- if another error occurs.java.lang.IllegalStateException
-
getLong
public long getLong() throws ValueFormatException, java.lang.IllegalStateException, RepositoryException
Returns along
representation of this value.- Specified by:
getLong
in interfaceValue
- Returns:
- A
long
representation of this value. - Throws:
ValueFormatException
- if conversion to anlong
is not possible.RepositoryException
- if another error occurs.java.lang.IllegalStateException
-
getBoolean
public boolean getBoolean() throws ValueFormatException, java.lang.IllegalStateException, RepositoryException
Returns aBoolean
representation of this value.- Specified by:
getBoolean
in interfaceValue
- Returns:
- A
Boolean
representation of this value. - Throws:
ValueFormatException
- if conversion to aBoolean
is not possible.RepositoryException
- if another error occurs.java.lang.IllegalStateException
-
getDouble
public double getDouble() throws ValueFormatException, java.lang.IllegalStateException, RepositoryException
Returns adouble
representation of this value.- Specified by:
getDouble
in interfaceValue
- Returns:
- A
double
representation of this value. - Throws:
ValueFormatException
- if conversion to adouble
is not possible.RepositoryException
- if another error occurs.java.lang.IllegalStateException
-
getDecimal
public java.math.BigDecimal getDecimal() throws ValueFormatException, java.lang.IllegalStateException, RepositoryException
Returns aBigDecimal
representation of this value.- Specified by:
getDecimal
in interfaceValue
- Returns:
- A
BigDecimal
representation of this value. - Throws:
ValueFormatException
- if conversion to aBigDecimal
is not possible.RepositoryException
- if another error occurs.java.lang.IllegalStateException
-
getStream
public java.io.InputStream getStream() throws java.lang.IllegalStateException, RepositoryException
Returns anInputStream
representation of this value. Uses the standard conversion to binary (see JCR specification).It is the responsibility of the caller to close the returned
InputStream
.- Specified by:
getStream
in interfaceValue
- Returns:
- An
InputStream
representation of this value. - Throws:
RepositoryException
- if an error occurs.java.lang.IllegalStateException
-
getBinary
public Binary getBinary() throws ValueFormatException, java.lang.IllegalStateException, RepositoryException
Returns aBinary
representation of this value. TheBinary
object in turn provides methods to access the binary data itself. Uses the standard conversion to binary (see JCR specification).- Specified by:
getBinary
in interfaceValue
- Returns:
- A
Binary
representation of this value. - Throws:
RepositoryException
- if an error occurs.ValueFormatException
java.lang.IllegalStateException
-
getString
public java.lang.String getString() throws ValueFormatException, java.lang.IllegalStateException, RepositoryException
Returns aString
representation of this value.- Specified by:
getString
in interfaceValue
- Returns:
- A
String
representation of the value of this property. - Throws:
ValueFormatException
- if conversion to aString
is not possible.java.lang.IllegalStateException
- ifgetStream
has previously been called on thisValue
instance. In this case a newValue
instance must be acquired in order to successfully call this method.RepositoryException
- if another error occurs.
-
-