org.modeshape.jcr.api

## Interface ValueFactory

- All Superinterfaces:
    ValueFactory

      public interface ValueFactory
      extends ValueFactory

  Extension of the standard `ValueFactory` which allows conversion to the jcr `Value` from additional types.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Binary` | `createBinary(byte[] value)` Creates a JCR `Binary` value from the given byte array.
    `Binary` | `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.
    `Value` | `createSimpleReference(Node node)` Returns a `Value` object of `PropertyType.SIMPLE_REFERENCE` that holds the identifier of the specified `Node`.
    `Value` | `createValue(Date value)` Creates a JCR compatible `Value` from a `Date` instance.
    `Value` | `createValue(URI value)` Creates a JCR compatible `Value` from a `URI` instance.

    - ### Methods inherited from interface javax.jcr.ValueFactory

      `createBinary, createValue, createValue, createValue, createValue, createValue, createValue, createValue, createValue, createValue, createValue, createValue`

- - ### Method Detail

    - #### createValue

          Value createValue(Date value)
                            throws ValueFormatException

      Creates a JCR compatible `Value` from a `Date` instance.
      Parameters:
        `value` - a non-null date instance
      Returns:
        a JCR value
      Throws:
        `ValueFormatException` - if the given value cannot be converted

    - #### createValue

          Value createValue(URI value)
                            throws ValueFormatException

      Creates a JCR compatible `Value` from a `URI` instance.
      Parameters:
        `value` - a non-null URI instance
      Returns:
        a JCR value
      Throws:
        `ValueFormatException` - if the given value cannot be converted

    - #### createBinary

          Binary createBinary(byte[] value)

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

    - #### createBinary

          Binary 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)
      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

    - #### createName

          String createName(String localName)

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

    - #### createName

          String createName(String namespaceUri,
                          String localName)

      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

          Value createSimpleReference(Node node)
                                      throws RepositoryException

      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.

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