net.sf.navel.beans
Enum PrimitiveSupport

java.lang.Object
  extended by java.lang.Enum<PrimitiveSupport>
      extended by net.sf.navel.beans.PrimitiveSupport
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<PrimitiveSupport>

public enum PrimitiveSupport
extends java.lang.Enum<PrimitiveSupport>

A utility class for dealing with properties of primitive types, including arrays of primitives, which can be very tricky to reflect correctly.

Author:
cmdln

Enum Constant Summary
BOOLEAN
           
BYTE
           
CHARACTER
           
DOUBLE
           
FLOAT
           
INTEGER
           
LONG
           
SHORT
           
 
Method Summary
 java.lang.Object getDefaultValue()
           
static PrimitiveSupport getForPrimitive(java.lang.Class<?> primitiveType)
          Lookup for when the caller has the primitive type and needs access to the members of the associated enum.
static PrimitiveSupport getForWrapper(java.lang.Class<?> wrapperType)
          Lookup for when the caller has the wrapper type and needs access to the members of the associated enum.
 java.lang.Class<?> getPrimitiveType()
           
 java.lang.Class<?> getWrapperType()
           
static PrimitiveSupport valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static PrimitiveSupport[] values()
          Returns an array containing the constants of this enum type, in the order they're declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

BOOLEAN

public static final PrimitiveSupport BOOLEAN

BYTE

public static final PrimitiveSupport BYTE

CHARACTER

public static final PrimitiveSupport CHARACTER

DOUBLE

public static final PrimitiveSupport DOUBLE

FLOAT

public static final PrimitiveSupport FLOAT

INTEGER

public static final PrimitiveSupport INTEGER

LONG

public static final PrimitiveSupport LONG

SHORT

public static final PrimitiveSupport SHORT
Method Detail

values

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

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

valueOf

public static PrimitiveSupport valueOf(java.lang.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:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name

getForPrimitive

public static PrimitiveSupport getForPrimitive(java.lang.Class<?> primitiveType)
Lookup for when the caller has the primitive type and needs access to the members of the associated enum.

Parameters:
primitiveType - Must be non-null and the class for a primitive type.
Returns:
May be null if there is no associated enum value.

getPrimitiveType

public java.lang.Class<?> getPrimitiveType()
Returns:
The primitive type member for the association between auto-box types.

getWrapperType

public java.lang.Class<?> getWrapperType()
Returns:
The wrapper type member for the association between auto-box types.

getDefaultValue

public java.lang.Object getDefaultValue()
Returns:
Value to use for the uninitialized value of the primitive type member.

getForWrapper

public static PrimitiveSupport getForWrapper(java.lang.Class<?> wrapperType)
Lookup for when the caller has the wrapper type and needs access to the members of the associated enum.

Parameters:
warpperType - May be any type but if not a valid primitive wrapper, null will be returned.
Returns:
May be null if there is no associated enum value.