org.priha.providers
Class ValueContainer
java.lang.Object
org.priha.providers.ValueContainer
public class ValueContainer
- extends java.lang.Object
Stores a Value with its type. This is what a PropertyImpl stores internally,
and this is what gets passed down to a RepositoryProvider. Most noticeably
the difference is that the Value that a ValueContainer contains is NOT cloned
when you do a getValue(). Therefore, if you getValue() and read its contents
with getStream(), you cannot read it again until you clone the ValueContainer.
Ditto, if you read it with getString() or one of the other scalar values, you
cannot use getStream() anymore.
To work around this problem, use the sessionInstance() and deepClone() methods,
which will return you a new ValueContainer - or use ValueFactory.cloneValues().
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
UNDEFINED_CONTAINER
public static final ValueContainer UNDEFINED_CONTAINER
ValueContainer
public ValueContainer(ValueImpl v)
ValueContainer
public ValueContainer(ValueImpl[] v,
int type)
ValueContainer
public ValueContainer(javax.jcr.Value[] values,
int propertyType)
getType
public int getType()
getValue
public ValueImpl getValue()
throws javax.jcr.ValueFormatException
- Throws:
javax.jcr.ValueFormatException
getValues
public ValueImpl[] getValues()
throws javax.jcr.ValueFormatException
- Throws:
javax.jcr.ValueFormatException
isMultiple
public boolean isMultiple()
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
sessionInstance
public ValueContainer sessionInstance(SessionImpl session)
throws javax.jcr.ValueFormatException
- Returns a new ValueContainer which has mappings to the given Session.
- Parameters:
session
-
- Returns:
-
- Throws:
javax.jcr.ValueFormatException
deepClone
public ValueContainer deepClone(SessionImpl session)
throws javax.jcr.ValueFormatException,
java.lang.IllegalStateException,
javax.jcr.UnsupportedRepositoryOperationException,
javax.jcr.RepositoryException
- Cloning of a ValueContainer is a deep operation, i.e. you will get all new Value instances.
This is because the Values might be consumed already, esp. if they are streams.
- Throws:
javax.jcr.RepositoryException
javax.jcr.UnsupportedRepositoryOperationException
java.lang.IllegalStateException
javax.jcr.ValueFormatException
isEmpty
public boolean isEmpty()