public class ReflectionUtils
extends java.lang.Object
| Constructor | Description |
|---|---|
ReflectionUtils() |
| Modifier and Type | Method | Description |
|---|---|---|
static float |
getTypeDifferenceWeight(java.lang.Class<?>[] srcArgs,
java.lang.Class<?>[] destArgs) |
Returns the sum of the object transformation cost for each class in the source
argument list.
|
static float |
getTypeDifferenceWeight(java.lang.Class<?>[] paramTypes,
java.lang.Object[] destArgs) |
Algorithm that judges the match between the declared parameter types of
a candidate method and a specific list of arguments that this method is
supposed to be invoked with.
|
static float |
getTypeDifferenceWeight(java.lang.Class<?> srcClass,
java.lang.Class<?> destClass) |
Gets the number of steps required needed to turn the source class into the
destination class.
|
static float |
getTypeDifferenceWeight(java.lang.Class<?> paramType,
java.lang.Object destArg) |
Algorithm that judges the match between the declared parameter types of
a candidate method and a specific list of arguments that this method is
supposed to be invoked with.
|
static java.lang.Object |
invokeMethod(java.lang.reflect.Method method,
java.lang.Object target,
java.lang.Object... args) |
Invoke the specified
Method against the supplied target object with the
supplied arguments. |
static boolean |
makeAccessible(java.lang.reflect.Field field) |
Make the given field accessible, explicitly setting it accessible if
necessary.
|
static boolean |
makeAccessible(java.lang.reflect.Method method) |
Make the given method accessible, explicitly setting it accessible if
necessary.
|
static void |
setField(java.lang.reflect.Field field,
java.lang.Object target,
java.lang.Object value) |
Set the field represented by the supplied
field object on the
specified target object to the specified value. |
static java.lang.Object |
toComponentTypeArray(java.lang.Object val,
java.lang.Class<?> componentType) |
Converts an array of objects to an array of the specified component type.
|
static java.lang.Object |
toPrimitiveArray(java.lang.Object val) |
Converts an array of objects to an array of their primitive types.
|
public static void setField(java.lang.reflect.Field field,
java.lang.Object target,
java.lang.Object value)
field object on the
specified target object to the specified value.
In accordance with Field.set(Object, Object) semantics, the new value
is automatically unwrapped if the underlying field has a primitive type.field - the field to settarget - the target object on which to set the fieldvalue - the value to set (may be null)public static java.lang.Object invokeMethod(java.lang.reflect.Method method,
java.lang.Object target,
java.lang.Object... args)
Method against the supplied target object with the
supplied arguments. The target object can be null when invoking a
static Method.method - the method to invoketarget - the target object to invoke the method onargs - the invocation arguments (may be null)public static boolean 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).field - the field to make accessibleField.setAccessible(boolean)public static boolean 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).method - the method to make accessibleMethod.setAccessible(boolean)public static float getTypeDifferenceWeight(java.lang.Class<?>[] paramTypes,
java.lang.Object[] destArgs)
paramTypes - the parameter types to matchdestArgs - the arguments to matchpublic static float getTypeDifferenceWeight(java.lang.Class<?> paramType,
java.lang.Object destArg)
paramType - the parameter type to matchdestArg - the argument to matchpublic static float getTypeDifferenceWeight(java.lang.Class<?>[] srcArgs,
java.lang.Class<?>[] destArgs)
srcArgs - the source argumentsdestArgs - the destination argumentspublic static float getTypeDifferenceWeight(java.lang.Class<?> srcClass,
java.lang.Class<?> destClass)
srcClass - the source classdestClass - the destination classpublic static java.lang.Object toPrimitiveArray(java.lang.Object val)
val - an array of objects to be converted, may be nullpublic static java.lang.Object toComponentTypeArray(java.lang.Object val,
java.lang.Class<?> componentType)
val - an array of objects to be convertedcomponentType - the Class object representing the component type of the new arrayCopyright © 2008–2018 The Aspectran Project. All rights reserved.