Class AbstractQValue
- java.lang.Object
-
- org.apache.jackrabbit.spi.commons.value.AbstractQValue
-
- All Implemented Interfaces:
Serializable
,QValue
- Direct Known Subclasses:
DefaultQValue
,InternalValue
public abstract class AbstractQValue extends Object implements QValue, Serializable
AbstractQValue
...- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
type
protected Object
val
-
Fields inherited from interface org.apache.jackrabbit.spi.QValue
EMPTY_ARRAY
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractQValue(Boolean value)
Create a newAbstractQValue
.protected
AbstractQValue(Double value)
Create a newAbstractQValue
.protected
AbstractQValue(Long value)
Create a newAbstractQValue
.protected
AbstractQValue(Object value, int type)
Create a newAbstractQValue
.protected
AbstractQValue(String value, int type)
Create a newAbstractQValue
.protected
AbstractQValue(BigDecimal value)
Create a newAbstractQValue
.protected
AbstractQValue(URI value)
Create a newAbstractQValue
.protected
AbstractQValue(Calendar value)
Create a newAbstractQValue
.protected
AbstractQValue(Name value)
Create a newAbstractQValue
.protected
AbstractQValue(Path value)
Create a newAbstractQValue
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
discard()
Frees temporarily allocated resources such as temporary file, buffer, etc.boolean
equals(Object obj)
Default implementation of the equals method.Binary
getBinary()
This implementation creates a binary instance that usesQValue.getStream()
and skipping on the given stream as its underlying mechanism to provide random access defined onBinary
.boolean
getBoolean()
Returns aboolean
representation of this value.Calendar
getCalendar()
Returns aCalendar
representation of this value.BigDecimal
getDecimal()
Returns aBigDecimal
representation of this value.double
getDouble()
Returns adouble
representation of this value.long
getLength()
Returns the length of the internal value or -1 if the implementation cannot determine the length at this time.
NOTE: forPropertyType.NAME
andPropertyType.PATH
the length of the internal value must not be used for indicating the length of a property such as retrieved by callingProperty.getLength()
andProperty.getLengths()
.long
getLong()
Returns along
representation of this value.Name
getName()
Returns aName
representation of this value.Path
getPath()
Returns aPath
representation of this value.String
getString()
Returns aString
representation of thisQValue
object.int
getType()
Returns thePropertyType
of thisQValue
object.URI
getURI()
Returns anURI
representation of this value.int
hashCode()
Default calculation of the hashCode.String
toString()
Returns the string representation of this internal value.
-
-
-
Field Detail
-
val
protected final Object val
-
type
protected final int type
-
-
Constructor Detail
-
AbstractQValue
protected AbstractQValue(Object value, int type)
Create a newAbstractQValue
.- Parameters:
value
- The value.type
- The property type.- Throws:
IllegalArgumentException
- if the passedvalue
isnull
.
-
AbstractQValue
protected AbstractQValue(String value, int type)
Create a newAbstractQValue
.- Parameters:
value
-type
-- Throws:
IllegalArgumentException
- if the passedvalue
isnull
or if thetype
is neither STRING nor REFERENCE/WEAKREFERENCE.
-
AbstractQValue
protected AbstractQValue(Long value)
Create a newAbstractQValue
.- Parameters:
value
-- Throws:
IllegalArgumentException
- if the passedvalue
isnull
.
-
AbstractQValue
protected AbstractQValue(Double value)
Create a newAbstractQValue
.- Parameters:
value
-- Throws:
IllegalArgumentException
- if the passedvalue
isnull
.
-
AbstractQValue
protected AbstractQValue(Boolean value)
Create a newAbstractQValue
.- Parameters:
value
-- Throws:
IllegalArgumentException
- if the passedvalue
isnull
.
-
AbstractQValue
protected AbstractQValue(Calendar value)
Create a newAbstractQValue
.- Parameters:
value
-- Throws:
IllegalArgumentException
- if the passedvalue
isnull
.
-
AbstractQValue
protected AbstractQValue(Name value)
Create a newAbstractQValue
.- Parameters:
value
-- Throws:
IllegalArgumentException
- if the passedvalue
isnull
.
-
AbstractQValue
protected AbstractQValue(Path value)
Create a newAbstractQValue
.- Parameters:
value
-- Throws:
IllegalArgumentException
- if the passedvalue
isnull
.
-
AbstractQValue
protected AbstractQValue(BigDecimal value)
Create a newAbstractQValue
.- Parameters:
value
-- Throws:
IllegalArgumentException
- if the passedvalue
isnull
.
-
AbstractQValue
protected AbstractQValue(URI value)
Create a newAbstractQValue
.- Parameters:
value
-- Throws:
IllegalArgumentException
- if the passedvalue
isnull
.
-
-
Method Detail
-
getType
public int getType()
Description copied from interface:QValue
Returns thePropertyType
of thisQValue
object. It may be either of the value property types defined by the JSR 283:- Specified by:
getType
in interfaceQValue
- Returns:
- the
PropertyType
of thisQValue
object. - See Also:
QValue.getType()
-
getLength
public long getLength() throws RepositoryException
Description copied from interface:QValue
Returns the length of the internal value or -1 if the implementation cannot determine the length at this time.
NOTE: forPropertyType.NAME
andPropertyType.PATH
the length of the internal value must not be used for indicating the length of a property such as retrieved by callingProperty.getLength()
andProperty.getLengths()
.- Specified by:
getLength
in interfaceQValue
- Returns:
- length of this
QValue
object. - Throws:
RepositoryException
- See Also:
QValue.getLength()
-
getName
public Name getName() throws RepositoryException
Description copied from interface:QValue
Returns aName
representation of this value.- Specified by:
getName
in interfaceQValue
- Returns:
- A
Name
representation of this value. - Throws:
RepositoryException
- if an error occurs.- See Also:
QValue.getName()
-
getCalendar
public Calendar getCalendar() throws RepositoryException
Description copied from interface:QValue
Returns aCalendar
representation of this value.- Specified by:
getCalendar
in interfaceQValue
- Returns:
- A
Calendar
representation of this value. - Throws:
RepositoryException
- if an error occurs.- See Also:
QValue.getCalendar()
-
getDecimal
public BigDecimal getDecimal() throws RepositoryException
Description copied from interface:QValue
Returns aBigDecimal
representation of this value.- Specified by:
getDecimal
in interfaceQValue
- Returns:
- A
BigDecimal
representation of this value. - Throws:
RepositoryException
- if an error occurs.- See Also:
QValue.getDecimal()
-
getURI
public URI getURI() throws RepositoryException
Description copied from interface:QValue
Returns anURI
representation of this value.- Specified by:
getURI
in interfaceQValue
- Returns:
- A
URI
representation of this value. - Throws:
RepositoryException
- if an error occurs.- See Also:
QValue.getURI()
-
getDouble
public double getDouble() throws RepositoryException
Description copied from interface:QValue
Returns adouble
representation of this value.- Specified by:
getDouble
in interfaceQValue
- Returns:
- A
double
representation of this value. - Throws:
RepositoryException
- if an error occurs.- See Also:
QValue.getDouble()
-
getLong
public long getLong() throws RepositoryException
Description copied from interface:QValue
Returns along
representation of this value.- Specified by:
getLong
in interfaceQValue
- Returns:
- A
long
representation of this value. - Throws:
RepositoryException
- if an error occurs.- See Also:
QValue.getLong()
-
getBoolean
public boolean getBoolean() throws RepositoryException
Description copied from interface:QValue
Returns aboolean
representation of this value.- Specified by:
getBoolean
in interfaceQValue
- Returns:
- A
boolean
representation of this value. - Throws:
RepositoryException
- See Also:
QValue.getBoolean()
-
getPath
public Path getPath() throws RepositoryException
Description copied from interface:QValue
Returns aPath
representation of this value.- Specified by:
getPath
in interfaceQValue
- Returns:
- A
Path
representation of this value. - Throws:
RepositoryException
- if an error occurs.- See Also:
QValue.getPath()
-
getString
public String getString() throws RepositoryException
Description copied from interface:QValue
Returns aString
representation of thisQValue
object.- Specified by:
getString
in interfaceQValue
- Returns:
- A
String
representation of thisQValue
object. - Throws:
RepositoryException
- See Also:
QValue.getPath()
-
getBinary
public Binary getBinary() throws RepositoryException
This implementation creates a binary instance that usesQValue.getStream()
and skipping on the given stream as its underlying mechanism to provide random access defined onBinary
.- Specified by:
getBinary
in interfaceQValue
- Returns:
- A
Binary
representation of this value. - Throws:
RepositoryException
- See Also:
QValue.getBinary()
-
discard
public void discard()
Description copied from interface:QValue
Frees temporarily allocated resources such as temporary file, buffer, etc.- Specified by:
discard
in interfaceQValue
- See Also:
QValue.discard()
-
toString
public String toString()
Returns the string representation of this internal value.
-
equals
public boolean equals(Object obj)
Default implementation of the equals method. Subclasses may optimize this e.g. by special handling for DATE properties.- Overrides:
equals
in classObject
- Parameters:
obj
-- See Also:
Object.equals(Object)
-
hashCode
public int hashCode()
Default calculation of the hashCode. Subclasses may optimize this e.g. by special handling for DATE properties.- Overrides:
hashCode
in classObject
- Returns:
- the hashCode of the internal value object.
- See Also:
Object.hashCode()
-
-