Package org.apache.openjpa.meta
Class JavaTypes
java.lang.Object
org.apache.openjpa.meta.JavaTypes
- Direct Known Subclasses:
JavaSQLTypes
Type constants for managed fields.
- Author:
- Abe White
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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, ClassMetaData context, ClassLoader loader, boolean mustExist) 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 Class<?>
classForName
(String name, ValueMetaData context, ClassLoader loader, boolean mustExist) Try to load a class using the provided loader.static Object
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
isPrimitiveDefault
(Object o, int typeCode) Determine whether or not the provided Object value is the default for the provided typeCode.static boolean
maybePC
(FieldMetaData field) Return true if the (possibly unresolved) field or its elements might be persistence capable objects.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 <T> List<T>
Helper method to return the given array value as a collection.
-
Field Details
-
BOOLEAN
public static final int BOOLEAN- See Also:
-
BYTE
public static final int BYTE- See Also:
-
CHAR
public static final int CHAR- See Also:
-
DOUBLE
public static final int DOUBLE- See Also:
-
FLOAT
public static final int FLOAT- See Also:
-
INT
public static final int INT- See Also:
-
LONG
public static final int LONG- See Also:
-
SHORT
public static final int SHORT- See Also:
-
OBJECT
public static final int OBJECT- See Also:
-
STRING
public static final int STRING- See Also:
-
NUMBER
public static final int NUMBER- See Also:
-
ARRAY
public static final int ARRAY- See Also:
-
COLLECTION
public static final int COLLECTION- See Also:
-
MAP
public static final int MAP- See Also:
-
DATE
public static final int DATE- See Also:
-
PC
public static final int PC- See Also:
-
BOOLEAN_OBJ
public static final int BOOLEAN_OBJ- See Also:
-
BYTE_OBJ
public static final int BYTE_OBJ- See Also:
-
CHAR_OBJ
public static final int CHAR_OBJ- See Also:
-
DOUBLE_OBJ
public static final int DOUBLE_OBJ- See Also:
-
FLOAT_OBJ
public static final int FLOAT_OBJ- See Also:
-
INT_OBJ
public static final int INT_OBJ- See Also:
-
LONG_OBJ
public static final int LONG_OBJ- See Also:
-
SHORT_OBJ
public static final int SHORT_OBJ- See Also:
-
BIGDECIMAL
public static final int BIGDECIMAL- See Also:
-
BIGINTEGER
public static final int BIGINTEGER- See Also:
-
LOCALE
public static final int LOCALE- See Also:
-
PC_UNTYPED
public static final int PC_UNTYPED- See Also:
-
CALENDAR
public static final int CALENDAR- See Also:
-
OID
public static final int OID- See Also:
-
INPUT_STREAM
public static final int INPUT_STREAM- See Also:
-
INPUT_READER
public static final int INPUT_READER- See Also:
-
ENUM
public static final int ENUM- See Also:
-
LOCAL_DATE
public static final int LOCAL_DATE- See Also:
-
LOCAL_TIME
public static final int LOCAL_TIME- See Also:
-
LOCAL_DATETIME
public static final int LOCAL_DATETIME- See Also:
-
OFFSET_TIME
public static final int OFFSET_TIME- See Also:
-
OFFSET_DATETIME
public static final int OFFSET_DATETIME- See Also:
-
-
Constructor Details
-
JavaTypes
public JavaTypes()
-
-
Method Details
-
getTypeCode
Return the field metadata type code for the given class. First class objects are not recognized in this method. -
classForName
Check the given name against the same set of standard packages used when parsing metadata. -
classForName
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, boolean mustExist) Check the given name against the same set of standard packages used when parsing metadata.- Parameters:
mustExist
- Whether the supplied loader must be able to load the class. If true no attempt to use a different classloader will be made. If false the ClassResolver from the configuration will be used.
-
classForName
Check the given name against the same set of standard packages used when parsing metadata. -
classForName
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, boolean mustExist) Try to load a class using the provided loader. Optionally tries the configuration's ClassResolver if the supplied loader cannot find the class.- Parameters:
name
- Name of the class to load.loader
- ClassLoader to use. If null, the configuration's ClassResolver will be used.mustExist
- Whether the supplied loader must be able to load the class. If true no attempt to use a different classloader will be made. If false the ClassResolver from the configuration will be used.
-
convert
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 aNumber
. If no known conversion or the value is null, returns the original value. -
maybePC
Return true if the (possibly unresolved) field or its elements might be persistence capable objects. -
maybePC
Return true if the (possibly unresolved) value might be a first class object. -
toList
Helper method to return the given array value as a collection. -
toArray
Helper method to return the given collection as an array. -
isPrimitiveDefault
Determine whether or not the provided Object value is the default for the provided typeCode. For example: If o = Integer(0) and typeCode = JavaTypes.INT, this method will return true.
-