org.modeshape.jcr.query.model

## Class TypeSystem

- java.lang.Object
- - org.modeshape.jcr.query.model.TypeSystem

- Direct Known Subclasses:
    JcrTypeSystem, ValueTypeSystem

      @Immutable
      public abstract class TypeSystem
      extends Object

  An interface that defines the value types used in tuples.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `TypeSystem.SerializableComparator<T>`
    `static interface` | `TypeSystem.TypeFactory<T>` Factory interface for creating values from strings.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TypeSystem()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract String` | `asString(Object value)` Get the string representation of the supplied value, using the most appropriate factory given the value.
    `abstract TypeSystem.TypeFactory<BinaryValue>` | `getBinaryFactory()` Get the type factory for binary objects.
    `abstract TypeSystem.TypeFactory<Boolean>` | `getBooleanFactory()` Get the type factory for boolean types.
    `abstract String` | `getCompatibleType(String type1, String type2)` Get the type that is compatible with both of the supplied types.
    `abstract TypeSystem.TypeFactory<?>` | `getCompatibleType(TypeSystem.TypeFactory<?> type1, TypeSystem.TypeFactory<?> type2)` Get the type that is compatible with both of the supplied types.
    `abstract TypeSystem.TypeFactory<?>` | `getDateTimeFactory()` Get the type factory for date-time objects.
    `abstract TypeSystem.TypeFactory<BigDecimal>` | `getDecimalFactory()` Get the type factory for decimal types.
    `abstract Comparator<Object>` | `getDefaultComparator()` Get the comparator that should be used by default.
    `abstract String` | `getDefaultType()` Get the name of the type that is used by default.
    `abstract TypeSystem.TypeFactory<Double>` | `getDoubleFactory()` Get the type factory for double types.
    `abstract TypeSystem.TypeFactory<Long>` | `getLongFactory()` Get the type factory for long types.
    `abstract TypeSystem.TypeFactory<Name>` | `getNameFactory()` Get the type factory for name objects.
    `abstract TypeSystem.TypeFactory<NodeKey>` | `getNodeKeyFactory()` Get the type factory for node key objects.
    `abstract TypeSystem.TypeFactory<Path>` | `getPathFactory()` Get the type factory for path objects.
    `abstract TypeSystem.TypeFactory<Reference>` | `getReferenceFactory()` Get the type factory for references objects.
    `abstract TypeSystem.TypeFactory<String>` | `getStringFactory()` Get the type factory for string types.
    `abstract TypeSystem.TypeFactory<?>` | `getTypeFactory(Object prototype)` Get the type factory for the type denoted by the supplied prototype value.
    `abstract TypeSystem.TypeFactory<?>` | `getTypeFactory(String typeName)` Get the type factory given the name of the type.
    `abstract Set<String>` | `getTypeNames()` Get the names of the supported types.
    `static <T> TypeSystem.TypeFactory<T>` | `with(TypeSystem.TypeFactory<T> original, Order order, NullOrder nullOrder)` Return a new type factory that has a comparator that uses the supplied `Order` and `NullOrder` behavior.
    `static <T> TypeSystem.TypeFactory<T>` | `withComparator(TypeSystem.TypeFactory<T> original, Comparator<T> comparator)` Return a new type factory that has a comparator that inverts the normal comparison.
    `static <T> TypeSystem.TypeFactory<T>` | `withOppositeComparator(TypeSystem.TypeFactory<T> original)` Return a new type factory that has a comparator that inverts the normal comparison.

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

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

- - ### Constructor Detail

    - #### TypeSystem

          public TypeSystem()

  - ### Method Detail

    - #### getTypeFactory

          public abstract TypeSystem.TypeFactory<?> getTypeFactory(String typeName)

      Get the type factory given the name of the type.
      Parameters:
        `typeName` - the name of the type
      Returns:
        the type factory, or null if there is no such type in this system

    - #### getTypeFactory

          public abstract TypeSystem.TypeFactory<?> getTypeFactory(Object prototype)

      Get the type factory for the type denoted by the supplied prototype value.
      Parameters:
        `prototype` - the value whose type is to be identified
      Returns:
        the type factory, or null if there is no such type in this system

    - #### getBooleanFactory

          public abstract TypeSystem.TypeFactory<Boolean> getBooleanFactory()

      Get the type factory for boolean types.
      Returns:
        the boolean factory; never null

    - #### getLongFactory

          public abstract TypeSystem.TypeFactory<Long> getLongFactory()

      Get the type factory for long types.
      Returns:
        the long factory; never null

    - #### getStringFactory

          public abstract TypeSystem.TypeFactory<String> getStringFactory()

      Get the type factory for string types.
      Returns:
        the string factory; never null

    - #### getDoubleFactory

          public abstract TypeSystem.TypeFactory<Double> getDoubleFactory()

      Get the type factory for double types.
      Returns:
        the double factory; never null

    - #### getDecimalFactory

          public abstract TypeSystem.TypeFactory<BigDecimal> getDecimalFactory()

      Get the type factory for decimal types.
      Returns:
        the decimal factory; never null

    - #### getDateTimeFactory

          public abstract TypeSystem.TypeFactory<?> getDateTimeFactory()

      Get the type factory for date-time objects.
      Returns:
        the date-time factory, or null if this type system doesn't support date-time objects

    - #### getPathFactory

          public abstract TypeSystem.TypeFactory<Path> getPathFactory()

      Get the type factory for path objects.
      Returns:
        the path factory, or null if this type system doesn't support path objects

    - #### getNameFactory

          public abstract TypeSystem.TypeFactory<Name> getNameFactory()

      Get the type factory for name objects.
      Returns:
        the name factory, or null if this type system doesn't support path objects

    - #### getReferenceFactory

          public abstract TypeSystem.TypeFactory<Reference> getReferenceFactory()

      Get the type factory for references objects.
      Returns:
        the reference factory, or null if this type system doesn't support reference objects

    - #### getNodeKeyFactory

          public abstract TypeSystem.TypeFactory<NodeKey> getNodeKeyFactory()

      Get the type factory for node key objects.
      Returns:
        the node key factory, or null if this type system doesn't support node key objects

    - #### getBinaryFactory

          public abstract TypeSystem.TypeFactory<BinaryValue> getBinaryFactory()

      Get the type factory for binary objects.
      Returns:
        the binary factory, or null if this type system doesn't support binary objects

    - #### getDefaultType

          public abstract String getDefaultType()

      Get the name of the type that is used by default.
      Returns:
        the default type name; never null

    - #### getDefaultComparator

          public abstract Comparator<Object> getDefaultComparator()

      Get the comparator that should be used by default.
      Returns:
        the default comparator; never null

    - #### getTypeNames

          public abstract Set<String> getTypeNames()

      Get the names of the supported types.
      Returns:
        the immutable set of the uppercase names of the types; never null

    - #### asString

          public abstract String asString(Object value)

      Get the string representation of the supplied value, using the most appropriate factory given the value.
      Parameters:
        `value` - the value
      Returns:
        the string representation; never null

    - #### getCompatibleType

          public abstract String getCompatibleType(String type1,
                                 String type2)

      Get the type that is compatible with both of the supplied types.
      Parameters:
        `type1` - the first type; may be null
        `type2` - the second type; may be null
      Returns:
        the compatible type; never null

    - #### getCompatibleType

          public abstract TypeSystem.TypeFactory<?> getCompatibleType(TypeSystem.TypeFactory<?> type1,
                                                    TypeSystem.TypeFactory<?> type2)

      Get the type that is compatible with both of the supplied types.
      Parameters:
        `type1` - the first type; may be null
        `type2` - the second type; may be null
      Returns:
        the compatible type; never null

    - #### withComparator

          public static <T> TypeSystem.TypeFactory<T> withComparator(TypeSystem.TypeFactory<T> original,
                                                     Comparator<T> comparator)

      Return a new type factory that has a comparator that inverts the normal comparison.
      Parameters:
        `original` - the original type factory; may not be null
        `comparator` - the new comparator to use; may be null
      Returns:
        the new type factory; never null, but `original` if `comparator` is null

    - #### withOppositeComparator

          public static <T> TypeSystem.TypeFactory<T> withOppositeComparator(TypeSystem.TypeFactory<T> original)

      Return a new type factory that has a comparator that inverts the normal comparison.
      Parameters:
        `original` - the original type factory; may not be null
      Returns:
        the new type factory; never null

    - #### with

          public static <T> TypeSystem.TypeFactory<T> with(TypeSystem.TypeFactory<T> original,
                                           Order order,
                                           NullOrder nullOrder)

      Return a new type factory that has a comparator that uses the supplied `Order` and `NullOrder` behavior.
      Parameters:
        `original` - the original type factory; may not be null
        `order` - the specification of whether the comparator should order ascending or descending; may not be null
        `nullOrder` - the specification of whether null values should appear first or last; may not be null
      Returns:
        the new type factory; never null, but possibly `original` if it has the desired behavior

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