org.priha.core.values
Class ValueFactoryImpl

java.lang.Object
  extended by org.priha.core.values.ValueFactoryImpl
All Implemented Interfaces:
javax.jcr.ValueFactory

public class ValueFactoryImpl
extends java.lang.Object
implements javax.jcr.ValueFactory

This is a session-specific holder of things.


Constructor Summary
ValueFactoryImpl(SessionImpl session)
           
 
Method Summary
 javax.jcr.Value[] addValue(javax.jcr.Value[] orig, javax.jcr.Value add)
          Returns a new Value array with the new Value added in the last position.
static boolean canConvert(ValueImpl value, int type)
          Returns true, if the given String value can be converted to the given type.
 ValueImpl cloneValue(ValueImpl value)
           
 javax.jcr.Value[] cloneValues(javax.jcr.Value[] values)
          Clones a value array.
 ValueImpl createValue(BinarySource source)
           
 ValueImpl createValue(boolean value)
           
 ValueImpl createValue(boolean value, int type)
           
 ValueImpl createValue(java.util.Calendar value)
           
 ValueImpl createValue(double value)
           
 ValueImpl createValue(java.io.InputStream value)
           
 ValueImpl createValue(java.io.InputStream value, int type)
           
 ValueImpl createValue(long value)
           
 ValueImpl createValue(javax.jcr.Node value)
           
 ValueImpl createValue(QName qn, int type)
           
 ValueImpl createValue(java.lang.String value)
           
 ValueImpl createValue(java.lang.String value, int type)
           
 ValueImpl createValue(ValueImpl value)
           
 javax.jcr.Value[] removeValue(javax.jcr.Value[] orig, javax.jcr.Value rem)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValueFactoryImpl

public ValueFactoryImpl(SessionImpl session)
Method Detail

createValue

public ValueImpl createValue(ValueImpl value)
                      throws javax.jcr.ValueFormatException,
                             java.lang.IllegalStateException,
                             javax.jcr.RepositoryException
Throws:
javax.jcr.ValueFormatException
java.lang.IllegalStateException
javax.jcr.RepositoryException

createValue

public ValueImpl createValue(java.lang.String value)
Specified by:
createValue in interface javax.jcr.ValueFactory

createValue

public ValueImpl createValue(long value)
Specified by:
createValue in interface javax.jcr.ValueFactory

createValue

public ValueImpl createValue(double value)
Specified by:
createValue in interface javax.jcr.ValueFactory

createValue

public ValueImpl createValue(boolean value)
Specified by:
createValue in interface javax.jcr.ValueFactory

createValue

public ValueImpl createValue(java.util.Calendar value)
Specified by:
createValue in interface javax.jcr.ValueFactory

createValue

public ValueImpl createValue(java.io.InputStream value)
Specified by:
createValue in interface javax.jcr.ValueFactory

createValue

public ValueImpl createValue(javax.jcr.Node value)
                      throws javax.jcr.RepositoryException
Specified by:
createValue in interface javax.jcr.ValueFactory
Throws:
javax.jcr.RepositoryException

createValue

public ValueImpl createValue(BinarySource source)

createValue

public ValueImpl createValue(boolean value,
                             int type)
                      throws javax.jcr.ValueFormatException
Throws:
javax.jcr.ValueFormatException

createValue

public ValueImpl createValue(java.io.InputStream value,
                             int type)
                      throws javax.jcr.ValueFormatException
Throws:
javax.jcr.ValueFormatException

canConvert

public static boolean canConvert(ValueImpl value,
                                 int type)
Returns true, if the given String value can be converted to the given type.

Parameters:
value -
type -
Returns:

createValue

public ValueImpl createValue(java.lang.String value,
                             int type)
                      throws javax.jcr.ValueFormatException
Specified by:
createValue in interface javax.jcr.ValueFactory
Throws:
javax.jcr.ValueFormatException

cloneValues

public javax.jcr.Value[] cloneValues(javax.jcr.Value[] values)
                              throws javax.jcr.ValueFormatException,
                                     java.lang.IllegalStateException,
                                     javax.jcr.RepositoryException
Clones a value array. This creates a new instance of every single value contained in this array, a so-called deep clone.

Parameters:
values - The array to clone.
Returns:
A deep clone of the array.
Throws:
javax.jcr.ValueFormatException
java.lang.IllegalStateException
javax.jcr.RepositoryException

cloneValue

public ValueImpl cloneValue(ValueImpl value)
                     throws javax.jcr.ValueFormatException,
                            java.lang.IllegalStateException,
                            javax.jcr.RepositoryException
Throws:
javax.jcr.ValueFormatException
java.lang.IllegalStateException
javax.jcr.RepositoryException

addValue

public javax.jcr.Value[] addValue(javax.jcr.Value[] orig,
                                  javax.jcr.Value add)
Returns a new Value array with the new Value added in the last position.

Parameters:
orig - Original Value array
add - The value to be added.
Returns:
A new Array with the add value in the last position.

createValue

public ValueImpl createValue(QName qn,
                             int type)
                      throws javax.jcr.ValueFormatException
Throws:
javax.jcr.ValueFormatException

removeValue

public javax.jcr.Value[] removeValue(javax.jcr.Value[] orig,
                                     javax.jcr.Value rem)