org.modeshape.graph.property
Class ValueTypeSystem

java.lang.Object
  extended by org.modeshape.graph.property.ValueTypeSystem
All Implemented Interfaces:
TypeSystem

public class ValueTypeSystem
extends Object
implements TypeSystem


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.modeshape.graph.query.model.TypeSystem
TypeSystem.TypeFactory<T>
 
Constructor Summary
ValueTypeSystem(ValueFactories valueFactories)
          Create a type system using the supplied value factories.
 
Method Summary
 String asString(Object value)
          Get the string representation of the supplied value, using the most appropriate factory given the value.
 TypeSystem.TypeFactory<?> getBinaryFactory()
          Get the type factory for binary objects.
 TypeSystem.TypeFactory<Boolean> getBooleanFactory()
          Get the type factory for boolean types.
 String getCompatibleType(String type1, String type2)
          Get the type that is compatible with both of the supplied types.
 TypeSystem.TypeFactory<?> getDateTimeFactory()
          Get the type factory for date-time objects.
 Comparator<Object> getDefaultComparator()
          Get the comparator that should be used by default.
 String getDefaultType()
          Get the name of the type that is used by default.
 TypeSystem.TypeFactory<Double> getDoubleFactory()
          Get the type factory for double types.
 TypeSystem.TypeFactory<Long> getLongFactory()
          Get the type factory for long types.
 TypeSystem.TypeFactory<?> getPathFactory()
          Get the type factory for path objects.
 TypeSystem.TypeFactory<String> getStringFactory()
          Get the type factory for string types.
 TypeSystem.TypeFactory<?> getTypeFactory(Object prototype)
          Get the type factory for the type denoted by the supplied prototype value.
 TypeSystem.TypeFactory<?> getTypeFactory(String typeName)
          Get the type factory given the name of the type.
 Set<String> getTypeNames()
          Get the names of the supported types.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValueTypeSystem

public ValueTypeSystem(ValueFactories valueFactories)
Create a type system using the supplied value factories.

Parameters:
valueFactories - the value factories;
Throws:
IllegalArgumentException - if the value factories are null
Method Detail

asString

public String asString(Object value)
Get the string representation of the supplied value, using the most appropriate factory given the value.

Specified by:
asString in interface TypeSystem
Parameters:
value - the value
Returns:
the string representation; never null
See Also:
TypeSystem.asString(java.lang.Object)

getBooleanFactory

public TypeSystem.TypeFactory<Boolean> getBooleanFactory()
Get the type factory for boolean types.

Specified by:
getBooleanFactory in interface TypeSystem
Returns:
the boolean factory; never null
See Also:
TypeSystem.getBooleanFactory()

getStringFactory

public TypeSystem.TypeFactory<String> getStringFactory()
Get the type factory for string types.

Specified by:
getStringFactory in interface TypeSystem
Returns:
the string factory; never null
See Also:
TypeSystem.getStringFactory()

getDateTimeFactory

public TypeSystem.TypeFactory<?> getDateTimeFactory()
Get the type factory for date-time objects.

Specified by:
getDateTimeFactory in interface TypeSystem
Returns:
the date-time factory, or null if this type system doesn't support date-time objects
See Also:
TypeSystem.getDateTimeFactory()

getDefaultType

public String getDefaultType()
Get the name of the type that is used by default.

Specified by:
getDefaultType in interface TypeSystem
Returns:
the default type name; never null
See Also:
TypeSystem.getDefaultType()

getDefaultComparator

public Comparator<Object> getDefaultComparator()
Get the comparator that should be used by default.

Specified by:
getDefaultComparator in interface TypeSystem
Returns:
the default comparator; never null
See Also:
TypeSystem.getDefaultComparator()

getDoubleFactory

public TypeSystem.TypeFactory<Double> getDoubleFactory()
Get the type factory for double types.

Specified by:
getDoubleFactory in interface TypeSystem
Returns:
the double factory; never null
See Also:
TypeSystem.getDoubleFactory()

getLongFactory

public TypeSystem.TypeFactory<Long> getLongFactory()
Get the type factory for long types.

Specified by:
getLongFactory in interface TypeSystem
Returns:
the long factory; never null
See Also:
TypeSystem.getLongFactory()

getPathFactory

public TypeSystem.TypeFactory<?> getPathFactory()
Get the type factory for path objects.

Specified by:
getPathFactory in interface TypeSystem
Returns:
the path factory, or null if this type system doesn't support path objects
See Also:
TypeSystem.getPathFactory()

getBinaryFactory

public TypeSystem.TypeFactory<?> getBinaryFactory()
Get the type factory for binary objects.

Specified by:
getBinaryFactory in interface TypeSystem
Returns:
the binary factory, or null if this type system doesn't support binary objects
See Also:
TypeSystem.getBinaryFactory()

getTypeFactory

public TypeSystem.TypeFactory<?> getTypeFactory(String typeName)
Get the type factory given the name of the type.

Specified by:
getTypeFactory in interface TypeSystem
Parameters:
typeName - the name of the type
Returns:
the type factory, or null if there is no such type in this system
See Also:
TypeSystem.getTypeFactory(java.lang.String)

getTypeFactory

public TypeSystem.TypeFactory<?> getTypeFactory(Object prototype)
Get the type factory for the type denoted by the supplied prototype value.

Specified by:
getTypeFactory in interface TypeSystem
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
See Also:
TypeSystem.getTypeFactory(java.lang.Object)

getTypeNames

public Set<String> getTypeNames()
Get the names of the supported types.

Specified by:
getTypeNames in interface TypeSystem
Returns:
the immutable set of the uppercase names of the types; never null
See Also:
TypeSystem.getTypeNames()

getCompatibleType

public String getCompatibleType(String type1,
                                String type2)
Get the type that is compatible with both of the supplied types.

Specified by:
getCompatibleType in interface TypeSystem
Parameters:
type1 - the first type; may be null
type2 - the second type; may be null
Returns:
the compatible type; never null
See Also:
TypeSystem.getCompatibleType(java.lang.String, java.lang.String)


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