org.apache.ibatis.reflection
Class Reflector

java.lang.Object
  extended by org.apache.ibatis.reflection.Reflector

public class Reflector
extends Object

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


Method Summary
 String findPropertyName(String name)
           
static Reflector forClass(Class clazz)
          Gets an instance of ClassInfo for the specified class.
 Constructor getDefaultConstructor()
           
 String[] getGetablePropertyNames()
          Gets an array of the readable properties for an object
 Invoker getGetInvoker(String propertyName)
           
 Class getGetterType(String propertyName)
          Gets the type for a property getter
 String[] getSetablePropertyNames()
          Gets an array of the writeable properties for an object
 Invoker getSetInvoker(String propertyName)
           
 Class getSetterType(String propertyName)
          Gets the type for a property setter
 Class getType()
          Gets the name of the class the instance provides information for
 boolean hasGetter(String propertyName)
          Check to see if a class has a readable property by name
 boolean hasSetter(String propertyName)
          Check to see if a class has a writeable property by name
static boolean isClassCacheEnabled()
           
static void setClassCacheEnabled(boolean classCacheEnabled)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getType

public Class getType()
Gets the name of the class the instance provides information for

Returns:
The class name

getDefaultConstructor

public Constructor getDefaultConstructor()

getSetInvoker

public Invoker getSetInvoker(String propertyName)

getGetInvoker

public Invoker getGetInvoker(String propertyName)

getSetterType

public Class getSetterType(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 Class getGetterType(String propertyName)
Gets the type for a property getter

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

getGetablePropertyNames

public String[] getGetablePropertyNames()
Gets an array of the readable properties for an object

Returns:
The array

getSetablePropertyNames

public String[] getSetablePropertyNames()
Gets an array of the writeable properties for an object

Returns:
The array

hasSetter

public boolean hasSetter(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

hasGetter

public boolean hasGetter(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

findPropertyName

public String findPropertyName(String name)

forClass

public static Reflector forClass(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

setClassCacheEnabled

public static void setClassCacheEnabled(boolean classCacheEnabled)

isClassCacheEnabled

public static boolean isClassCacheEnabled()


Copyright © 2010. All Rights Reserved.