@ParametersAreNonnullByDefault public final class Reflections extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
canAssign(Class<?> to,
Class<?> from) |
static Object |
getAnnotationAttribute(Annotation annot,
String attributeName) |
static Method |
getCompatibleMethod(Class<?> c,
String methodName,
Class<?>... paramTypes)
Method lookup utility that looks up a method declaration that is compatible.
|
static Method |
getCompatibleMethodCached(Class<?> c,
String methodName,
Class<?>... paramTypes) |
static MethodHandle |
getCompatibleMethodHandle(Class<?> c,
String methodName,
Class<?>... paramTypes) |
static MethodHandle |
getCompatibleMethodHandleCached(Class<?> c,
String methodName,
Class<?>... paramTypes) |
static Constructor<?> |
getConstructor(Class<?> c,
Class<?>... paramTypes)
Equivalent to Class.getDeclaredConstructor, only that it does not throw an exception if no constructor,
it returns null instead, also makes all constructors accessible..
|
static Class<?> |
getLoadedClass(ClassLoader cl,
String className) |
static Manifest |
getManifest(URL jarUrl)
Get the manifest of a jar file.
|
static Method |
getMethod(Class<?> c,
String methodName,
Class<?>... paramTypes)
Equivalent to Class.getDeclaredMethod which returns a null instead of throwing an exception.
|
static Class<?>[] |
getParameterTypes(Constructor<?> m) |
static Class<?>[] |
getParameterTypes(Method m)
Optimized alternative of Method.getParameterTypes that steals the parameterTypeArry from method
instead of copying it.
|
static <T> T |
implement(Class<T> clasz,
Object target) |
static <T> T |
implementStatic(Class<T> clasz,
Class<?> target)
create a proxy instance that will proxy interface methods to static methods on the target class.
|
static Object |
invoke(Method m,
Object object,
Object[] parameters) |
static boolean |
isWrappableOrWrapper(Class clasz) |
static Class<?> |
primitiveToWrapper(Class<?> clasz) |
static Type |
primitiveToWrapper(Type type) |
static Class<?> |
wrapperToPrimitive(Class<?> clasz) |
public static Class<?>[] getParameterTypes(Method m)
m
- public static Class<?>[] getParameterTypes(Constructor<?> m)
public static boolean isWrappableOrWrapper(Class clasz)
public static Object getAnnotationAttribute(@Nonnull Annotation annot, @Nonnull String attributeName)
@Nullable public static Method getMethod(Class<?> c, String methodName, Class<?>... paramTypes)
c
- methodName
- paramTypes
- @Nullable public static Constructor<?> getConstructor(Class<?> c, Class<?>... paramTypes)
@Nullable public static Method getCompatibleMethod(Class<?> c, String methodName, Class<?>... paramTypes)
c
- methodName
- paramTypes
- @Nullable public static MethodHandle getCompatibleMethodHandle(Class<?> c, String methodName, Class<?>... paramTypes)
public static Object invoke(Method m, Object object, Object[] parameters) throws IllegalAccessException, InvocationTargetException
@Nullable public static Method getCompatibleMethodCached(Class<?> c, String methodName, Class<?>... paramTypes)
public static MethodHandle getCompatibleMethodHandleCached(Class<?> c, String methodName, Class<?>... paramTypes)
@Nullable public static Manifest getManifest(@Nonnull URL jarUrl) throws IOException
jarUrl
- IOException
public static <T> T implementStatic(Class<T> clasz, Class<?> target)
T
- clasz
- target
- @Nullable public static Class<?> getLoadedClass(ClassLoader cl, String className)
Copyright © 2018 SPF4J. All rights reserved.