public final class Reflection
extends java.lang.Object
This class also uses a ReflectionFactory
for some operations.
Modifier and Type | Method and Description |
---|---|
static ConstructorSelector |
constructor()
The same as
reflect().constructor() |
static ConstructorsSelector |
constructors()
The same as
reflect().constructors() |
static FieldSelector |
field(java.lang.String name)
The same as
reflect().field(String) |
static FieldsSelector |
fields()
The same as
reflect().fields() |
static FieldHandler |
handle(java.lang.reflect.Field field)
Uses the
ReflectionFactory for creating a FieldHandler instance. |
static FieldHandler |
handle(FieldSelector selector)
Handles the field selected by the given selector.
|
static java.lang.Iterable<java.lang.Class> |
hierarchyOf(java.lang.Object target) |
static ConstructorInvoker |
invoke(java.lang.reflect.Constructor<?> constructor)
Uses the
ReflectionFactory for creating a ConstructorInvoker
instance. |
static MethodInvoker |
invoke(java.lang.reflect.Method method)
Uses the
ReflectionFactory for creating a MethodInvoker instance. |
static MethodInvoker |
invoke(MethodSelector selector)
Invokes the method selected by the given selector.
|
static boolean |
isFinal(java.lang.reflect.Member member) |
static boolean |
isPrivate(java.lang.reflect.Member member) |
static boolean |
isPublic(java.lang.reflect.Member member) |
static boolean |
isStatic(java.lang.reflect.Member member) |
static MethodSelector |
method(java.lang.String name)
The same as
reflect().method(String) |
static MethodsSelector |
methods()
The same as
reflect().methods() |
static java.lang.String |
parsePropertyName(java.lang.reflect.Method method)
Parses the method name to return a property name if it is a getter or a setter.
|
static Reflector |
reflect()
Uses the
ReflectionFactory for creating a Reflector instance. |
static void |
setAccessible(java.lang.reflect.AccessibleObject... objs)
Sets the accessible flag of the given objects to
true using a PrivilegedAction . |
static java.lang.Class<?> |
wrapperFor(java.lang.Class<?> primitiveClass)
Returns the wrapper class for the given
primitive class . |
public static java.lang.Class<?> wrapperFor(java.lang.Class<?> primitiveClass)
primitive class
.public static boolean isPublic(java.lang.reflect.Member member)
true
if the specified member has the public
modifierpublic static boolean isPrivate(java.lang.reflect.Member member)
true
if the specified member has the private
modifierpublic static boolean isFinal(java.lang.reflect.Member member)
true
if the specified member has the final
modifierpublic static boolean isStatic(java.lang.reflect.Member member)
true
if the specified member has the static
modifierpublic static void setAccessible(java.lang.reflect.AccessibleObject... objs)
true
using a PrivilegedAction
.objs
- the objects for making accessible.public static java.lang.String parsePropertyName(java.lang.reflect.Method method)
method
- the method to evaluatepublic static Reflector reflect()
ReflectionFactory
for creating a Reflector
instance.public static MethodInvoker invoke(java.lang.reflect.Method method)
ReflectionFactory
for creating a MethodInvoker
instance.method
- a method to invoke.public static ConstructorSelector constructor()
reflect().constructor()
public static ConstructorsSelector constructors()
reflect().constructors()
public static ConstructorInvoker invoke(java.lang.reflect.Constructor<?> constructor)
ReflectionFactory
for creating a ConstructorInvoker
instance.constructor
- the constructor to invoke.public static FieldHandler handle(java.lang.reflect.Field field)
ReflectionFactory
for creating a FieldHandler
instance.field
- the field to handle.public static FieldSelector field(java.lang.String name)
reflect().field(String)
public static FieldsSelector fields()
reflect().fields()
public static FieldHandler handle(FieldSelector selector)
selector
- the selector for getting the field.public static MethodSelector method(java.lang.String name)
reflect().method(String)
public static MethodsSelector methods()
reflect().methods()
public static MethodInvoker invoke(MethodSelector selector)
selector
- the selector for getting the method.public static java.lang.Iterable<java.lang.Class> hierarchyOf(java.lang.Object target)
ClassIterator