public class ReflectionUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.util.Map<java.lang.Class<?>,java.lang.Class<?>> |
PRIMITIVE_TYPE_COMPATIBLE_CLASSES |
| Constructor and Description |
|---|
ReflectionUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isAssignableFrom(java.lang.Class<?> leftType,
java.lang.Class<?> rightType)
Tests whether or not the left hand type is compatible with the right hand type in Groovy
terms, i.e.
|
static boolean |
isGetter(java.lang.String name,
java.lang.Class<?>[] args)
Returns true if the name of the method specified and the number of arguments make it a javabean property
|
static boolean |
isSetter(java.lang.String name,
java.lang.Class[] args) |
static void |
makeAccessible(java.lang.reflect.Field field)
Make the given field accessible, explicitly setting it accessible if necessary.
|
static void |
makeAccessible(java.lang.reflect.Method method)
Make the given method accessible, explicitly setting it accessible if necessary.
|
public static final java.util.Map<java.lang.Class<?>,java.lang.Class<?>> PRIMITIVE_TYPE_COMPATIBLE_CLASSES
public static void makeAccessible(java.lang.reflect.Field field)
setAccessible(true) method is only called when actually necessary,
to avoid unnecessary conflicts with a JVM SecurityManager (if active).
Based on the same method in Spring core.field - the field to make accessibleAccessibleObject.setAccessible(java.lang.reflect.AccessibleObject[], boolean)public static void makeAccessible(java.lang.reflect.Method method)
setAccessible(true) method is only called when actually necessary,
to avoid unnecessary conflicts with a JVM SecurityManager (if active).
Based on the same method in Spring core.method - the method to make accessibleAccessibleObject.setAccessible(java.lang.reflect.AccessibleObject[], boolean)public static boolean isAssignableFrom(java.lang.Class<?> leftType,
java.lang.Class<?> rightType)
Tests whether or not the left hand type is compatible with the right hand type in Groovy terms, i.e. can the left type be assigned a value of the right hand type in Groovy.
This handles Java primitive type equivalence and uses isAssignableFrom for all other types, with a bit of magic for native types and polymorphism i.e. Number assigned an int. If either parameter is null an exception is thrown
leftType - The type of the left hand part of a notional assignmentrightType - The type of the right hand part of a notional assignmentpublic static boolean isGetter(java.lang.String name,
java.lang.Class<?>[] args)
name - True if its a Javabean propertyargs - The argumentspublic static boolean isSetter(java.lang.String name,
java.lang.Class[] args)