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
This class is the superclass of the type-specific
classes implementing the
Value interfaces.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionReturns aBinaryrepresentation of this value.booleanReturns aBooleanrepresentation of this value.getDate()Returns aCalendarrepresentation of this value.Returns aBigDecimalrepresentation of this value.doubleReturns adoublerepresentation of this value.longgetLong()Returns alongrepresentation of this value.Returns anInputStreamrepresentation of this value.Returns aStringrepresentation of this value.intgetType()Returns thetypeof thisValue.
-
Method Details
-
getType
public int getType()Returns thetypeof thisValue. One of:PropertyType.STRINGPropertyType.DATEPropertyType.BINARYPropertyType.DOUBLEPropertyType.DECIMALPropertyType.LONGPropertyType.BOOLEANPropertyType.NAMEPropertyType.PATHPropertyType.REFERENCEPropertyType.WEAKREFERENCEPropertyType.URI
.PropertyTypeThe type returned is that which was set at property creation.
-
getDate
Returns aCalendarrepresentation 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:
getDatein interfaceValue- Returns:
- A
Calendarrepresentation of this value. - Throws:
ValueFormatException- if conversion to aCalendaris not possible.RepositoryException- if another error occurs.IllegalStateException
-
getLong
Returns alongrepresentation of this value.- Specified by:
getLongin interfaceValue- Returns:
- A
longrepresentation of this value. - Throws:
ValueFormatException- if conversion to anlongis not possible.RepositoryException- if another error occurs.IllegalStateException
-
getBoolean
Returns aBooleanrepresentation of this value.- Specified by:
getBooleanin interfaceValue- Returns:
- A
Booleanrepresentation of this value. - Throws:
ValueFormatException- if conversion to aBooleanis not possible.RepositoryException- if another error occurs.IllegalStateException
-
getDouble
Returns adoublerepresentation of this value.- Specified by:
getDoublein interfaceValue- Returns:
- A
doublerepresentation of this value. - Throws:
ValueFormatException- if conversion to adoubleis not possible.RepositoryException- if another error occurs.IllegalStateException
-
getDecimal
public BigDecimal getDecimal() throws ValueFormatException, IllegalStateException, RepositoryExceptionReturns aBigDecimalrepresentation of this value.- Specified by:
getDecimalin interfaceValue- Returns:
- A
BigDecimalrepresentation of this value. - Throws:
ValueFormatException- if conversion to aBigDecimalis not possible.RepositoryException- if another error occurs.IllegalStateException
-
getStream
Returns anInputStreamrepresentation 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:
getStreamin interfaceValue- Returns:
- An
InputStreamrepresentation of this value. - Throws:
RepositoryException- if an error occurs.IllegalStateException
-
getBinary
Returns aBinaryrepresentation of this value. TheBinaryobject in turn provides methods to access the binary data itself. Uses the standard conversion to binary (see JCR specification).- Specified by:
getBinaryin interfaceValue- Returns:
- A
Binaryrepresentation of this value. - Throws:
RepositoryException- if an error occurs.ValueFormatExceptionIllegalStateException
-
getString
Returns aStringrepresentation of this value.- Specified by:
getStringin interfaceValue- Returns:
- A
Stringrepresentation of the value of this property. - Throws:
ValueFormatException- if conversion to aStringis not possible.IllegalStateException- ifgetStreamhas previously been called on thisValueinstance. In this case a newValueinstance must be acquired in order to successfully call this method.RepositoryException- if another error occurs.
-