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
InternalValue
represents 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 InternalValue
create(boolean value)
static InternalValue
create(byte[] value)
static InternalValue
create(double value)
static InternalValue
create(long value)
static InternalValue
create(InputStream value)
static InternalValue
create(InputStream value, DataStore store)
Create an internal value that is stored in the data store (if enabled).static InternalValue
create(String value)
static InternalValue
create(BigDecimal value)
static InternalValue
create(URI value)
static InternalValue
create(Calendar value)
static InternalValue
create(Value value, NamePathResolver resolver)
Create a new internal value from the given JCR value.static InternalValue
create(Value value, NamePathResolver resolver, DataStore store)
Create a new internal value from the given JCR value.static InternalValue
create(DataStore store, String id)
Create a binary object with the given identifier.static InternalValue
create(FileSystemResource value)
static InternalValue
create(NodeId value)
static InternalValue
create(NodeId value, boolean weak)
static InternalValue
create(Name value)
static InternalValue[]
create(Name[] values)
static InternalValue
create(Path value)
static InternalValue
create(QValue value)
static InternalValue[]
create(QValue[] values)
InternalValue
createCopy()
Create a copy of this object.static InternalValue
createDate(String value)
https://issues.apache.org/jira/browse/JCR-3083static InternalValue
createTemporary(InputStream value)
Create an internal value that is backed by a temporary file.void
deleteBinaryResource()
Delete persistent binary objects.void
discard()
Frees temporarily allocated resources such as temporary file, buffer, etc.boolean
equals(Object object)
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
.Calendar
getDate()
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()
.NodeId
getNodeId()
InputStream
getStream()
Returns anInputStream
representation of thisQValue
object.boolean
isInDataStore()
static InternalValue
valueOf(String s, int type)
Parses the given string as anInternalValue
of 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:
RepositoryException
ValueFormatException
-
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:
RepositoryException
ValueFormatException
-
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 anInternalValue
of the specified type. The string must be in the format returned by theInternalValue.toString()
method.- Parameters:
s
- aString
containing theInternalValue
representation to be parsed.type
-- Returns:
- the
InternalValue
represented by the arguments - Throws:
IllegalArgumentException
- if the specified string can not be parsed as anInternalValue
of the specified type.- See Also:
AbstractQValue.toString()
-
isInDataStore
public boolean isInDataStore()
-
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
- Overrides:
getLength
in classAbstractQValue
- Returns:
- length of this
QValue
object. - Throws:
RepositoryException
- See Also:
QValue.getLength()
-
getStream
public InputStream getStream() throws RepositoryException
Description copied from interface:QValue
Returns anInputStream
representation of thisQValue
object. 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:AbstractQValue
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
- Overrides:
getBinary
in classAbstractQValue
- 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
- Overrides:
discard
in 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:AbstractQValue
Default implementation of the equals method. Subclasses may optimize this e.g. by special handling for DATE properties.- Overrides:
equals
in classAbstractQValue
- See Also:
Object.equals(Object)
-
-