Package com.intellij.util
Class ReflectionUtil
java.lang.Object
com.intellij.util.ReflectionUtil
-
Method Summary
Modifier and TypeMethodDescriptioncollectFields(Class clazz) static voidcopyFieldValue(Object from, Object to, Field field) static <T> TcreateInstance(Constructor<T> constructor, Object... args) static StringdeclarationToString(GenericDeclaration anInterface) static FieldfindAssignableField(Class<?> clazz, Class<?> fieldType, String fieldName) static ClassfindCallerClass(int framesToSkip) Returns the class this method was called 'framesToSkip' frames up the caller hierarchy.static Fieldstatic MethodfindMethod(Collection<Method> methods, String name, Class... parameters) static Classstatic Type[]getActualTypeArguments(ParameterizedType parameterizedType) getClassDeclaredFields(Class aClass) getClassDeclaredMethods(Class aClass) getClassDeclaredMethods(Class aClass, boolean includeSynthetic) getClassPublicMethods(Class aClass) getClassPublicMethods(Class aClass, boolean includeSynthetic) static FieldgetDeclaredField(Class aClass, String name) static MethodgetDeclaredMethod(Class aClass, String name, Class... parameters) static <T> Constructor<T> getDefaultConstructor(Class<T> aClass) static <T> Tstatic Classstatic Methodstatic ClassgetMethodDeclaringClass(Class<?> instanceClass, String methodName, Class... parameters) static Class<?> getRawType(Type type) static <T> TgetStaticFieldValue(Class objectClass, Class<T> fieldType, String fieldName) static booleanisAssignable(Class<?> ancestor, Class<?> descendant) static <T> TnewInstance(Class<T> aClass) LikeClass.newInstance()but also handles private classesstatic voidresetField(Class clazz, Class type, String name) static voidresetField(Object object, Class type, String name) static voidresetField(Object object, Field field) static voidresetField(Object object, String name) static voidresetStaticField(Class aClass, String name) static TyperesolveVariable(TypeVariable variable, Class classType) static TyperesolveVariable(TypeVariable variable, Class classType, boolean resolveInInterfacesOnly) static TyperesolveVariableInHierarchy(TypeVariable variable, Class aClass) static <T> booleanstatic Class<?> substituteGenericType(Type genericType, Type classType)
-
Method Details
-
resolveVariable
-
resolveVariable
-
declarationToString
-
getRawType
-
getActualTypeArguments
-
substituteGenericType
-
collectFields
-
findField
@NotNull public static Field findField(@NotNull Class clazz, @Nullable Class type, @NotNull String name) throws NoSuchFieldException - Throws:
NoSuchFieldException
-
findAssignableField
@NotNull public static Field findAssignableField(@NotNull Class<?> clazz, @Nullable("null means any type") Class<?> fieldType, @NotNull String fieldName) throws NoSuchFieldException - Throws:
NoSuchFieldException
-
resetField
-
resetField
-
resetField
-
resetField
-
resetStaticField
-
findMethod
-
getMethod
-
getDeclaredMethod
-
getDeclaredField
-
getClassPublicMethods
-
getClassPublicMethods
-
getClassDeclaredMethods
-
getClassDeclaredMethods
-
getClassDeclaredFields
-
getMethodDeclaringClass
-
getField
-
getStaticFieldValue
-
setField
-
resolveVariableInHierarchy
public static Type resolveVariableInHierarchy(@NotNull TypeVariable variable, @NotNull Class aClass) -
getDefaultConstructor
-
newInstance
LikeClass.newInstance()but also handles private classes -
createInstance
@NotNull public static <T> T createInstance(@NotNull Constructor<T> constructor, @NotNull Object... args) -
getGrandCallerClass
-
copyFieldValue
public static void copyFieldValue(@NotNull Object from, @NotNull Object to, @NotNull Field field) throws IllegalAccessException - Throws:
IllegalAccessException
-
forName
-
findCallerClass
Returns the class this method was called 'framesToSkip' frames up the caller hierarchy. NOTE: Extremely expensive! Please consider not using it. These aren't the droids you're looking for! -
isAssignable
-