Provides methods to help with reflective operations
Modifiers | Name | Description |
---|---|---|
static java.util.Map<java.lang.Class<?>, java.lang.Class<?>> |
PRIMITIVE_TYPE_COMPATIBLE_CLASSES |
Type Params | Return Type | Name and description |
---|---|---|
|
static java.lang.Class |
forName(java.lang.String className, java.lang.ClassLoader classLoader) |
|
static java.beans.PropertyDescriptor[] |
getPropertiesOfType(java.lang.Class<?> clazz, java.lang.Class<?> propertyType) Retrieves all the properties of the given class for the given type |
<T> |
static T |
instantiate(java.lang.Class<T> clazz) Instantiates an object catching any relevant exceptions and rethrowing as a runtime exception |
|
static boolean |
isAssignableFrom(java.lang.Class<?> leftType, java.lang.Class<?> rightType) |
|
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. |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Retrieves all the properties of the given class for the given type
clazz
- The class to retrieve the properties frompropertyType
- The type of the properties you wish to retrieveInstantiates an object catching any relevant exceptions and rethrowing as a runtime exception
clazz
- The class
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 assignmentReturns true if the name of the method specified and the number of arguments make it a javabean property
name
- True if its a Javabean propertyargs
- The arguments Make the given field accessible, explicitly setting it accessible if necessary.
The 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 accessible Make the given method accessible, explicitly setting it accessible if necessary.
The 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 accessible