Package org.apache.jackrabbit.core.value
Class InternalValue
- java.lang.Object
-
- org.apache.jackrabbit.spi.commons.value.AbstractQValue
-
- org.apache.jackrabbit.core.value.InternalValue
-
- All Implemented Interfaces:
Serializable,QValue
public class InternalValue extends AbstractQValue
InternalValuerepresents the internal format of a property value.The following table specifies the internal format for every property type:
Internal format of property types PropertyType Internal Format STRING String LONG Long DOUBLE Double DATE Calendar BOOLEAN Boolean NAME Name PATH Path URI URI DECIMAL BigDecimal BINARY BLOBFileValue REFERENCE NodeId- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static InternalValue[]EMPTY_ARRAY-
Fields inherited from class org.apache.jackrabbit.spi.commons.value.AbstractQValue
type, val
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static InternalValuecreate(boolean value)static InternalValuecreate(byte[] value)static InternalValuecreate(double value)static InternalValuecreate(long value)static InternalValuecreate(InputStream value)static InternalValuecreate(InputStream value, DataStore store)Create an internal value that is stored in the data store (if enabled).static InternalValuecreate(String value)static InternalValuecreate(BigDecimal value)static InternalValuecreate(URI value)static InternalValuecreate(Calendar value)static InternalValuecreate(Value value, NamePathResolver resolver)Create a new internal value from the given JCR value.static InternalValuecreate(Value value, NamePathResolver resolver, DataStore store)Create a new internal value from the given JCR value.static InternalValuecreate(DataStore store, String id)Create a binary object with the given identifier.static InternalValuecreate(FileSystemResource value)static InternalValuecreate(NodeId value)static InternalValuecreate(NodeId value, boolean weak)static InternalValuecreate(Name value)static InternalValue[]create(Name[] values)static InternalValuecreate(Path value)static InternalValuecreate(QValue value)static InternalValue[]create(QValue[] values)InternalValuecreateCopy()Create a copy of this object.static InternalValuecreateDate(String value)https://issues.apache.org/jira/browse/JCR-3083static InternalValuecreateTemporary(InputStream value)Create an internal value that is backed by a temporary file.voiddeleteBinaryResource()Delete persistent binary objects.voiddiscard()Frees temporarily allocated resources such as temporary file, buffer, etc.booleanequals(Object object)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.CalendargetDate()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().NodeIdgetNodeId()InputStreamgetStream()Returns anInputStreamrepresentation of thisQValueobject.booleanisInDataStore()static InternalValuevalueOf(String s, int type)Parses the given string as anInternalValueof the specified type.-
Methods inherited from class org.apache.jackrabbit.spi.commons.value.AbstractQValue
getBoolean, getCalendar, getDecimal, getDouble, getLong, getName, getPath, getString, getType, getURI, hashCode, toString
-
-
-
-
Field Detail
-
EMPTY_ARRAY
public static final InternalValue[] EMPTY_ARRAY
-
-
Method Detail
-
create
public static InternalValue create(Value value, NamePathResolver resolver) throws ValueFormatException, RepositoryException
Create a new internal value from the given JCR value. Large binary values are stored in a temporary file.- Parameters:
value- the JCR valueresolver-- Returns:
- the created internal value
- Throws:
RepositoryExceptionValueFormatException
-
create
public static InternalValue create(Value value, NamePathResolver resolver, DataStore store) throws ValueFormatException, RepositoryException
Create a new internal value from the given JCR value. If the data store is enabled, large binary values are stored in the data store.- Parameters:
value- the JCR valueresolver-store- the data store- Returns:
- the created internal value
- Throws:
RepositoryExceptionValueFormatException
-
create
public static InternalValue create(QValue value) throws RepositoryException
- Throws:
RepositoryException
-
create
public static InternalValue[] create(QValue[] values) throws RepositoryException
- Throws:
RepositoryException
-
create
public static InternalValue create(String value)
- Parameters:
value-- Returns:
- the created value
-
create
public static InternalValue create(long value)
- Parameters:
value-- Returns:
- the created value
-
create
public static InternalValue create(double value)
- Parameters:
value-- Returns:
- the created value
-
create
public static InternalValue create(Calendar value)
- Parameters:
value-- Returns:
- the created value
-
createDate
public static InternalValue createDate(String value)
https://issues.apache.org/jira/browse/JCR-3083- Parameters:
value-- Returns:
- the created value
-
create
public static InternalValue create(BigDecimal value)
- Parameters:
value-- Returns:
- the created value
-
create
public static InternalValue create(URI value)
- Parameters:
value-- Returns:
- the created value
-
create
public static InternalValue create(boolean value)
- Parameters:
value-- Returns:
- the created value
-
create
public static InternalValue create(byte[] value)
- Parameters:
value-- Returns:
- the created value
-
createTemporary
public static InternalValue createTemporary(InputStream value) throws RepositoryException
Create an internal value that is backed by a temporary file.- Parameters:
value- the stream- Returns:
- the internal value
- Throws:
RepositoryException
-
create
public static InternalValue create(InputStream value, DataStore store) throws RepositoryException
Create an internal value that is stored in the data store (if enabled).- Parameters:
value- the input streamstore-- Returns:
- the internal value
- Throws:
RepositoryException
-
create
public static InternalValue create(InputStream value) throws RepositoryException
- Parameters:
value-- Returns:
- Throws:
RepositoryException
-
create
public static InternalValue create(FileSystemResource value) throws IOException
- Parameters:
value-- Returns:
- Throws:
IOException
-
create
public static InternalValue create(DataStore store, String id)
Create a binary object with the given identifier.- Parameters:
store- the data storeid- the identifier- Returns:
- the value
-
create
public static InternalValue create(Name value)
- Parameters:
value-- Returns:
- the created value
-
create
public static InternalValue[] create(Name[] values)
- Parameters:
values-- Returns:
- the created value
-
create
public static InternalValue create(Path value)
- Parameters:
value-- Returns:
- the created value
-
create
public static InternalValue create(NodeId value)
- Parameters:
value-- Returns:
- the created value
-
create
public static InternalValue create(NodeId value, boolean weak)
- Parameters:
value-weak-- Returns:
- the created value
-
getNodeId
public NodeId getNodeId()
-
getDate
public Calendar getDate() throws RepositoryException
- Throws:
RepositoryException
-
createCopy
public InternalValue createCopy() throws RepositoryException
Create a copy of this object. Immutable values will return itself, while mutable values will return a copy.- Returns:
- itself or a copy
- Throws:
RepositoryException
-
valueOf
public static InternalValue valueOf(String s, int type)
Parses the given string as anInternalValueof the specified type. The string must be in the format returned by theInternalValue.toString()method.- Parameters:
s- aStringcontaining theInternalValuerepresentation to be parsed.type-- Returns:
- the
InternalValuerepresented by the arguments - Throws:
IllegalArgumentException- if the specified string can not be parsed as anInternalValueof the specified type.- See Also:
AbstractQValue.toString()
-
isInDataStore
public boolean isInDataStore()
-
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- Overrides:
getLengthin classAbstractQValue- Returns:
- length of this
QValueobject. - Throws:
RepositoryException- See Also:
QValue.getLength()
-
getStream
public InputStream getStream() throws RepositoryException
Description copied from interface:QValueReturns anInputStreamrepresentation of thisQValueobject. This method always returns a new stream.- Returns:
- A stream representation of this value.
- Throws:
RepositoryException- See Also:
QValue.getStream()
-
getBinary
public Binary getBinary() throws RepositoryException
Description copied from class:AbstractQValueThis 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- Overrides:
getBinaryin classAbstractQValue- 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- Overrides:
discardin classAbstractQValue- See Also:
QValue.discard()
-
deleteBinaryResource
public void deleteBinaryResource()
Delete persistent binary objects. This method does not delete objects in the data store.
-
equals
public boolean equals(Object object)
Description copied from class:AbstractQValueDefault implementation of the equals method. Subclasses may optimize this e.g. by special handling for DATE properties.- Overrides:
equalsin classAbstractQValue- See Also:
Object.equals(Object)
-
-