cc.plural.jsonij.marshal
Enum JavaType

java.lang.Object
  extended by java.lang.Enum<JavaType>
      extended by cc.plural.jsonij.marshal.JavaType
All Implemented Interfaces:
Serializable, Comparable<JavaType>

public enum JavaType
extends Enum<JavaType>

JavaType Utility. Queries objects for their types and manages inspector instances so time is not wasted re-inspecting the same objects. Inspecting is the task of reflecting attributes and methods and their types for access.

Author:
jmarsden@plural.cc

Nested Class Summary
static class JavaType.JavaArrayType
           
 
Enum Constant Summary
ARRAY
           
ARRAY_ARRAY
           
ARRAY_BOOLEAN
           
ARRAY_BYTE
           
ARRAY_DOUBLE
           
ARRAY_ENUM
           
ARRAY_FLOAT
           
ARRAY_INTEGER
           
ARRAY_LIST
           
ARRAY_LONG
           
ARRAY_MAP
           
ARRAY_SHORT
           
ARRAY_STRING
           
BOOLEAN
          The JavaTypes possible for an inspection.
BYTE
           
DOUBLE
           
ENUM
           
FLOAT
           
INTEGER
           
LIST
           
LONG
           
MAP
           
OBJECT
           
SHORT
           
STRING
           
UNKOWN
           
 
Field Summary
protected static Map<Class<?>,Inspector> inspectedClasses
           
 
Method Summary
static JavaType getArrayType(Class<?> objectClass)
           
static Inspector getInstpector(Class<?> objectClass)
           
static JavaType inspectObjectType(Class<?> c)
           
static boolean isObjectType(Class<?> objectClass)
           
 boolean isPrimitive()
           
 void setPrimitive(boolean primitive)
           
static JavaType valueOf(String name)
          Returns the enum constant of this type with the specified name.
static JavaType[] 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 JavaType BOOLEAN
The JavaTypes possible for an inspection. UNKNOWN will be returned where an object cannot be decided. ARRAY will be returned for an array of Objects.


BYTE

public static final JavaType BYTE

SHORT

public static final JavaType SHORT

INTEGER

public static final JavaType INTEGER

FLOAT

public static final JavaType FLOAT

DOUBLE

public static final JavaType DOUBLE

LONG

public static final JavaType LONG

STRING

public static final JavaType STRING

LIST

public static final JavaType LIST

OBJECT

public static final JavaType OBJECT

MAP

public static final JavaType MAP

ENUM

public static final JavaType ENUM

ARRAY

public static final JavaType ARRAY

ARRAY_BOOLEAN

public static final JavaType ARRAY_BOOLEAN

ARRAY_BYTE

public static final JavaType ARRAY_BYTE

ARRAY_SHORT

public static final JavaType ARRAY_SHORT

ARRAY_INTEGER

public static final JavaType ARRAY_INTEGER

ARRAY_FLOAT

public static final JavaType ARRAY_FLOAT

ARRAY_DOUBLE

public static final JavaType ARRAY_DOUBLE

ARRAY_LONG

public static final JavaType ARRAY_LONG

ARRAY_STRING

public static final JavaType ARRAY_STRING

ARRAY_ENUM

public static final JavaType ARRAY_ENUM

ARRAY_LIST

public static final JavaType ARRAY_LIST

ARRAY_MAP

public static final JavaType ARRAY_MAP

ARRAY_ARRAY

public static final JavaType ARRAY_ARRAY

UNKOWN

public static final JavaType UNKOWN
Field Detail

inspectedClasses

protected static final Map<Class<?>,Inspector> inspectedClasses
Method Detail

values

public static final JavaType[] 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(JavaType c : JavaType.values())
        System.out.println(c);

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

valueOf

public static JavaType 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

setPrimitive

public void setPrimitive(boolean primitive)

isPrimitive

public boolean isPrimitive()

inspectObjectType

public static JavaType inspectObjectType(Class<?> c)

getInstpector

public static Inspector getInstpector(Class<?> objectClass)

isObjectType

public static boolean isObjectType(Class<?> objectClass)

getArrayType

public static JavaType getArrayType(Class<?> objectClass)


Copyright © 2012. All Rights Reserved.