Package javax.jcr
Interface ValueFactory
- All Known Subinterfaces:
JackrabbitValueFactory
- All Known Implementing Classes:
AbstractValueFactory
,SimpleValueFactory
,ValueFactoryImpl
,ValueFactoryImpl
,ValueFactoryQImpl
public interface ValueFactory
The
ValueFactory
object provides methods for the creation Value
objects that can then be used to set properties.-
Method Summary
Modifier and TypeMethodDescriptioncreateBinary
(InputStream stream) Returns aBinary
object with a value consisting of the content of the specifiedInputStream
.createValue
(boolean value) createValue
(double value) createValue
(long value) createValue
(InputStream value) Deprecated.createValue
(String value) createValue
(String value, int type) createValue
(BigDecimal value) createValue
(Calendar value) createValue
(Binary value) Returns aValue
object ofPropertyType.BINARY
with a value consisting of the content of the specifiedBinary
.createValue
(Node value) createValue
(Node value, boolean weak) Returns aValue
object ofPropertyType.REFERENCE
(ifweak
isfalse
) orPropertyType.REFERENCE
(ifweak
istrue
) that holds the identifier of the specifiedNode
.
-
Method Details
-
createValue
- Parameters:
value
- aString
- Returns:
- a
Value
ofPropertyType.STRING
-
createValue
- 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
.
-
createValue
- Parameters:
value
- along
- Returns:
- a
Value
ofPropertyType.LONG
-
createValue
- Parameters:
value
- adouble
- Returns:
- a
Value
ofPropertyType.DOUBLE
-
createValue
- Parameters:
value
- adouble
- Returns:
- a
Value
ofPropertyType.DECIMAL
- Since:
- JCR 2.0
-
createValue
- Parameters:
value
- aboolean
- Returns:
- a
Value
ofPropertyType.BOOLEAN
-
createValue
- Parameters:
value
- aCalendar
- Returns:
- a
Value
ofPropertyType.DATE
- Throws:
IllegalArgumentException
- if the specifiedvalue
cannot be expressed in the ISO 8601-based format defined in the JCR 2.0 specification and the implementation does not support dates incompatible with that format.
-
createValue
Deprecated.As of JCR 2.0,createValue(Binary)
should be used instead.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.- Parameters:
value
- anInputStream
- Returns:
- a
Value
ofPropertyType.BINARY
-
createValue
Returns aValue
object ofPropertyType.BINARY
with a value consisting of the content of the specifiedBinary
.- Parameters:
value
- aBinary
- Returns:
- a
Value
ofPropertyType.BINARY
- Since:
- JCR 2.0
-
createValue
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
.- 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
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
.- 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.
-
createBinary
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.- Parameters:
stream
- anInputStream
- Returns:
- a
Binary
- Throws:
RepositoryException
- if an error occurs.- Since:
- JCR 2.0
-
createValue(Binary)
should be used instead.