org.modeshape.jcr.value

## Class ValueTypeSystem.Factory<T>

- java.lang.Object
- - org.modeshape.jcr.value.ValueTypeSystem.Factory<T>

- All Implemented Interfaces:
    TypeSystem.TypeFactory<T>
  Enclosing class:
    ValueTypeSystem

      protected class ValueTypeSystem.Factory<T>
      extends Object
      implements TypeSystem.TypeFactory<T>

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected PropertyType` | `type`
    `protected String` | `typeName`
    `protected ValueFactory<T>` | `valueFactory`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ValueTypeSystem.Factory(ValueFactory<T> valueFactory)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `asReadableString(Object value)` Get a readable and potentially shorter string representation of the supplied value.
    `String` | `asString(Object value)` Get the string representation of the supplied value.
    `T` | `create(Object value)` Create the typed representation of the value given the supplied object representation.
    `T` | `create(String value)` Create the typed representation of the value given the supplied string representation.
    `Comparator<T>` | `getComparator()` Get a comparator that can be used to store the values of this type.
    `Class<T>` | `getType()` Get the class representing the value type.
    `String` | `getTypeName()` Get the name of the type created by this factory.
    `long` | `length(Object value)` Get the length of the supplied value.

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

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

- - ### Field Detail

    - #### type

          protected final PropertyType type

    - #### valueFactory

          protected final ValueFactory<T> valueFactory

    - #### typeName

          protected final String typeName

  - ### Constructor Detail

    - #### ValueTypeSystem.Factory

          protected ValueTypeSystem.Factory(ValueFactory<T> valueFactory)

  - ### Method Detail

    - #### asReadableString

          public String asReadableString(Object value)

      Description copied from interface: `TypeSystem.TypeFactory`
      Get a readable and potentially shorter string representation of the supplied value.
      Specified by:
        `asReadableString` in interface `TypeSystem.TypeFactory<T>`
      Parameters:
        `value` - the value
      Returns:
        the readable string representation; never null

    - #### asString

          public String asString(Object value)

      Description copied from interface: `TypeSystem.TypeFactory`
      Get the string representation of the supplied value.
      Specified by:
        `asString` in interface `TypeSystem.TypeFactory<T>`
      Parameters:
        `value` - the value
      Returns:
        the string representation; never null

    - #### create

          public T create(String value)
                   throws ValueFormatException

      Description copied from interface: `TypeSystem.TypeFactory`
      Create the typed representation of the value given the supplied string representation.
      Specified by:
        `create` in interface `TypeSystem.TypeFactory<T>`
      Parameters:
        `value` - the string representation of the value
      Returns:
        the typed representation, which will be an instance of the `type`
      Throws:
        `ValueFormatException` - if the string cannot be converted to a typed value

    - #### create

          public T create(Object value)
                   throws ValueFormatException

      Description copied from interface: `TypeSystem.TypeFactory`
      Create the typed representation of the value given the supplied object representation.
      Specified by:
        `create` in interface `TypeSystem.TypeFactory<T>`
      Parameters:
        `value` - the object representation of the value
      Returns:
        the typed representation, which will be an instance of the `type`
      Throws:
        `ValueFormatException` - if the object cannot be converted to a typed value

    - #### getType

          public Class<T> getType()

      Description copied from interface: `TypeSystem.TypeFactory`
      Get the class representing the value type.
      Specified by:
        `getType` in interface `TypeSystem.TypeFactory<T>`
      Returns:
        the value type; never null

    - #### length

          public long length(Object value)

      Description copied from interface: `TypeSystem.TypeFactory`
      Get the length of the supplied value.
      Specified by:
        `length` in interface `TypeSystem.TypeFactory<T>`
      Parameters:
        `value` - the value
      Returns:
        the length; never negative

    - #### getComparator

          public Comparator<T> getComparator()

      Description copied from interface: `TypeSystem.TypeFactory`
      Get a comparator that can be used to store the values of this type.
      Specified by:
        `getComparator` in interface `TypeSystem.TypeFactory<T>`
      Returns:
        the comparator; never null

    - #### getTypeName

          public String getTypeName()

      Description copied from interface: `TypeSystem.TypeFactory`
      Get the name of the type created by this factory.
      Specified by:
        `getTypeName` in interface `TypeSystem.TypeFactory<T>`
      Returns:
        the type name; never null and never empty or blank

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