Classes | Static Public Member Functions | Static Package Attributes

org.exolab.castor.mapping.loader.Types Class Reference

List of all members.

Classes

class  TypeInfo

Static Public Member Functions

static Class typeFromName (ClassLoader loader, String typeName) throws ClassNotFoundException
static Object getDefault (Class type)
static Class typeFromPrimitive (Class type)
static boolean isSimpleType (Class type)
static boolean isPrimitiveType (Class type)
static Object newInstance (Class type) throws IllegalStateException
static Object newInstance (Class type, Object args[]) throws IllegalStateException
static boolean isConstructable (Class type)
static boolean isConstructable (Class type, boolean allowAbstractOrInterface)
static boolean isSerializable (Class type)
static boolean isImmutable (Class type)
static boolean isCloneable (Class type)
static String getFullDatePattern (String pattern)

Static Package Attributes

static TypeInfo[] _typeInfos

Detailed Description

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.

Author:
Assaf Arkin
Version:
Revision:
1.6
Date:
2004/11/26 09:07:49

Member Function Documentation

static Object org.exolab.castor.mapping.loader.Types.getDefault ( Class  type  )  [static]

Returns the default value for this Java type (e.g. 0 for integer, empty string) or null if no default value is known. The default value only applies to primitive types (that is, Integer.TYPE but not java.lang.Integer).

Parameters:
type The Java type
Returns:
The default value or null

References org.exolab.castor.mapping.loader.Types._typeInfos.

static String org.exolab.castor.mapping.loader.Types.getFullDatePattern ( String  pattern  )  [static]

Transforms short date format pattern into full format pattern for SimpleDateFormat (e.g., "YMD" to "yyyyMMdd").

Parameters:
pattern The short pattern
Returns:
The full pattern
static boolean org.exolab.castor.mapping.loader.Types.isCloneable ( Class  type  )  [static]

Returns true if the Java type implements the Cloneable interface.

Parameters:
type The Java type
Returns:
True if declared as cloneable
static boolean org.exolab.castor.mapping.loader.Types.isConstructable ( Class  type  )  [static]

Returns true if the objects of this class are constructable. The class must be publicly available and have a default public constructor.

Parameters:
type The Java type
Returns:
True if constructable
static boolean org.exolab.castor.mapping.loader.Types.isConstructable ( Class  type,
boolean  allowAbstractOrInterface 
) [static]

Returns true if the objects of this class are constructable. The class must be publicly available and have a default public constructor.

Parameters:
type The Java type
Returns:
True if constructable
static boolean org.exolab.castor.mapping.loader.Types.isImmutable ( Class  type  )  [static]

Returns true if the Java type is immutable. Immutable objects are not copied.

Parameters:
type The Java type
Returns:
True if immutable type

References org.exolab.castor.mapping.loader.Types._typeInfos.

static boolean org.exolab.castor.mapping.loader.Types.isPrimitiveType ( Class  type  )  [static]

Returns true if the Java type is represented as a primitive type. Wrapper like java.lang.Integer are considered as primitive.

Parameters:
type The Java type
Returns:
True if a primitive type

References org.exolab.castor.mapping.loader.Types._typeInfos.

static boolean org.exolab.castor.mapping.loader.Types.isSerializable ( Class  type  )  [static]

Returns true if the Java type implements the Serializable interface.

Parameters:
type The Java type
Returns:
True if declared as serializable
static boolean org.exolab.castor.mapping.loader.Types.isSimpleType ( Class  type  )  [static]

Returns true if the Java type is represented as a simple type. A simple can be described with a single XML attribute value, a single SQL column, a single LDAP attribute value, etc. The following types are considered simple:

  • All primitive types
  • String
  • Date
  • java.sql.Date
  • java.sql.Time
  • Timestamp
  • byte/char arrays
  • BigDecimal
Parameters:
type The Java type
Returns:
True if a simple type

References org.exolab.castor.mapping.loader.Types._typeInfos.

static Object org.exolab.castor.mapping.loader.Types.newInstance ( Class  type,
Object  args[] 
) throws IllegalStateException [static]

Constructs a new object from the given class. Does not generate any checked exceptions, since object creation has been proven to work when creating descriptor from mapping.

Exceptions:
IllegalStateException The Java object cannot be constructed

References org.exolab.castor.mapping.loader.Types.newInstance().

static Object org.exolab.castor.mapping.loader.Types.newInstance ( Class  type  )  throws IllegalStateException [static]

Constructs a new object from the given class. Does not generate any checked exceptions, since object creation has been proven to work when creating descriptor from mapping.

Exceptions:
IllegalStateException The Java object cannot be constructed

Referenced by org.exolab.castor.mapping.loader.Types.newInstance().

static Class org.exolab.castor.mapping.loader.Types.typeFromName ( ClassLoader  loader,
String  typeName 
) throws ClassNotFoundException [static]

Returns the class name based on the supplied type name. The type name can be a short name (e.g. int, byte) or any other Java class (e.g. myapp.Product). If a short type name is used, the primitive type might be returned. If a Java class name is used, the class will be loaded and returned through the supplied class loader.

Parameters:
loader The class loader to use, may be null
typeName The type name
Returns:
The type class
Exceptions:
ClassNotFoundException The specified class could not be found

References org.exolab.castor.mapping.loader.Types._typeInfos.

static Class org.exolab.castor.mapping.loader.Types.typeFromPrimitive ( Class  type  )  [static]

Maps from a primitive Java type to a Java class. Returns the same class if type is not a primitive. The following conversion applies:

 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
 
Parameters:
type The Java type (primitive or not)
Returns:
A comparable non-primitive Java type

Fix for arrays

end fix

References org.exolab.castor.mapping.loader.Types._typeInfos.


Member Data Documentation


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties