org.modeshape.graph.property
Class ValueTypeSystem.Factory<T>

java.lang.Object
  extended by org.modeshape.graph.property.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
protected  PropertyType type
           
protected  String typeName
           
protected  ValueFactory<T> valueFactory
           
 
Constructor Summary
protected ValueTypeSystem.Factory(ValueFactory<T> valueFactory)
           
 
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.
 
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)
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
See Also:
TypeSystem.TypeFactory.asReadableString(java.lang.Object)

asString

public String asString(Object value)
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
See Also:
TypeSystem.TypeFactory.asString(java.lang.Object)

create

public T create(String value)
         throws ValueFormatException
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
See Also:
TypeSystem.TypeFactory.create(java.lang.String)

create

public T create(Object value)
         throws ValueFormatException
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
See Also:
TypeSystem.TypeFactory.create(java.lang.Object)

getType

public Class<T> getType()
Get the class representing the value type.

Specified by:
getType in interface TypeSystem.TypeFactory<T>
Returns:
the value type; never null
See Also:
TypeSystem.TypeFactory.getType()

length

public long length(Object value)
Get the length of the supplied value.

Specified by:
length in interface TypeSystem.TypeFactory<T>
Parameters:
value - the value
Returns:
the length; never negative
See Also:
TypeSystem.TypeFactory.length(java.lang.Object)

getComparator

public Comparator<T> getComparator()
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
See Also:
TypeSystem.TypeFactory.getComparator()

getTypeName

public String getTypeName()
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
See Also:
TypeSystem.TypeFactory.getTypeName()


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