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 inttypeprotected Objectval-
Fields inherited from interface org.apache.jackrabbit.spi.QValue
EMPTY_ARRAY
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractQValue(Boolean value)Create a newAbstractQValue.protectedAbstractQValue(Double value)Create a newAbstractQValue.protectedAbstractQValue(Long value)Create a newAbstractQValue.protectedAbstractQValue(Object value, int type)Create a newAbstractQValue.protectedAbstractQValue(String value, int type)Create a newAbstractQValue.protectedAbstractQValue(BigDecimal value)Create a newAbstractQValue.protectedAbstractQValue(URI value)Create a newAbstractQValue.protectedAbstractQValue(Calendar value)Create a newAbstractQValue.protectedAbstractQValue(Name value)Create a newAbstractQValue.protectedAbstractQValue(Path value)Create a newAbstractQValue.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddiscard()Frees temporarily allocated resources such as temporary file, buffer, etc.booleanequals(Object obj)Default implementation of the equals method.BinarygetBinary()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.booleangetBoolean()Returns abooleanrepresentation of this value.CalendargetCalendar()Returns aCalendarrepresentation of this value.BigDecimalgetDecimal()Returns aBigDecimalrepresentation of this value.doublegetDouble()Returns adoublerepresentation of this value.longgetLength()Returns the length of the internal value or -1 if the implementation cannot determine the length at this time.
NOTE: forPropertyType.NAMEandPropertyType.PATHthe length of the internal value must not be used for indicating the length of a property such as retrieved by callingProperty.getLength()andProperty.getLengths().longgetLong()Returns alongrepresentation of this value.NamegetName()Returns aNamerepresentation of this value.PathgetPath()Returns aPathrepresentation of this value.StringgetString()Returns aStringrepresentation of thisQValueobject.intgetType()Returns thePropertyTypeof thisQValueobject.URIgetURI()Returns anURIrepresentation of this value.inthashCode()Default calculation of the hashCode.StringtoString()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 passedvalueisnull.
-
AbstractQValue
protected AbstractQValue(String value, int type)
Create a newAbstractQValue.- Parameters:
value-type-- Throws:
IllegalArgumentException- if the passedvalueisnullor if thetypeis neither STRING nor REFERENCE/WEAKREFERENCE.
-
AbstractQValue
protected AbstractQValue(Long value)
Create a newAbstractQValue.- Parameters:
value-- Throws:
IllegalArgumentException- if the passedvalueisnull.
-
AbstractQValue
protected AbstractQValue(Double value)
Create a newAbstractQValue.- Parameters:
value-- Throws:
IllegalArgumentException- if the passedvalueisnull.
-
AbstractQValue
protected AbstractQValue(Boolean value)
Create a newAbstractQValue.- Parameters:
value-- Throws:
IllegalArgumentException- if the passedvalueisnull.
-
AbstractQValue
protected AbstractQValue(Calendar value)
Create a newAbstractQValue.- Parameters:
value-- Throws:
IllegalArgumentException- if the passedvalueisnull.
-
AbstractQValue
protected AbstractQValue(Name value)
Create a newAbstractQValue.- Parameters:
value-- Throws:
IllegalArgumentException- if the passedvalueisnull.
-
AbstractQValue
protected AbstractQValue(Path value)
Create a newAbstractQValue.- Parameters:
value-- Throws:
IllegalArgumentException- if the passedvalueisnull.
-
AbstractQValue
protected AbstractQValue(BigDecimal value)
Create a newAbstractQValue.- Parameters:
value-- Throws:
IllegalArgumentException- if the passedvalueisnull.
-
AbstractQValue
protected AbstractQValue(URI value)
Create a newAbstractQValue.- Parameters:
value-- Throws:
IllegalArgumentException- if the passedvalueisnull.
-
-
Method Detail
-
getType
public int getType()
Description copied from interface:QValueReturns thePropertyTypeof thisQValueobject. It may be either of the value property types defined by the JSR 283:- Specified by:
getTypein interfaceQValue- Returns:
- the
PropertyTypeof thisQValueobject. - See Also:
QValue.getType()
-
getLength
public long getLength() throws RepositoryExceptionDescription copied from interface:QValueReturns the length of the internal value or -1 if the implementation cannot determine the length at this time.
NOTE: forPropertyType.NAMEandPropertyType.PATHthe 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:
getLengthin interfaceQValue- Returns:
- length of this
QValueobject. - Throws:
RepositoryException- See Also:
QValue.getLength()
-
getName
public Name getName() throws RepositoryException
Description copied from interface:QValueReturns aNamerepresentation of this value.- Specified by:
getNamein interfaceQValue- Returns:
- A
Namerepresentation of this value. - Throws:
RepositoryException- if an error occurs.- See Also:
QValue.getName()
-
getCalendar
public Calendar getCalendar() throws RepositoryException
Description copied from interface:QValueReturns aCalendarrepresentation of this value.- Specified by:
getCalendarin interfaceQValue- Returns:
- A
Calendarrepresentation of this value. - Throws:
RepositoryException- if an error occurs.- See Also:
QValue.getCalendar()
-
getDecimal
public BigDecimal getDecimal() throws RepositoryException
Description copied from interface:QValueReturns aBigDecimalrepresentation of this value.- Specified by:
getDecimalin interfaceQValue- Returns:
- A
BigDecimalrepresentation of this value. - Throws:
RepositoryException- if an error occurs.- See Also:
QValue.getDecimal()
-
getURI
public URI getURI() throws RepositoryException
Description copied from interface:QValueReturns anURIrepresentation of this value.- Specified by:
getURIin interfaceQValue- Returns:
- A
URIrepresentation of this value. - Throws:
RepositoryException- if an error occurs.- See Also:
QValue.getURI()
-
getDouble
public double getDouble() throws RepositoryExceptionDescription copied from interface:QValueReturns adoublerepresentation of this value.- Specified by:
getDoublein interfaceQValue- Returns:
- A
doublerepresentation of this value. - Throws:
RepositoryException- if an error occurs.- See Also:
QValue.getDouble()
-
getLong
public long getLong() throws RepositoryExceptionDescription copied from interface:QValueReturns alongrepresentation of this value.- Specified by:
getLongin interfaceQValue- Returns:
- A
longrepresentation of this value. - Throws:
RepositoryException- if an error occurs.- See Also:
QValue.getLong()
-
getBoolean
public boolean getBoolean() throws RepositoryExceptionDescription copied from interface:QValueReturns abooleanrepresentation of this value.- Specified by:
getBooleanin interfaceQValue- Returns:
- A
booleanrepresentation of this value. - Throws:
RepositoryException- See Also:
QValue.getBoolean()
-
getPath
public Path getPath() throws RepositoryException
Description copied from interface:QValueReturns aPathrepresentation of this value.- Specified by:
getPathin interfaceQValue- Returns:
- A
Pathrepresentation of this value. - Throws:
RepositoryException- if an error occurs.- See Also:
QValue.getPath()
-
getString
public String getString() throws RepositoryException
Description copied from interface:QValueReturns aStringrepresentation of thisQValueobject.- Specified by:
getStringin interfaceQValue- Returns:
- A
Stringrepresentation of thisQValueobject. - 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:
getBinaryin interfaceQValue- Returns:
- A
Binaryrepresentation of this value. - Throws:
RepositoryException- See Also:
QValue.getBinary()
-
discard
public void discard()
Description copied from interface:QValueFrees temporarily allocated resources such as temporary file, buffer, etc.- Specified by:
discardin 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:
equalsin 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:
hashCodein classObject- Returns:
- the hashCode of the internal value object.
- See Also:
Object.hashCode()
-
-