javax.jcr
Interface ValueFactory


public interface ValueFactory

The ValueFactory object provides methods for the creation Value objects that can then be used to set properties.


Method Summary
 Binary createBinary(java.io.InputStream stream)
          Returns a Binary object with a value consisting of the content of the specified InputStream.
 Value createValue(java.math.BigDecimal value)
          Returns a Value object of PropertyType.DECIMAL with the specified value.
 Value createValue(Binary value)
          Returns a Value object of PropertyType.BINARY with a value consisting of the content of the specified Binary.
 Value createValue(boolean value)
          Returns a Value object of PropertyType.BOOLEAN with the specified value.
 Value createValue(java.util.Calendar value)
          Returns a Value object of PropertyType.DATE with the specified value.
 Value createValue(double value)
          Returns a Value object of PropertyType.DOUBLE with the specified value.
 Value createValue(java.io.InputStream value)
          Deprecated. As of JCR 2.0, createValue(Binary) should be used instead.
 Value createValue(long value)
          Returns a Value object of PropertyType.LONG with the specified value.
 Value createValue(Node value)
          Returns a Value object of PropertyType.REFERENCE that holds the identifier of the specified Node.
 Value createValue(Node value, boolean weak)
          Returns a Value object of PropertyType.REFERENCE (if weak is false) or PropertyType.REFERENCE (if weak is true) that holds the identifier of the specified Node.
 Value createValue(java.lang.String value)
          Returns a Value object of PropertyType.STRING with the specified value.
 Value createValue(java.lang.String value, int type)
          Returns a Value object of the PropertyType specified by type with the specified value.
 

Method Detail

createValue

Value createValue(java.lang.String value)
Returns a Value object of PropertyType.STRING with the specified value.

Parameters:
value - a String
Returns:
a Value of PropertyType.STRING

createValue

Value createValue(java.lang.String value,
                  int type)
                  throws ValueFormatException
Returns a Value object of the PropertyType specified by type with the specified value.

Parameters:
value - a String
type - one of the constants defined in PropertyType.
Returns:
a Value of PropertyType type.
Throws:
ValueFormatException - if the specified value cannot be converted to the specified type.

createValue

Value createValue(long value)
Returns a Value object of PropertyType.LONG with the specified value.

Parameters:
value - a long
Returns:
a Value of PropertyType.LONG

createValue

Value createValue(double value)
Returns a Value object of PropertyType.DOUBLE with the specified value.

Parameters:
value - a double
Returns:
a Value of PropertyType.DOUBLE

createValue

Value createValue(java.math.BigDecimal value)
Returns a Value object of PropertyType.DECIMAL with the specified value.

Parameters:
value - a double
Returns:
a Value of PropertyType.DECIMAL
Since:
JCR 2.0

createValue

Value createValue(boolean value)
Returns a Value object of PropertyType.BOOLEAN with the specified value.

Parameters:
value - a boolean
Returns:
a Value of PropertyType.BOOLEAN

createValue

Value createValue(java.util.Calendar value)
Returns a Value object of PropertyType.DATE with the specified value.

Parameters:
value - a Calendar
Returns:
a Value of PropertyType.DATE
Throws:
java.lang.IllegalArgumentException - if the specified value 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

Value createValue(java.io.InputStream value)
Deprecated. As of JCR 2.0, createValue(Binary) should be used instead.

Returns a Value object of PropertyType.BINARY with a value consisting of the content of the specified InputStream.

The passed InputStream is closed before this method returns either normally or because of an exception.

Parameters:
value - an InputStream
Returns:
a Value of PropertyType.BINARY

createValue

Value createValue(Binary value)
Returns a Value object of PropertyType.BINARY with a value consisting of the content of the specified Binary.

Parameters:
value - a Binary
Returns:
a Value of PropertyType.BINARY
Since:
JCR 2.0

createValue

Value createValue(Node value)
                  throws RepositoryException
Returns a Value object of PropertyType.REFERENCE that holds the identifier of the specified Node. This Value object can then be used to set a property that will be a reference to that Node.

Parameters:
value - a Node
Returns:
a Value of PropertyType.REFERENCE
Throws:
RepositoryException - if the specified Node is not referenceable, the current Session is no longer active, or another error occurs.

createValue

Value createValue(Node value,
                  boolean weak)
                  throws RepositoryException
Returns a Value object of PropertyType.REFERENCE (if weak is false) or PropertyType.REFERENCE (if weak is true) that holds the identifier of the specified Node. This Value object can then be used to set a property that will be a reference to that Node.

Parameters:
value - a Node
weak - a boolean. If true then a PropertyType.WEAKREFERENCE is created, otherwise a PropertyType.REFERENCE is created.
Returns:
a Value of PropertyType.REFERENCE or PropertyType.REFERENCE
Throws:
RepositoryException - if the specified Node is not referenceable, the current Session is no longer active, or another error occurs.

createBinary

Binary createBinary(java.io.InputStream stream)
                    throws RepositoryException
Returns a Binary object with a value consisting of the content of the specified InputStream.

The passed InputStream is closed before this method returns either normally or because of an exception.

Parameters:
stream - an InputStream
Returns:
a Binary
Throws:
RepositoryException - if an error occurs.
Since:
JCR 2.0