org.modeshape.jcr

## Class JcrValueFactory

- java.lang.Object
- - org.modeshape.jcr.JcrValueFactory

- All Implemented Interfaces:
    ValueFactory

      public class JcrValueFactory
      extends Object
      implements ValueFactory

  The `ValueFactory` implementation for ModeShape.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `JcrValueFactory(ExecutionContext context)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Object` | `convertValueToType(Object value, int toType)`
    `BinaryValue` | `createBinary(byte[] value)` Creates a JCR `Binary` value from the given byte array.
    `BinaryValue` | `createBinary(InputStream value)`
    `BinaryValue` | `createBinary(InputStream value, String hint)` Creates a JCR `Binary` value from the given input stream with a hint to the factory (which is passed to the storage layer)
    `String` | `createName(String localName)` Creates a JCR compliant name string, from the given local name.
    `String` | `createName(String namespaceUri, String localName)` Creates a JCR compliant name string, from the given namespace uri and local name.
    `org.modeshape.jcr.JcrValue` | `createSimpleReference(Node node)` Returns a `Value` object of `PropertyType.SIMPLE_REFERENCE` that holds the identifier of the specified `Node`.
    `org.modeshape.jcr.JcrValue` | `createValue(BigDecimal value)`
    `org.modeshape.jcr.JcrValue` | `createValue(Binary value)`
    `org.modeshape.jcr.JcrValue` | `createValue(boolean value)`
    `org.modeshape.jcr.JcrValue` | `createValue(Calendar value)`
    `org.modeshape.jcr.JcrValue` | `createValue(Date value)` Creates a JCR compatible `Value` from a `Date` instance.
    `org.modeshape.jcr.JcrValue` | `createValue(double value)`
    `org.modeshape.jcr.JcrValue` | `createValue(InputStream value)`
    `org.modeshape.jcr.JcrValue` | `createValue(long value)`
    `org.modeshape.jcr.JcrValue` | `createValue(Node value)`
    `org.modeshape.jcr.JcrValue` | `createValue(Node value, boolean weak)`
    `org.modeshape.jcr.JcrValue` | `createValue(Object value, int propertyType)`
    `org.modeshape.jcr.JcrValue` | `createValue(Reference value)`
    `org.modeshape.jcr.JcrValue` | `createValue(String value)`
    `org.modeshape.jcr.JcrValue` | `createValue(String value, int propertyType)`
    `org.modeshape.jcr.JcrValue[]` | `createValues(List<?> values, int propertyType)`
    `protected ValueFactory<?>` | `valueFactoryFor(int jcrPropertyType)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JcrValueFactory

          protected JcrValueFactory(ExecutionContext context)

  - ### Method Detail

    - #### createValues

          public org.modeshape.jcr.JcrValue[] createValues(List<?> values,
                                                  int propertyType)
                                                    throws ValueFormatException

      Throws:
        `ValueFormatException`

    - #### createValue

          public org.modeshape.jcr.JcrValue createValue(String value,
                                               int propertyType)
                                                 throws ValueFormatException

      Specified by:
        `createValue` in interface `ValueFactory`
      Throws:
        `ValueFormatException`

    - #### createValue

          public org.modeshape.jcr.JcrValue createValue(Object value,
                                               int propertyType)
                                                 throws ValueFormatException

      Throws:
        `ValueFormatException`

    - #### createValue

          public org.modeshape.jcr.JcrValue createValue(Node value)
                                                 throws RepositoryException

      Specified by:
        `createValue` in interface `ValueFactory`
      Throws:
        `RepositoryException`

    - #### createValue

          public org.modeshape.jcr.JcrValue createValue(Node value,
                                               boolean weak)
                                                 throws RepositoryException

      Specified by:
        `createValue` in interface `ValueFactory`
      Throws:
        `RepositoryException`

    - #### createValue

          public org.modeshape.jcr.JcrValue createValue(Binary value)

      Specified by:
        `createValue` in interface `ValueFactory`

    - #### createValue

          public org.modeshape.jcr.JcrValue createValue(InputStream value)

      Specified by:
        `createValue` in interface `ValueFactory`

    - #### createBinary

          public BinaryValue createBinary(InputStream value)

      Specified by:
        `createBinary` in interface `ValueFactory`

    - #### createBinary

          public BinaryValue createBinary(InputStream value,
                                 String hint)

      Description copied from interface: `ValueFactory`
      Creates a JCR `Binary` value from the given input stream with a hint to the factory (which is passed to the storage layer)
      Parameters:
        `value` - a non-null input stream
        `hint` - a hint that the storage layer may use to make persistence decisions
      Returns:
        a Binary implementation instance

    - #### createValue

          public org.modeshape.jcr.JcrValue createValue(Calendar value)

      Specified by:
        `createValue` in interface `ValueFactory`

    - #### createValue

          public org.modeshape.jcr.JcrValue createValue(boolean value)

      Specified by:
        `createValue` in interface `ValueFactory`

    - #### createValue

          public org.modeshape.jcr.JcrValue createValue(double value)

      Specified by:
        `createValue` in interface `ValueFactory`

    - #### createValue

          public org.modeshape.jcr.JcrValue createValue(long value)

      Specified by:
        `createValue` in interface `ValueFactory`

    - #### createValue

          public org.modeshape.jcr.JcrValue createValue(String value)

      Specified by:
        `createValue` in interface `ValueFactory`

    - #### createValue

          public org.modeshape.jcr.JcrValue createValue(BigDecimal value)

      Specified by:
        `createValue` in interface `ValueFactory`

    - #### createBinary

          public BinaryValue createBinary(byte[] value)

      Description copied from interface: `ValueFactory`
      Creates a JCR `Binary` value from the given byte array.
      Parameters:
        `value` - a non-null byte array
      Returns:
        a Binary implementation instance

    - #### createValue

          public org.modeshape.jcr.JcrValue createValue(Date value)

      Description copied from interface: `ValueFactory`
      Creates a JCR compatible `Value` from a `Date` instance.
      Parameters:
        `value` - a non-null date instance
      Returns:
        a JCR value

    - #### createValue

          public org.modeshape.jcr.JcrValue createValue(Reference value)

    - #### createName

          public String createName(String localName)

      Description copied from interface: `ValueFactory`
      Creates a JCR compliant name string, from the given local name.
      Parameters:
        `localName` - a non-null string.
      Returns:
        a name-compliant string

    - #### createName

          public String createName(String namespaceUri,
                          String localName)

      Description copied from interface: `ValueFactory`
      Creates a JCR compliant name string, from the given namespace uri and local name.
      Parameters:
        `namespaceUri` - a non-null string.
        `localName` - a non-null string.
      Returns:
        a name-compliant string

    - #### createSimpleReference

          public org.modeshape.jcr.JcrValue createSimpleReference(Node node)
                                                           throws RepositoryException

      Description copied from interface: `ValueFactory`
      Returns a `Value` object of `PropertyType.SIMPLE_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:
        `node` - a `Node`
      Returns:
        a `Value` of `PropertyType.SIMPLE_REFERENCE`
      Throws:
        `RepositoryException` - if an error occurs.

    - #### valueFactoryFor

          protected ValueFactory<?> valueFactoryFor(int jcrPropertyType)

    - #### convertValueToType

          protected Object convertValueToType(Object value,
                                  int toType)
                                       throws ValueFormatException

      Throws:
        `ValueFormatException`

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.