Package org.apache.ibatis.reflection
Class Reflector
- java.lang.Object
-
- 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.- Author:
- Clinton Begin
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
canControlMemberAccessible()
Checks whether can control member accessible.String
findPropertyName(String name)
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 writable 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
hasDefaultConstructor()
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 writable property by name.
-
-
-
Constructor Detail
-
Reflector
public Reflector(Class<?> clazz)
-
-
Method Detail
-
canControlMemberAccessible
public static boolean canControlMemberAccessible()
Checks whether can control member accessible.- Returns:
- If can control member accessible, it return true
- Since:
- 3.5.0
-
getType
public Class<?> getType()
Gets the name of the class the instance provides information for.- Returns:
- The class name
-
getDefaultConstructor
public Constructor<?> getDefaultConstructor()
-
hasDefaultConstructor
public boolean hasDefaultConstructor()
-
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 property 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 property 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 writable properties for an object.- Returns:
- The array
-
hasSetter
public boolean hasSetter(String propertyName)
Check to see if a class has a writable property by name.- Parameters:
propertyName
- - the name of the property to check- Returns:
- True if the object has a writable 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
-
-