public class ReflectHelper extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
L
Constant
L="L" |
static String |
LEFT_MIDDLE_BRACKET
Constant
LEFT_MIDDLE_BRACKET="[" |
static String |
SEMICOLON
Constant
SEMICOLON=";" |
static String |
V
Constant
V="V" |
| 限定符和类型 | 方法和说明 |
|---|---|
static <$ACCESSIBLE_OBJECT extends AccessibleObject> |
accessible($ACCESSIBLE_OBJECT accessibleObject)
return accessible accessibleObject
|
static void |
explain(Object obj)
explain.
|
static Class<?> |
forClassName(String className)
forClassName.
|
static Type[] |
getArgsFromDescriptor(String methodDescriptor)
getArgsFromDescriptor.
|
static <T> Constructor<T> |
getConstructorByDescriptor(Class<?> clazz,
String methodDescriptor)
getConstructorByDescriptor.
|
static String |
getDescriptor(Class<?> clazz)
get descriptor of class
|
static String |
getDescriptor(Executable executable)
return descriptor of executable
|
static Field |
getField(Class<?> clazz,
String fieldName)
getField.
|
static List<Field> |
getFields(Class<?> clazz)
getFields.
|
static <T> T |
getFieldValue(Object obj,
String fieldName)
getFieldValue.
|
static Map<String,Type> |
getGenericMap(Type paramType) |
static Type[] |
getGenericTypes(Type paramType)
getGenericTypes.
|
static String |
getInternalName(Class<?> clazz)
get internal name
|
static Method |
getMethod(Class<?> clazz,
String methodName,
Class<?>... parameterTypes)
getMethod.
|
static Method |
getMethodByDescriptor(String methodName,
Class<?> clazz,
String methodDescriptor)
getMethodByDescriptor.
|
static List<Method> |
getMethods(Class<?> clazz)
Returns all declared methods of a class including methods of superclasses.
|
static Type |
getReturnTypeFromDescriptor(String methodDescriptor)
getReturnTypeFromDescriptor.
|
static boolean |
hasField(Class<?> clazz,
String fieldName)
hasField.
|
static <R> R |
invoke(Object obj,
Method method,
Object... args)
invoke.
|
static <T> boolean |
isInstance(T obj,
Type t)
isInstance.
|
static Class<?> |
loadClass(String className)
loadClass.
|
static <T> void |
setFieldValue(T bean,
String keyProperty,
Object fieldValue)
setFieldValue.
|
static boolean |
typeOf(Object obj,
Type eType)
typeOf.
|
public static final String LEFT_MIDDLE_BRACKET
LEFT_MIDDLE_BRACKET="["public static <$ACCESSIBLE_OBJECT extends AccessibleObject> $ACCESSIBLE_OBJECT accessible($ACCESSIBLE_OBJECT accessibleObject)
$ACCESSIBLE_OBJECT - a $ACCESSIBLE_OBJECT classaccessibleObject - accessibleObject methodpublic static String getDescriptor(Executable executable)
executable - executablepublic static String getDescriptor(Class<?> clazz)
clazz - clazzpublic static String getInternalName(Class<?> clazz)
clazz - clazzpublic static Method getMethod(Class<?> clazz, String methodName, Class<?>... parameterTypes)
getMethod.
public static List<Method> getMethods(Class<?> clazz)
clazz - The class to get the declared methods for.public static <T> boolean isInstance(T obj,
Type t)
isInstance.
T - a T classobj - a T objectt - a Type objectpublic static <T> void setFieldValue(T bean,
String keyProperty,
Object fieldValue)
setFieldValue.
public static <T> Constructor<T> getConstructorByDescriptor(Class<?> clazz, String methodDescriptor)
getConstructorByDescriptor.
T - a T classclazz - a Class objectmethodDescriptor - a String objectConstructor objectpublic static Method getMethodByDescriptor(String methodName, Class<?> clazz, String methodDescriptor)
getMethodByDescriptor.
public static Type[] getArgsFromDescriptor(String methodDescriptor)
getArgsFromDescriptor.
public static Type getReturnTypeFromDescriptor(String methodDescriptor)
getReturnTypeFromDescriptor.
Copyright © 2023 dromara. All rights reserved.