org.apache.openjpa.meta
Class JavaTypes

java.lang.Object
  extended by org.apache.openjpa.meta.JavaTypes
Direct Known Subclasses:
JavaSQLTypes

public class JavaTypes
extends Object

Type constants for managed fields.

Author:
Abe White

Field Summary
static int ARRAY
           
static int BIGDECIMAL
           
static int BIGINTEGER
           
static int BOOLEAN
           
static int BOOLEAN_OBJ
           
static int BYTE
           
static int BYTE_OBJ
           
static int CALENDAR
           
static int CHAR
           
static int CHAR_OBJ
           
static int COLLECTION
           
static int DATE
           
static int DOUBLE
           
static int DOUBLE_OBJ
           
static int ENUM
           
static int FLOAT
           
static int FLOAT_OBJ
           
static int INPUT_READER
           
static int INPUT_STREAM
           
static int INT
           
static int INT_OBJ
           
static int LOCALE
           
static int LONG
           
static int LONG_OBJ
           
static int MAP
           
static int NUMBER
           
static int OBJECT
           
static int OID
           
static int PC
           
static int PC_UNTYPED
           
static int SHORT
           
static int SHORT_OBJ
           
static int STRING
           
 
Constructor Summary
JavaTypes()
           
 
Method Summary
static Class<?> classForName(String name, ClassMetaData context)
          Check the given name against the same set of standard packages used when parsing metadata.
static Class<?> classForName(String name, ClassMetaData context, ClassLoader loader)
          Check the given name against the same set of standard packages used when parsing metadata.
static Class<?> classForName(String name, ValueMetaData context)
          Check the given name against the same set of standard packages used when parsing metadata.
static Class<?> classForName(String name, ValueMetaData context, ClassLoader loader)
          Check the given name against the same set of standard packages used when parsing metadata.
static Object convert(Object val, int typeCode)
          Convert the given object to the given type if possible.
static int getTypeCode(Class<?> type)
          Return the field metadata type code for the given class.
static boolean maybePC(FieldMetaData field)
          Return true if the (possibly unresolved) field or its elements might be persistence capable objects.
(package private) static boolean maybePC(int typeCode, Class<?> type)
          Return true if the given unresolved typecode/type pair may represent a persistent object.
static boolean maybePC(ValueMetaData val)
          Return true if the (possibly unresolved) value might be a first class object.
static Object toArray(Collection<?> coll, Class<?> elem)
          Helper method to return the given collection as an array.
static List toList(Object val, Class<?> elem, boolean mutable)
          Helper method to return the given array value as a collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BOOLEAN

public static final int BOOLEAN
See Also:
Constant Field Values

BYTE

public static final int BYTE
See Also:
Constant Field Values

CHAR

public static final int CHAR
See Also:
Constant Field Values

DOUBLE

public static final int DOUBLE
See Also:
Constant Field Values

FLOAT

public static final int FLOAT
See Also:
Constant Field Values

INT

public static final int INT
See Also:
Constant Field Values

LONG

public static final int LONG
See Also:
Constant Field Values

SHORT

public static final int SHORT
See Also:
Constant Field Values

OBJECT

public static final int OBJECT
See Also:
Constant Field Values

STRING

public static final int STRING
See Also:
Constant Field Values

NUMBER

public static final int NUMBER
See Also:
Constant Field Values

ARRAY

public static final int ARRAY
See Also:
Constant Field Values

COLLECTION

public static final int COLLECTION
See Also:
Constant Field Values

MAP

public static final int MAP
See Also:
Constant Field Values

DATE

public static final int DATE
See Also:
Constant Field Values

PC

public static final int PC
See Also:
Constant Field Values

BOOLEAN_OBJ

public static final int BOOLEAN_OBJ
See Also:
Constant Field Values

BYTE_OBJ

public static final int BYTE_OBJ
See Also:
Constant Field Values

CHAR_OBJ

public static final int CHAR_OBJ
See Also:
Constant Field Values

DOUBLE_OBJ

public static final int DOUBLE_OBJ
See Also:
Constant Field Values

FLOAT_OBJ

public static final int FLOAT_OBJ
See Also:
Constant Field Values

INT_OBJ

public static final int INT_OBJ
See Also:
Constant Field Values

LONG_OBJ

public static final int LONG_OBJ
See Also:
Constant Field Values

SHORT_OBJ

public static final int SHORT_OBJ
See Also:
Constant Field Values

BIGDECIMAL

public static final int BIGDECIMAL
See Also:
Constant Field Values

BIGINTEGER

public static final int BIGINTEGER
See Also:
Constant Field Values

LOCALE

public static final int LOCALE
See Also:
Constant Field Values

PC_UNTYPED

public static final int PC_UNTYPED
See Also:
Constant Field Values

CALENDAR

public static final int CALENDAR
See Also:
Constant Field Values

OID

public static final int OID
See Also:
Constant Field Values

INPUT_STREAM

public static final int INPUT_STREAM
See Also:
Constant Field Values

INPUT_READER

public static final int INPUT_READER
See Also:
Constant Field Values

ENUM

public static final int ENUM
See Also:
Constant Field Values
Constructor Detail

JavaTypes

public JavaTypes()
Method Detail

getTypeCode

public static int getTypeCode(Class<?> type)
Return the field metadata type code for the given class. First class objects are not recognized in this method.


classForName

public static Class<?> classForName(String name,
                                    ClassMetaData context)
Check the given name against the same set of standard packages used when parsing metadata.


classForName

public static Class<?> classForName(String name,
                                    ClassMetaData context,
                                    ClassLoader loader)
Check the given name against the same set of standard packages used when parsing metadata.


classForName

public static Class<?> classForName(String name,
                                    ValueMetaData context)
Check the given name against the same set of standard packages used when parsing metadata.


classForName

public static Class<?> classForName(String name,
                                    ValueMetaData context,
                                    ClassLoader loader)
Check the given name against the same set of standard packages used when parsing metadata.


convert

public static Object convert(Object val,
                             int typeCode)
Convert the given object to the given type if possible. If the type is a numeric primitive, this method only guarantees that the return value is a Number. If no known conversion or the value is null, returns the original value.


maybePC

public static boolean maybePC(FieldMetaData field)
Return true if the (possibly unresolved) field or its elements might be persistence capable objects.


maybePC

public static boolean maybePC(ValueMetaData val)
Return true if the (possibly unresolved) value might be a first class object.


maybePC

static boolean maybePC(int typeCode,
                       Class<?> type)
Return true if the given unresolved typecode/type pair may represent a persistent object.


toList

public static List toList(Object val,
                          Class<?> elem,
                          boolean mutable)
Helper method to return the given array value as a collection.


toArray

public static Object toArray(Collection<?> coll,
                             Class<?> elem)
Helper method to return the given collection as an array.



Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.