|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.exolab.castor.mapping.loader.Types
public class Types
Type information. Can be used to map between short type names (such as 'int') and actual Java types (java.lang.Integer), to determine whether a type is simple (i.e. maps to a single XML attribute, SQL column, etc), as well as to create a new instance of a type.
| Constructor Summary | |
|---|---|
Types()
|
|
| Method Summary | |
|---|---|
static void |
addConvertibleType(Class<?> type)
|
static void |
addEnumType(Class<?> type)
|
static Object |
getDefault(Class<?> type)
Returns the default value for this Java type (e.g. 0 for integer, empty string) or null if no default value is known. |
static boolean |
isCloneable(Class<?> type)
Returns true if the Java type implements the Cloneable
interface. |
static boolean |
isConstructable(Class<?> type)
Returns true if the objects of this class are constructable. |
static boolean |
isConstructable(Class<?> type,
boolean allowAbstractOrInterface)
Returns true if the objects of this class are constructable. |
static boolean |
isConvertibleType(Class<?> type)
|
static boolean |
isEnumType(Class<?> type)
|
static boolean |
isImmutable(Class<?> type)
Returns true if the Java type is immutable. |
static boolean |
isPrimitiveType(Class<?> type)
Returns true if the Java type is represented as a primitive type. |
static boolean |
isSerializable(Class<?> type)
Returns true if the Java type implements the Serializable
interface. |
static boolean |
isSimpleType(Class<?> type)
Returns true if the Java type is represented as a simple type. |
static Object |
newInstance(Class<?> type)
Constructs a new object from the given class. |
static Object |
newInstance(Class<?> type,
Object[] args)
Constructs a new object from the given class. |
static Class<?> |
typeFromName(ClassLoader loader,
String typeName)
Returns the class name based on the supplied type name. |
static Class<?> |
typeFromPrimitive(Class<?> type)
Maps from a primitive Java type to a Java class. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Types()
| Method Detail |
|---|
public static Class<?> typeFromName(ClassLoader loader,
String typeName)
throws ClassNotFoundException
loader - The class loader to use, may be nulltypeName - The type name
ClassNotFoundException - The specified class could not be foundpublic static Object getDefault(Class<?> type)
type - The Java type
public static Class<?> typeFromPrimitive(Class<?> type)
From To -------------- --------------- Boolean.TYPE Boolean.class Byte.TYPE Byte.class Character.TYPE Character.class Short.TYPE Short.class Integer.TYPE Integer.class Long.TYPE Long.class Float.TYPE Float.class Double.TYPE Double.class
type - The Java type (primitive or not)
public static boolean isSimpleType(Class<?> type)
type - The Java type
public static boolean isPrimitiveType(Class<?> type)
type - The Java type
public static void addEnumType(Class<?> type)
public static boolean isEnumType(Class<?> type)
public static void addConvertibleType(Class<?> type)
public static boolean isConvertibleType(Class<?> type)
public static Object newInstance(Class<?> type)
throws IllegalStateException
type - The class type of the object instance to be constructed.
IllegalStateException - The Java object cannot be constructed
public static Object newInstance(Class<?> type,
Object[] args)
throws IllegalStateException
type - The class type of the object instance to be constructed.args - Arguments to be supplied to constructor call.
IllegalStateException - The Java object cannot be constructedpublic static boolean isConstructable(Class<?> type)
type - The Java type
public static boolean isConstructable(Class<?> type,
boolean allowAbstractOrInterface)
allowAbstractOrInterface - True to indicate that abstract classes of interfaces are allowed.type - The Java type
public static boolean isSerializable(Class<?> type)
Serializable
interface.
type - The Java type
public static boolean isImmutable(Class<?> type)
type - The Java type
public static boolean isCloneable(Class<?> type)
Cloneable
interface.
type - The Java type
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||