org.modeshape.graph.property
Enum PropertyType

java.lang.Object
  extended by java.lang.Enum<PropertyType>
      extended by org.modeshape.graph.property.PropertyType
All Implemented Interfaces:
Serializable, Comparable<PropertyType>

@Immutable
public enum PropertyType
extends Enum<PropertyType>

The data types for property values.


Nested Class Summary
protected static class PropertyType.DoubleCanonicalizer
           
protected static class PropertyType.LongCanonicalizer
           
protected static class PropertyType.ObjectCanonicalizer
           
 
Enum Constant Summary
BINARY
           
BOOLEAN
           
DATE
           
DECIMAL
           
DOUBLE
           
LONG
           
NAME
           
OBJECT
           
PATH
           
REFERENCE
           
STRING
           
URI
           
UUID
           
 
Method Summary
static PropertyType discoverType(Class<?> clazz)
          Discover the most appropriate PropertyType whose values can be assigned to variables or parameters of the supplied type.
static PropertyType discoverType(Object value)
           
 Object getCanonicalValue(Object value)
          Obtain a value of this type in its canonical form.
 Comparator<?> getComparator()
           
 String getName()
           
 Class<?> getValueClass()
           
 boolean isTypeFor(Object value)
           
 boolean isTypeForEach(Iterable<?> values)
           
 boolean isTypeForEach(Iterator<?> values)
           
static Iterator<PropertyType> iterator()
          Return an iterator over all the property type enumeration literals.
static PropertyType valueOf(String name)
          Returns the enum constant of this type with the specified name.
static PropertyType[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

STRING

public static final PropertyType STRING

BINARY

public static final PropertyType BINARY

LONG

public static final PropertyType LONG

DOUBLE

public static final PropertyType DOUBLE

DECIMAL

public static final PropertyType DECIMAL

DATE

public static final PropertyType DATE

BOOLEAN

public static final PropertyType BOOLEAN

NAME

public static final PropertyType NAME

PATH

public static final PropertyType PATH

UUID

public static final PropertyType UUID

REFERENCE

public static final PropertyType REFERENCE

URI

public static final PropertyType URI

OBJECT

public static final PropertyType OBJECT
Method Detail

values

public static PropertyType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (PropertyType c : PropertyType.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static PropertyType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

getValueClass

public Class<?> getValueClass()

getName

public String getName()

getComparator

public Comparator<?> getComparator()

getCanonicalValue

public Object getCanonicalValue(Object value)
Obtain a value of this type in its canonical form. Some property types allow values to be instances of the canonical class or an alternative class. This method ensures that the value is always an instance of the canonical class.

Note that this method does not cast from one property type to another.

Parameters:
value - the property value
Returns:
the value in canonical form

isTypeFor

public final boolean isTypeFor(Object value)

isTypeForEach

public final boolean isTypeForEach(Iterable<?> values)

isTypeForEach

public final boolean isTypeForEach(Iterator<?> values)

discoverType

public static PropertyType discoverType(Object value)

discoverType

public static PropertyType discoverType(Class<?> clazz)
Discover the most appropriate PropertyType whose values can be assigned to variables or parameters of the supplied type. This method does check whether the supplied Class is an array, in which case it just evalutes the component type of the array.

Parameters:
clazz - the class representing the type of a value or parameter; may not be null
Returns:
the PropertyType that best represents the type whose values can be used as a value in the supplied class, or null if no matching PropertyType could be found

iterator

public static Iterator<PropertyType> iterator()
Return an iterator over all the property type enumeration literals.

Returns:
an immutable iterator


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