public class BetterReflectionClass<T> extends Object
| Constructor and Description |
|---|
BetterReflectionClass(BetterReflectionClass<T> clasz) |
BetterReflectionClass(Class<T> clasz) |
BetterReflectionClass(String className) |
protected final String name
protected final String simpleName
protected final String canonicalName
protected final String typeName
protected final String packageName
protected final Field[] declaredFields
protected final Field[] fields
protected final Constructor<?>[] declaredConstructors
protected final Constructor<?>[] constructors
protected final Method[] declaredMethods
protected final Method[] methods
protected final ProtectionDomain protectionDomain
protected final Class<?> superClass
protected BetterReflectionClass<?> betterReflectionSuperClass
protected final boolean isEnum
protected Boolean runningFromJar
isRunningFromJar() is invoked, then a mirror of
BetterReflectionUtils.isRunningFromJar(BetterReflectionClass)protected JarFile jar
getJar() is invoked, then a mirror of
BetterReflectionUtils.getCurrentJar(BetterReflectionClass)protected File jarFile
getJarFile() is invoked, then a mirror of
BetterReflectionUtils.getCurrentJarFile(BetterReflectionClass)public BetterReflectionClass(String className) throws ClassNotFoundException
ClassNotFoundExceptionpublic BetterReflectionClass(BetterReflectionClass<T> clasz)
clasz - the class to wrappublic static BetterReflectionClass<?> forName(String name)
name - the class' nameBetterReflectionClass(String), but if a
ClassNotFoundException is thrown it will return nullpublic static BetterReflectionClass<?> forNameAsArray(String name)
name - the class' namepublic String getName()
public String getSimpleName()
Simple Name (Class.getSimpleName())public String getCanonicalName()
Canonical Name (Class.getCanonicalName())public String getTypeName()
Type Name (Class.getTypeName())public Field[] getDeclaredFields()
public Field[] getFields()
public Constructor<?> getDeclaredConstructor(Object... parameterTypes)
parameterTypes - this should be populated ONLY by BetterReflectionClass
instances and Classes. Nothing else!public Constructor<?> getDeclaredConstructor(Class<?>... parameterTypes)
public Constructor<?>[] getDeclaredConstructors()
public Constructor<?> getConstructor(Object... parameterTypes)
parameterTypes - this should be populated ONLY by BetterReflectionClass
instances and Classes. Nothing else!public Constructor<?> getConstructor(Class<?>... parameterTypes)
public Constructor<?>[] getConstructors()
public Method getDeclaredMethod(String name, Object... parameterTypes)
name - The method's nameparameterTypes - this should be populated ONLY by BetterReflectionClass
instances and Classes. Nothing else!public Method[] getDeclaredMethods()
public Method getMethod(String name, Object... parameterTypes)
name - The method's nameparameterTypes - this should be populated ONLY by BetterReflectionClass
instances and Classes. Nothing else!public Method[] getMethods()
public ProtectionDomain getProtectionDomain()
public T newInstance() throws InstantiationException, IllegalAccessException
public void invokeMethods(Map<String,Object[]> methods, Object instance) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
public boolean isInstance(Object object)
public BetterReflectionClass<T[]> getBetterReflectionArrayClass()
public Class<?> getArrayClassIf(boolean condition)
public Object getDeclaredFieldValue(Object instance, String fieldName) throws IllegalAccessException
IllegalAccessExceptionpublic Object invokeMethod(Object instance, String methodName, Object... parameters) throws InvocationTargetException, IllegalAccessException
public Object invokeDeclaredMethod(Object instance, String methodName, Object... parameters) throws InvocationTargetException, IllegalAccessException
public String getPackageName()
public Class<?> getSuperclass()
Super Class (Class.getSuperclass())public BetterReflectionClass<?> getBetterReflectionSuperClass()
getSuperclass() as BetterReflectionClasspublic boolean isRunningFromJar()
public JarFile getJar()
public File getJarFile()
public boolean isAssignableFrom(Class<?> clasz)
public boolean isAssignableFrom(BetterReflectionClass<?> clasz)
public void dumpMethodHeaders()
public void dumpMethodHeaders(boolean includeModifiers)
includeModifiers - whether the method's modifiers should be dumpedpublic void dumpMethodHeaders(boolean includeModifiers,
boolean includeReturnType)
includeModifiers - whether the method's modifiers should be dumpedincludeReturnType - whether the method's return type should be dumpedpublic void dumpMethodHeaders(boolean includeModifiers,
boolean includeReturnType,
boolean includeParameterNames)
includeModifiers - whether the method's modifiers should be dumpedincludeReturnType - whether the method's return type should be dumpedincludeParameterNames - whether the method's parameter names should be dumpedpublic T allocateUnsafeInstance() throws IllegalAccessException, InstantiationException
IllegalAccessException - if the class is not accessibleInstantiationException - if the class is abstract, an interface, an array class, a primitive type, or void;public boolean isEnum()
public boolean isEnumWrapped()
Copyright © 2024. All rights reserved.