public class DfReflectionUtil extends Object
| 修飾子とタイプ | クラスと説明 |
|---|---|
static class |
DfReflectionUtil.ReflectionFailureException |
static class |
DfReflectionUtil.VisibilityType |
| コンストラクタと説明 |
|---|
DfReflectionUtil() |
| 修飾子とタイプ | メソッドと説明 |
|---|---|
protected static void |
assertObjectNotNull(String variableName,
Object value)
Assert that the object is not null.
|
static void |
assertStringNotNullAndNotTrimmedEmpty(String variableName,
String value)
Assert that the entity is not null and not trimmed empty.
|
protected static Method |
doFindMethodBasic(Class<?> clazz,
String methodName,
Class<?>[] argTypes,
DfReflectionUtil.VisibilityType visibilityType) |
protected static Method |
doFindMethodFlexibly(Class<?> clazz,
String methodName,
Class<?>[] argTypes,
DfReflectionUtil.VisibilityType visibilityType) |
protected static Field |
findField(Class<?> clazz,
String fieldName,
DfReflectionUtil.VisibilityType visibilityType) |
protected static Method |
findMethod(Class<?> clazz,
String methodName,
Class<?>[] argTypes,
DfReflectionUtil.VisibilityType visibilityType,
boolean flexibly) |
static Class<?> |
forName(String className) |
static Field |
getAccessibleField(Class<?> clazz,
String fieldName) |
static Method |
getAccessibleMethod(Class<?> clazz,
String methodName,
Class<?>[] argTypes)
Get the accessible method that means as follows:
o target class's methods = all
o superclass's methods = public or protected
|
static Method |
getAccessibleMethodFlexibly(Class<?> clazz,
String methodName,
Class<?>[] argTypes)
Get the accessible method that means as follows:
o target class's methods = all
o superclass's methods = public or protected
And it has the flexibly searching so you can specify types of sub-class to argTypes.
|
static Constructor<?> |
getConstructor(Class<?> clazz,
Class<?>[] argTypes) |
protected static Type |
getGenericParameter(Type type,
int index) |
protected static List<Type> |
getGenericParameterList(Type type) |
static Class<?> |
getGenericType(Type type) |
static Class<?> |
getPrimitiveClass(Class<?> clazz) |
static Class<?> |
getPrimitiveClassIfWrapper(Class<?> clazz) |
static Field |
getPublicField(Class<?> clazz,
String fieldName) |
static Method |
getPublicMethod(Class<?> clazz,
String methodName,
Class<?>[] argTypes)
Get the public method.
|
static Method |
getPublicMethodFlexibly(Class<?> clazz,
String methodName,
Class<?>[] argTypes)
Get the public method.
|
protected static Class<?> |
getRawClass(Type type) |
static Object |
getValue(Field field,
Object target) |
static Object |
getValueForcedly(Field field,
Object target) |
static Field |
getWholeField(Class<?> clazz,
String fieldName) |
static Method |
getWholeMethod(Class<?> clazz,
String methodName,
Class<?>[] argTypes)
Get the method in whole methods that means as follows:
o target class's methods = all
o superclass's methods = all (also contains private)
And no cache so you should cache it yourself if you call several times.
|
static Method |
getWholeMethodFlexibly(Class<?> clazz,
String methodName,
Class<?>[] argTypes)
Get the method in whole methods that means as follows:
o target class's methods = all
o superclass's methods = all (also contains private)
And it has the flexibly searching so you can specify types of sub-class to argTypes.
|
static Class<?> |
getWrapperClass(Class<?> clazz) |
static Object |
invoke(Method method,
Object target,
Object[] args)
Invoke the method by reflection.
|
static Object |
invokeForcedly(Method method,
Object target,
Object[] args) |
static Object |
invokeStatic(Method method,
Object[] args) |
static boolean |
isAssignableFrom(Class<?> toClass,
Class<?> fromClass) |
static boolean |
isBridgeMethod(Method method) |
protected static boolean |
isDefaultOrPrivate(int modifier) |
static boolean |
isInstanceFinalField(Field field) |
static boolean |
isInstanceVariableField(Field field) |
protected static boolean |
isOutOfTargetForAccessible(DfReflectionUtil.VisibilityType visibilityType,
int modifier,
Class<?> clazz,
Class<?> target) |
protected static boolean |
isOutOfTargetForPublic(DfReflectionUtil.VisibilityType visibilityType,
int modifier) |
static boolean |
isPublic(int modifier) |
static boolean |
isPublicField(Field field) |
static boolean |
isPublicMethod(Method method) |
static boolean |
isStatic(int modifier) |
static boolean |
isStaticFinalField(Field field) |
static boolean |
isStaticVariableField(Field field) |
static boolean |
isSyntheticMethod(Method method) |
protected static boolean |
isTypeOf(Type type,
Class<?> clazz) |
static Object |
newInstance(Class<?> clazz) |
static Object |
newInstance(Constructor<?> constructor,
Object[] args) |
static void |
setValue(Field field,
Object target,
Object value) |
static void |
setValueForcedly(Field field,
Object target,
Object value) |
public static Constructor<?> getConstructor(Class<?> clazz, Class<?>[] argTypes)
public static Object newInstance(Constructor<?> constructor, Object[] args)
protected static Field findField(Class<?> clazz, String fieldName, DfReflectionUtil.VisibilityType visibilityType)
public static boolean isStaticFinalField(Field field)
public static boolean isStaticVariableField(Field field)
public static boolean isInstanceFinalField(Field field)
public static boolean isInstanceVariableField(Field field)
public static boolean isPublicField(Field field)
public static Method getAccessibleMethod(Class<?> clazz, String methodName, Class<?>[] argTypes)
o target class's methods = all o superclass's methods = public or protected
clazz - The type of class that defines the method. (NotNull)methodName - The name of method. (NotNull)argTypes - The type of argument. (NotNull)public static Method getAccessibleMethodFlexibly(Class<?> clazz, String methodName, Class<?>[] argTypes)
o target class's methods = all o superclass's methods = public or protectedAnd it has the flexibly searching so you can specify types of sub-class to argTypes. But if overload methods exist, it returns the first-found method.
clazz - The type of class that defines the method. (NotNull)methodName - The name of method. (NotNull)argTypes - The type of argument. (NotNull)public static Method getPublicMethod(Class<?> clazz, String methodName, Class<?>[] argTypes)
clazz - The type of class that defines the method. (NotNull)methodName - The name of method. (NotNull)argTypes - The type of argument. (NotNull)public static Method getPublicMethodFlexibly(Class<?> clazz, String methodName, Class<?>[] argTypes)
clazz - The type of class that defines the method. (NotNull)methodName - The name of method. (NotNull)argTypes - The type of argument. (NotNull)public static Method getWholeMethod(Class<?> clazz, String methodName, Class<?>[] argTypes)
o target class's methods = all o superclass's methods = all (also contains private)And no cache so you should cache it yourself if you call several times.
clazz - The type of class that defines the method. (NotNull)methodName - The name of method. (NotNull)argTypes - The type of argument. (NotNull)public static Method getWholeMethodFlexibly(Class<?> clazz, String methodName, Class<?>[] argTypes)
o target class's methods = all o superclass's methods = all (also contains private)And it has the flexibly searching so you can specify types of sub-class to argTypes.
clazz - The type of class that defines the method. (NotNull)methodName - The name of method. (NotNull)argTypes - The type of argument. (NotNull)protected static Method findMethod(Class<?> clazz, String methodName, Class<?>[] argTypes, DfReflectionUtil.VisibilityType visibilityType, boolean flexibly)
protected static Method doFindMethodBasic(Class<?> clazz, String methodName, Class<?>[] argTypes, DfReflectionUtil.VisibilityType visibilityType)
protected static Method doFindMethodFlexibly(Class<?> clazz, String methodName, Class<?>[] argTypes, DfReflectionUtil.VisibilityType visibilityType)
protected static boolean isOutOfTargetForPublic(DfReflectionUtil.VisibilityType visibilityType, int modifier)
protected static boolean isOutOfTargetForAccessible(DfReflectionUtil.VisibilityType visibilityType, int modifier, Class<?> clazz, Class<?> target)
public static Object invoke(Method method, Object target, Object[] args)
method - The instance of method. (NotNull)target - The invocation target instance. (NullAllowed: if null, it means static method)args - The array of arguments. (NullAllowed)DfReflectionUtil.ReflectionFailureException - When invocation failure and illegal accesspublic static boolean isPublicMethod(Method method)
public static boolean isBridgeMethod(Method method)
public static boolean isSyntheticMethod(Method method)
public static boolean isPublic(int modifier)
protected static boolean isDefaultOrPrivate(int modifier)
public static boolean isStatic(int modifier)
protected static void assertObjectNotNull(String variableName, Object value)
variableName - The check name of variable for message. (NotNull)value - The checked value. (NotNull)IllegalArgumentException - When the argument is null.Copyright © 2014–2015 The DBFlute Project. All rights reserved.