org.deduced
Class BasicTypes

java.lang.Object
  extended by org.deduced.BasicTypes

public class BasicTypes
extends java.lang.Object

Class holding the constants of all the basic property types

Author:
Steve McDuff

Field Summary
static PropertyTypeHolder BIG_DECIMAL_TYPE
          Basic type that represents a big decimal
static PropertyTypeHolder BIG_INTEGER_TYPE
          Basic type that represents a big integer
static PropertyTypeHolder BOOLEAN_TYPE
          Basic type that represents a boolean
static PropertyTypeHolder BYTE_TYPE
          Basic type that represents a byte
static PropertyTypeHolder CALENDAR_TYPE
          Basic type that represents a calendar
static PropertyTypeHolder CHARACTER_TYPE
          Basic type that represents a character
private static java.util.Map<java.lang.Class<?>,PropertyCollection<?,?>> CLASS_TO_TYPE_MAP
          class to type map
static PropertyTypeHolder DOUBLE_TYPE
          Basic type that represents a double floating point value
static PropertyTypeHolder FLOAT_TYPE
          Basic type that represents a floating point value
static PropertyTypeHolder INTEGER_TYPE
          Basic type that represents an integer
static PropertyTypeHolder LONG_TYPE
          Basic type that represents a long
static PropertyTypeHolder NUMBER_TYPE
          Basic type that represents a number
static PropertyTypeHolder OBJECT_TYPE
          Basic type that identifies a standard Object
static PropertyTypeHolder SHORT_TYPE
          Basic type that represents a short
static PropertyTypeHolder STRING_TYPE
          Basic type that represents a string
private static java.util.Map<PropertyCollection<?,?>,java.lang.Class<?>> TYPE_TO_CLASS_MAP
          type to class map
static PropertyTypeHolder VOID_TYPE
          Basic type that identifies a void type
 
Constructor Summary
BasicTypes()
           
 
Method Summary
private static void associatedTypeAndClass(PropertyCollection<?,?> type, java.lang.Class<?> javaClass)
          associatedTypeAndClass
static java.lang.Class<?> getClassFromType(PropertyCollection<?,?> typeToMatch)
          Find the java class associated with a property type.
static java.lang.Class<?> getNativeClassFromType(PropertyCollection<?,?> typeToMatch)
          fetch the java native class for a specified type.
static PropertyCollection<?,?> getTypeFromClass(java.lang.Class<?> classToMatch)
          find a property type from a Java Class.
static void initialize()
          initialize the class to map association
static boolean isTypeNative(PropertyCollection<?,?> typeToMatch)
          test to see if a type is native or not.
static boolean isTypeNumeric(PropertyCollection<?,?> type)
          test if a type is numeric
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OBJECT_TYPE

public static final PropertyTypeHolder OBJECT_TYPE
Basic type that identifies a standard Object


VOID_TYPE

public static final PropertyTypeHolder VOID_TYPE
Basic type that identifies a void type


STRING_TYPE

public static final PropertyTypeHolder STRING_TYPE
Basic type that represents a string


BOOLEAN_TYPE

public static final PropertyTypeHolder BOOLEAN_TYPE
Basic type that represents a boolean


INTEGER_TYPE

public static final PropertyTypeHolder INTEGER_TYPE
Basic type that represents an integer


LONG_TYPE

public static final PropertyTypeHolder LONG_TYPE
Basic type that represents a long


SHORT_TYPE

public static final PropertyTypeHolder SHORT_TYPE
Basic type that represents a short


BYTE_TYPE

public static final PropertyTypeHolder BYTE_TYPE
Basic type that represents a byte


CHARACTER_TYPE

public static final PropertyTypeHolder CHARACTER_TYPE
Basic type that represents a character


FLOAT_TYPE

public static final PropertyTypeHolder FLOAT_TYPE
Basic type that represents a floating point value


DOUBLE_TYPE

public static final PropertyTypeHolder DOUBLE_TYPE
Basic type that represents a double floating point value


NUMBER_TYPE

public static final PropertyTypeHolder NUMBER_TYPE
Basic type that represents a number


CALENDAR_TYPE

public static final PropertyTypeHolder CALENDAR_TYPE
Basic type that represents a calendar


BIG_DECIMAL_TYPE

public static final PropertyTypeHolder BIG_DECIMAL_TYPE
Basic type that represents a big decimal


BIG_INTEGER_TYPE

public static final PropertyTypeHolder BIG_INTEGER_TYPE
Basic type that represents a big integer


TYPE_TO_CLASS_MAP

private static final java.util.Map<PropertyCollection<?,?>,java.lang.Class<?>> TYPE_TO_CLASS_MAP
type to class map


CLASS_TO_TYPE_MAP

private static final java.util.Map<java.lang.Class<?>,PropertyCollection<?,?>> CLASS_TO_TYPE_MAP
class to type map

Constructor Detail

BasicTypes

public BasicTypes()
Method Detail

getClassFromType

public static java.lang.Class<?> getClassFromType(PropertyCollection<?,?> typeToMatch)
Find the java class associated with a property type. For instance, for the deduced.boolean type is associated with the java.lang.Boolean class.

Parameters:
typeToMatch - the type to match. This class should extend the deduced.PropertyType type.
Returns:
the associated java class. If the type can't be matched, the value returned will be null. If the type is a property collection type, then a generic deduced.PropertyCollection class will be returned.

associatedTypeAndClass

private static void associatedTypeAndClass(PropertyCollection<?,?> type,
                                           java.lang.Class<?> javaClass)
associatedTypeAndClass

Parameters:
type - the deduced type
javaClass - the associated java class

initialize

public static void initialize()
initialize the class to map association


getNativeClassFromType

public static java.lang.Class<?> getNativeClassFromType(PropertyCollection<?,?> typeToMatch)
fetch the java native class for a specified type. For instance, the INTEGER_TYPE will return java.lang.Integer.TYPE instead of returning java.lang.Integer.class

Parameters:
typeToMatch - the type to match
Returns:
the java native type.

isTypeNative

public static boolean isTypeNative(PropertyCollection<?,?> typeToMatch)
test to see if a type is native or not. Native types are types such as int, char, double, boolean, string.

Parameters:
typeToMatch - the type to test if it is native
Returns:
true if the type is native.

getTypeFromClass

public static PropertyCollection<?,?> getTypeFromClass(java.lang.Class<?> classToMatch)
find a property type from a Java Class. For instance, the java.lang.Boolean will return the deduced.boolean type. If the class being passed is a property collection, then a generic deduced.PropertyCollection is returned.

Parameters:
classToMatch - the java class to match
Returns:
the deduced property type being used. Returns null if the class being passed as a parameter can't be matched.

isTypeNumeric

public static boolean isTypeNumeric(PropertyCollection<?,?> type)
test if a type is numeric

Parameters:
type - the type to test
Returns:
false if the type is null or not numeric.