org.apache.jackrabbit.value
Class ValueHelper

java.lang.Object
  extended by org.apache.jackrabbit.value.ValueHelper

public class ValueHelper
extends Object

The ValueHelper class provides several Value related utility methods.


Method Summary
static javax.jcr.Value[] convert(InputStream[] srcValues, int targetType, javax.jcr.ValueFactory factory)
           
static javax.jcr.Value convert(InputStream srcValue, int targetType)
          Deprecated. Use convert(InputStream, int, ValueFactory) instead.
static javax.jcr.Value convert(InputStream srcValue, int targetType, javax.jcr.ValueFactory factory)
           
static javax.jcr.Value[] convert(String[] srcValues, int targetType)
          Deprecated. Use convert(String[], int, ValueFactory) instead.
static javax.jcr.Value[] convert(String[] srcValues, int targetType, javax.jcr.ValueFactory factory)
          Same as convert(String[], int, ValueFactory) using ValueFactoryImpl.
static javax.jcr.Value convert(String srcValue, int targetType)
          Deprecated. Use convert(String, int, ValueFactory) instead.
static javax.jcr.Value convert(String srcValue, int targetType, javax.jcr.ValueFactory factory)
           
static javax.jcr.Value[] convert(javax.jcr.Value[] srcValues, int targetType)
          Deprecated. Use convert(Value[], int, ValueFactory) instead.
static javax.jcr.Value[] convert(javax.jcr.Value[] srcValues, int targetType, javax.jcr.ValueFactory factory)
           
static javax.jcr.Value convert(javax.jcr.Value srcValue, int targetType)
          Deprecated. Use convert(Value, int, ValueFactory) instead.
static javax.jcr.Value convert(javax.jcr.Value srcValue, int targetType, javax.jcr.ValueFactory factory)
          Converts the given value to a value of the specified target type.
static javax.jcr.Value copy(javax.jcr.Value srcValue)
          Deprecated. Use copy(Value, ValueFactory) instead.
static javax.jcr.Value[] copy(javax.jcr.Value[] srcValues)
          Deprecated. Use copy(Value[], ValueFactory) instead.
static javax.jcr.Value[] copy(javax.jcr.Value[] srcValues, javax.jcr.ValueFactory factory)
           
static javax.jcr.Value copy(javax.jcr.Value srcValue, javax.jcr.ValueFactory factory)
           
static javax.jcr.Value deserialize(Reader reader, int type, boolean decodeBlanks)
          Deprecated. Use deserialize(Reader, int, boolean, ValueFactory) instead.
static javax.jcr.Value deserialize(Reader reader, int type, boolean decodeBlanks, javax.jcr.ValueFactory factory)
          Deserializes the string data read from the given reader to a Value of the given type.
static javax.jcr.Value deserialize(String value, int type, boolean decodeBlanks)
          Deprecated. Use deserialize(String, int, boolean, ValueFactory) instead.
static javax.jcr.Value deserialize(String value, int type, boolean decodeBlanks, javax.jcr.ValueFactory factory)
          Deserializes the given string to a Value of the given type.
static String serialize(javax.jcr.Value value, boolean encodeBlanks)
          Serializes the given value to a String.
static void serialize(javax.jcr.Value value, boolean encodeBlanks, boolean enforceBase64, Writer writer)
          Outputs the serialized value to a Writer.
static void serialize(javax.jcr.Value value, boolean encodeBlanks, Writer writer)
          Deprecated. use serialize(Value, boolean, boolean, Writer) instead
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

convert

public static javax.jcr.Value convert(String srcValue,
                                      int targetType)
                               throws javax.jcr.ValueFormatException,
                                      IllegalArgumentException
Deprecated. Use convert(String, int, ValueFactory) instead.

Same as convert(String, int, ValueFactory) using ValueFactoryImpl.

Parameters:
srcValue -
targetType -
Throws:
javax.jcr.ValueFormatException
IllegalArgumentException
See Also:
convert(Value, int, ValueFactory)

convert

public static javax.jcr.Value convert(String srcValue,
                                      int targetType,
                                      javax.jcr.ValueFactory factory)
                               throws javax.jcr.ValueFormatException,
                                      IllegalArgumentException
Parameters:
srcValue -
targetType -
factory -
Throws:
javax.jcr.ValueFormatException
IllegalArgumentException
See Also:
convert(Value, int, ValueFactory)

convert

public static javax.jcr.Value convert(InputStream srcValue,
                                      int targetType)
                               throws javax.jcr.ValueFormatException,
                                      IllegalArgumentException
Deprecated. Use convert(InputStream, int, ValueFactory) instead.

Same as convert(InputStream, int, ValueFactory) using ValueFactoryImpl.

Parameters:
srcValue -
targetType -
Throws:
javax.jcr.ValueFormatException
IllegalArgumentException

convert

public static javax.jcr.Value convert(InputStream srcValue,
                                      int targetType,
                                      javax.jcr.ValueFactory factory)
                               throws javax.jcr.ValueFormatException,
                                      IllegalArgumentException
Parameters:
srcValue -
targetType -
factory -
Throws:
javax.jcr.ValueFormatException
IllegalArgumentException

convert

public static javax.jcr.Value[] convert(String[] srcValues,
                                        int targetType)
                                 throws javax.jcr.ValueFormatException,
                                        IllegalArgumentException
Deprecated. Use convert(String[], int, ValueFactory) instead.

Same as convert(String[], int, ValueFactory) using ValueFactoryImpl.

Parameters:
srcValues -
targetType -
Throws:
javax.jcr.ValueFormatException
IllegalArgumentException
See Also:
convert(Value, int, ValueFactory)

convert

public static javax.jcr.Value[] convert(String[] srcValues,
                                        int targetType,
                                        javax.jcr.ValueFactory factory)
                                 throws javax.jcr.ValueFormatException,
                                        IllegalArgumentException
Same as convert(String[], int, ValueFactory) using ValueFactoryImpl.

Parameters:
srcValues -
targetType -
Throws:
javax.jcr.ValueFormatException
IllegalArgumentException
See Also:
convert(Value, int, ValueFactory)

convert

public static javax.jcr.Value[] convert(InputStream[] srcValues,
                                        int targetType,
                                        javax.jcr.ValueFactory factory)
                                 throws javax.jcr.ValueFormatException,
                                        IllegalArgumentException
Parameters:
srcValues -
targetType -
Throws:
javax.jcr.ValueFormatException
IllegalArgumentException
See Also:
convert(Value, int, ValueFactory)

convert

public static javax.jcr.Value[] convert(javax.jcr.Value[] srcValues,
                                        int targetType)
                                 throws javax.jcr.ValueFormatException,
                                        IllegalArgumentException
Deprecated. Use convert(Value[], int, ValueFactory) instead.

Same as convert(Value[], int, ValueFactory) using ValueFactoryImpl.

Parameters:
srcValues -
targetType -
Throws:
javax.jcr.ValueFormatException
IllegalArgumentException
See Also:
convert(Value, int, ValueFactory)

convert

public static javax.jcr.Value[] convert(javax.jcr.Value[] srcValues,
                                        int targetType,
                                        javax.jcr.ValueFactory factory)
                                 throws javax.jcr.ValueFormatException,
                                        IllegalArgumentException
Parameters:
srcValues -
targetType -
factory -
Throws:
javax.jcr.ValueFormatException
IllegalArgumentException
See Also:
convert(Value, int, ValueFactory)

convert

public static javax.jcr.Value convert(javax.jcr.Value srcValue,
                                      int targetType)
                               throws javax.jcr.ValueFormatException,
                                      IllegalStateException,
                                      IllegalArgumentException
Deprecated. Use convert(Value, int, ValueFactory) instead.

Same as convert(Value, int, ValueFactory) using ValueFactoryImpl.

Parameters:
srcValue -
targetType -
Throws:
javax.jcr.ValueFormatException
IllegalStateException
IllegalArgumentException
See Also:
convert(Value, int, ValueFactory)

convert

public static javax.jcr.Value convert(javax.jcr.Value srcValue,
                                      int targetType,
                                      javax.jcr.ValueFactory factory)
                               throws javax.jcr.ValueFormatException,
                                      IllegalStateException,
                                      IllegalArgumentException
Converts the given value to a value of the specified target type. The conversion is performed according to the rules described in "6.2.6 Property Type Conversion" in the JSR 170 specification.

Parameters:
srcValue -
targetType -
factory -
Throws:
javax.jcr.ValueFormatException
IllegalStateException
IllegalArgumentException

copy

public static javax.jcr.Value copy(javax.jcr.Value srcValue)
                            throws IllegalStateException
Deprecated. Use copy(Value, ValueFactory) instead.

Same as copy(Value, ValueFactory) using ValueFactoryImpl.

Parameters:
srcValue -
Throws:
IllegalStateException

copy

public static javax.jcr.Value copy(javax.jcr.Value srcValue,
                                   javax.jcr.ValueFactory factory)
                            throws IllegalStateException
Parameters:
srcValue -
factory -
Throws:
IllegalStateException

copy

public static javax.jcr.Value[] copy(javax.jcr.Value[] srcValues)
                              throws IllegalStateException
Deprecated. Use copy(Value[], ValueFactory) instead.

Same as copy(Value[], ValueFactory) using ValueFactoryImpl.

Parameters:
srcValues -
Throws:
IllegalStateException

copy

public static javax.jcr.Value[] copy(javax.jcr.Value[] srcValues,
                                     javax.jcr.ValueFactory factory)
                              throws IllegalStateException
Parameters:
srcValues -
factory -
Throws:
IllegalStateException

serialize

public static String serialize(javax.jcr.Value value,
                               boolean encodeBlanks)
                        throws IllegalStateException,
                               javax.jcr.RepositoryException
Serializes the given value to a String. The serialization format is the same as used by Document & System View XML, i.e. binary values will be Base64-encoded whereas for all others Value.getString() will be used.

Parameters:
value - the value to be serialized
encodeBlanks - if true space characters will be encoded as "_x0020_" within he output string.
Returns:
a string representation of the given value.
Throws:
IllegalStateException - if the given value is in an illegal state
javax.jcr.RepositoryException - if an error occured during the serialization.

serialize

public static void serialize(javax.jcr.Value value,
                             boolean encodeBlanks,
                             Writer writer)
                      throws IllegalStateException,
                             IOException,
                             javax.jcr.RepositoryException
Deprecated. use serialize(Value, boolean, boolean, Writer) instead

Throws:
IllegalStateException
IOException
javax.jcr.RepositoryException

serialize

public static void serialize(javax.jcr.Value value,
                             boolean encodeBlanks,
                             boolean enforceBase64,
                             Writer writer)
                      throws IllegalStateException,
                             IOException,
                             javax.jcr.RepositoryException
Outputs the serialized value to a Writer. The serialization format is the same as used by Document & System View XML, i.e. binary values will be Base64-encoded whereas for all others Value.getString() will be used for serialization.

Parameters:
value - the value to be serialized
encodeBlanks - if true space characters will be encoded as "_x0020_" within he output string.
enforceBase64 - if true, base64 encoding will always be used
writer - writer to output the encoded data
Throws:
IllegalStateException - if the given value is in an illegal state
IOException - if an i/o error occured during the serialization
javax.jcr.RepositoryException - if an error occured during the serialization.

deserialize

public static javax.jcr.Value deserialize(String value,
                                          int type,
                                          boolean decodeBlanks)
                                   throws javax.jcr.ValueFormatException,
                                          javax.jcr.RepositoryException
Deprecated. Use deserialize(String, int, boolean, ValueFactory) instead.

Deserializes the given string to a Value of the given type. Same as deserialize(String, int, boolean, ValueFactory) using ValueFactoryImpl.

Parameters:
value - string to be deserialized
type - type of value
decodeBlanks - if true "_x0020_" character sequences will be decoded to single space characters each.
Returns:
the deserialized Value
Throws:
javax.jcr.ValueFormatException - if the string data is not of the required format
javax.jcr.RepositoryException - if an error occured during the deserialization.

deserialize

public static javax.jcr.Value deserialize(String value,
                                          int type,
                                          boolean decodeBlanks,
                                          javax.jcr.ValueFactory factory)
                                   throws javax.jcr.ValueFormatException,
                                          javax.jcr.RepositoryException
Deserializes the given string to a Value of the given type.

Parameters:
value - string to be deserialized
type - type of value
decodeBlanks - if true "_x0020_" character sequences will be decoded to single space characters each.
factory - ValueFactory used to build the Value object.
Returns:
the deserialized Value
Throws:
javax.jcr.ValueFormatException - if the string data is not of the required format
javax.jcr.RepositoryException - if an error occured during the deserialization.

deserialize

public static javax.jcr.Value deserialize(Reader reader,
                                          int type,
                                          boolean decodeBlanks)
                                   throws IOException,
                                          javax.jcr.ValueFormatException,
                                          javax.jcr.RepositoryException
Deprecated. Use deserialize(Reader, int, boolean, ValueFactory) instead.

Deserializes the string data read from the given reader to a Value of the given type. Same as deserialize(Reader, int, boolean, ValueFactory) using ValueFactoryImpl.

Parameters:
reader - reader for the string data to be deserialized
type - type of value
decodeBlanks - if true "_x0020_" character sequences will be decoded to single space characters each.
Returns:
the deserialized Value
Throws:
IOException - if an i/o error occured during the serialization
javax.jcr.ValueFormatException - if the string data is not of the required format
javax.jcr.RepositoryException - if an error occured during the deserialization.

deserialize

public static javax.jcr.Value deserialize(Reader reader,
                                          int type,
                                          boolean decodeBlanks,
                                          javax.jcr.ValueFactory factory)
                                   throws IOException,
                                          javax.jcr.ValueFormatException,
                                          javax.jcr.RepositoryException
Deserializes the string data read from the given reader to a Value of the given type.

Parameters:
reader - reader for the string data to be deserialized
type - type of value
decodeBlanks - if true "_x0020_" character sequences will be decoded to single space characters each.
factory - ValueFactory used to build the Value object.
Returns:
the deserialized Value
Throws:
IOException - if an i/o error occured during the serialization
javax.jcr.ValueFormatException - if the string data is not of the required format
javax.jcr.RepositoryException - if an error occured during the deserialization.


Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.