Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.graph.query.model
Interface TypeSystem.TypeFactory<T>

Type Parameters:
  `T` - the type of value object

All Known Implementing Classes:
  ValueTypeSystem.Factory

Enclosing interface:
  TypeSystem

    public static interface TypeSystem.TypeFactory<T>

Factory interface for creating values from strings.

Method Summary
`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.

Method Detail

### getType

    Class<T> getType()

  Get the class representing the value type.

  Returns:
    the value type; never null

### getComparator

    Comparator<T> getComparator()

  Get a comparator that can be used to store the values of this type.

  Returns:
    the comparator; never null

### getTypeName

    String getTypeName()

  Get the name of the type created by this factory.

  Returns:
    the type name; never null and never empty or blank

### create

    T create(String value)
             throws ValueFormatException

  Create the typed representation of the value given the supplied string representation.

  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

    T create(Object value)
             throws ValueFormatException

  Create the typed representation of the value given the supplied object representation.

  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

### asString

    String asString(Object value)

  Get the string representation of the supplied value.

  Parameters:
    `value` - the value
  Returns:
    the string representation; never null

### length

    long length(Object value)

  Get the length of the supplied value.

  Parameters:
    `value` - the value
  Returns:
    the length; never negative

### asReadableString

    String asReadableString(Object value)

  Get a readable and potentially shorter string representation of the supplied value.

  Parameters:
    `value` - the value
  Returns:
    the readable string representation; never null

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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