com.ibatis.common.beans
Class ClassInfo

java.lang.Object
  extended bycom.ibatis.common.beans.ClassInfo

public class ClassInfo
extends java.lang.Object

This class represents a cached set of class definition information that allows for easy mapping between property names and getter/setter methods.


Field Summary
private static java.util.Map CLASS_INFO_MAP
           
private  java.lang.String className
           
private static java.lang.String[] EMPTY_STRING_ARRAY
           
private  java.util.HashMap getMethods
           
private  java.util.HashMap getTypes
           
private  java.lang.String[] readablePropertyNames
           
private  java.util.HashMap setMethods
           
private  java.util.HashMap setTypes
           
private static java.util.Set SIMPLE_TYPE_SET
           
private  java.lang.String[] writeablePropertyNames
           
 
Constructor Summary
private ClassInfo(java.lang.Class clazz)
           
 
Method Summary
private  void addMethods(java.lang.Class cls)
           
private static java.lang.String dropCase(java.lang.String name)
           
 java.lang.String getClassName()
          Gets the name of the class the instance provides information for
 java.lang.reflect.Method getGetter(java.lang.String propertyName)
          Gets the getter for a property as a Method object
 java.lang.Class getGetterType(java.lang.String propertyName)
          Gets the type for a property getter
static ClassInfo getInstance(java.lang.Class clazz)
          Gets an instance of ClassInfo for the specified class.
 java.lang.String[] getReadablePropertyNames()
          Gets an array of the readable properties for an object
 java.lang.reflect.Method getSetter(java.lang.String propertyName)
          Gets the setter for a property as a Method object
 java.lang.Class getSetterType(java.lang.String propertyName)
          Gets the type for a property setter
 java.lang.String[] getWriteablePropertyNames()
          Gets an array of the writeable properties for an object
 boolean hasReadableProperty(java.lang.String propertyName)
          Check to see if a class has a readable property by name
 boolean hasWritableProperty(java.lang.String propertyName)
          Check to see if a class has a writeable property by name
static boolean isKnownType(java.lang.Class clazz)
          Tells us if the class passed in is a knwon common type
static java.lang.Throwable unwrapThrowable(java.lang.Throwable t)
          Examines a Throwable object and gets it's root cause
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_STRING_ARRAY

private static final java.lang.String[] EMPTY_STRING_ARRAY

SIMPLE_TYPE_SET

private static final java.util.Set SIMPLE_TYPE_SET

CLASS_INFO_MAP

private static final java.util.Map CLASS_INFO_MAP

className

private java.lang.String className

readablePropertyNames

private java.lang.String[] readablePropertyNames

writeablePropertyNames

private java.lang.String[] writeablePropertyNames

setMethods

private java.util.HashMap setMethods

getMethods

private java.util.HashMap getMethods

setTypes

private java.util.HashMap setTypes

getTypes

private java.util.HashMap getTypes
Constructor Detail

ClassInfo

private ClassInfo(java.lang.Class clazz)
Method Detail

addMethods

private void addMethods(java.lang.Class cls)

dropCase

private static java.lang.String dropCase(java.lang.String name)

getClassName

public java.lang.String getClassName()
Gets the name of the class the instance provides information for

Returns:
The class name

getSetter

public java.lang.reflect.Method getSetter(java.lang.String propertyName)
Gets the setter for a property as a Method object

Parameters:
propertyName - - the property
Returns:
The Method

getGetter

public java.lang.reflect.Method getGetter(java.lang.String propertyName)
Gets the getter for a property as a Method object

Parameters:
propertyName - - the property
Returns:
The Method

getSetterType

public java.lang.Class getSetterType(java.lang.String propertyName)
Gets the type for a property setter

Parameters:
propertyName - - the name of the property
Returns:
The Class of the propery setter

getGetterType

public java.lang.Class getGetterType(java.lang.String propertyName)
Gets the type for a property getter

Parameters:
propertyName - - the name of the property
Returns:
The Class of the propery getter

getReadablePropertyNames

public java.lang.String[] getReadablePropertyNames()
Gets an array of the readable properties for an object

Returns:
The array

getWriteablePropertyNames

public java.lang.String[] getWriteablePropertyNames()
Gets an array of the writeable properties for an object

Returns:
The array

hasWritableProperty

public boolean hasWritableProperty(java.lang.String propertyName)
Check to see if a class has a writeable property by name

Parameters:
propertyName - - the name of the property to check
Returns:
True if the object has a writeable property by the name

hasReadableProperty

public boolean hasReadableProperty(java.lang.String propertyName)
Check to see if a class has a readable property by name

Parameters:
propertyName - - the name of the property to check
Returns:
True if the object has a readable property by the name

isKnownType

public static boolean isKnownType(java.lang.Class clazz)
Tells us if the class passed in is a knwon common type

Parameters:
clazz - The class to check
Returns:
True if the class is known

getInstance

public static ClassInfo getInstance(java.lang.Class clazz)
Gets an instance of ClassInfo for the specified class.

Parameters:
clazz - The class for which to lookup the method cache.
Returns:
The method cache for the class

unwrapThrowable

public static java.lang.Throwable unwrapThrowable(java.lang.Throwable t)
Examines a Throwable object and gets it's root cause

Parameters:
t - - the exception to examine
Returns:
The root cause