Class ValueFactoryQImpl
- java.lang.Object
-
- org.apache.jackrabbit.spi.commons.value.ValueFactoryQImpl
-
- All Implemented Interfaces:
ValueFactory
public class ValueFactoryQImpl extends java.lang.Object implements ValueFactory
This class implements theValueFactory
interface, wrapping an existing SPIQValueFactory
and aNamePathResolver
.- See Also:
ValueFactory
,QValueFactory
-
-
Constructor Summary
Constructors Constructor Description ValueFactoryQImpl(QValueFactory qfactory, NamePathResolver resolver)
Constructs a newValueFactoryQImpl
based on an existing SPIQValueFactory
and aNamePathResolver
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Binary
createBinary(java.io.InputStream stream)
Returns aBinary
object with a value consisting of the content of the specifiedInputStream
.Value
createValue(boolean value)
Value
createValue(double value)
Value
createValue(long value)
Value
createValue(java.io.InputStream value)
Returns aValue
object ofPropertyType.BINARY
with a value consisting of the content of the specifiedInputStream
.Value
createValue(java.lang.String value)
Value
createValue(java.lang.String value, int type)
Value
createValue(java.math.BigDecimal value)
Value
createValue(java.util.Calendar value)
Value
createValue(Binary value)
Returns aValue
object ofPropertyType.BINARY
with a value consisting of the content of the specifiedBinary
.Value
createValue(Node value)
Value
createValue(Node value, boolean weak)
Returns aValue
object ofPropertyType.REFERENCE
(ifweak
isfalse
) orPropertyType.REFERENCE
(ifweak
istrue
) that holds the identifier of the specifiedNode
.Value
createValue(QValue qvalue)
Create a newValue
based on an existingQValue
QValueFactory
getQValueFactory()
TheQValueFactory
that is wrapped by thisValueFactory
instance.
-
-
-
Constructor Detail
-
ValueFactoryQImpl
public ValueFactoryQImpl(QValueFactory qfactory, NamePathResolver resolver)
Constructs a newValueFactoryQImpl
based on an existing SPIQValueFactory
and aNamePathResolver
.- Parameters:
qfactory
- wrappedQValueFactory
resolver
- wrappedNamePathResolver
-
-
Method Detail
-
getQValueFactory
public QValueFactory getQValueFactory()
TheQValueFactory
that is wrapped by thisValueFactory
instance.- Returns:
- qfactory The
QValueFactory
wrapped by this instance.
-
createValue
public Value createValue(QValue qvalue)
Create a newValue
based on an existingQValue
- Parameters:
qvalue
- existingQValue
- Returns:
- a
Value
representing theQValue
-
createValue
public Value createValue(java.lang.String value)
- Specified by:
createValue
in interfaceValueFactory
- Parameters:
value
- aString
- Returns:
- a
Value
ofPropertyType.STRING
-
createValue
public Value createValue(long value)
- Specified by:
createValue
in interfaceValueFactory
- Parameters:
value
- along
- Returns:
- a
Value
ofPropertyType.LONG
-
createValue
public Value createValue(double value)
- Specified by:
createValue
in interfaceValueFactory
- Parameters:
value
- adouble
- Returns:
- a
Value
ofPropertyType.DOUBLE
-
createValue
public Value createValue(boolean value)
- Specified by:
createValue
in interfaceValueFactory
- Parameters:
value
- aboolean
- Returns:
- a
Value
ofPropertyType.BOOLEAN
-
createValue
public Value createValue(java.util.Calendar value)
- Specified by:
createValue
in interfaceValueFactory
- Parameters:
value
- aCalendar
- Returns:
- a
Value
ofPropertyType.DATE
-
createValue
public Value createValue(java.io.InputStream value)
Returns aValue
object ofPropertyType.BINARY
with a value consisting of the content of the specifiedInputStream
.The passed
InputStream
is closed before this method returns either normally or because of an exception.- Specified by:
createValue
in interfaceValueFactory
- Parameters:
value
- anInputStream
- Returns:
- a
Value
ofPropertyType.BINARY
-
createValue
public Value createValue(Node value) throws RepositoryException
Returns aValue
object ofPropertyType.REFERENCE
that holds the identifier of the specifiedNode
. ThisValue
object can then be used to set a property that will be a reference to thatNode
.- Specified by:
createValue
in interfaceValueFactory
- Parameters:
value
- aNode
- Returns:
- a
Value
ofPropertyType.REFERENCE
- Throws:
RepositoryException
- if the specifiedNode
is not referenceable, the currentSession
is no longer active, or another error occurs.
-
createValue
public Value createValue(java.lang.String value, int type) throws ValueFormatException
- Specified by:
createValue
in interfaceValueFactory
- Parameters:
value
- aString
type
- one of the constants defined inPropertyType
.- Returns:
- a
Value
ofPropertyType
type
. - Throws:
ValueFormatException
- if the specifiedvalue
cannot be converted to the specifiedtype
.
-
createBinary
public Binary createBinary(java.io.InputStream stream) throws RepositoryException
Description copied from interface:ValueFactory
Returns aBinary
object with a value consisting of the content of the specifiedInputStream
.The passed
InputStream
is closed before this method returns either normally or because of an exception.- Specified by:
createBinary
in interfaceValueFactory
- Parameters:
stream
- anInputStream
- Returns:
- a
Binary
- Throws:
RepositoryException
- if an error occurs.
-
createValue
public Value createValue(Binary value)
Description copied from interface:ValueFactory
Returns aValue
object ofPropertyType.BINARY
with a value consisting of the content of the specifiedBinary
.- Specified by:
createValue
in interfaceValueFactory
- Parameters:
value
- aBinary
- Returns:
- a
Value
ofPropertyType.BINARY
-
createValue
public Value createValue(java.math.BigDecimal value)
Description copied from interface:ValueFactory
- Specified by:
createValue
in interfaceValueFactory
- Parameters:
value
- adouble
- Returns:
- a
Value
ofPropertyType.DECIMAL
-
createValue
public Value createValue(Node value, boolean weak) throws RepositoryException
Description copied from interface:ValueFactory
Returns aValue
object ofPropertyType.REFERENCE
(ifweak
isfalse
) orPropertyType.REFERENCE
(ifweak
istrue
) that holds the identifier of the specifiedNode
. ThisValue
object can then be used to set a property that will be a reference to thatNode
.- Specified by:
createValue
in interfaceValueFactory
- Parameters:
value
- aNode
weak
- aboolean
. If true then aPropertyType.WEAKREFERENCE
is created, otherwise aPropertyType.REFERENCE
is created.- Returns:
- a
Value
ofPropertyType.REFERENCE
orPropertyType.REFERENCE
- Throws:
RepositoryException
- if the specifiedNode
is not referenceable, the currentSession
is no longer active, or another error occurs.
-
-