|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.grogra.reflect.Reflection
public final class Reflection
Method Summary | ||
---|---|---|
static boolean |
canLoad(java.lang.ClassLoader loader,
java.lang.Class cls)
|
|
static boolean |
equal(java.lang.Class t1,
Type t2)
|
|
static boolean |
equal(Signature s1,
Signature s2)
|
|
static boolean |
equal(Type t1,
Type t2)
|
|
static Member |
find(Member[] members,
java.lang.String nameOrDescriptor)
|
|
static Field |
findFieldInClasses(Type type,
java.lang.String nameOrDescriptor)
|
|
static Type |
findFirst(Type[] types,
Type type)
|
|
static Method |
findMethodInClasses(Type type,
java.lang.String name)
|
|
static Method |
findMethodWithPrefixInTypes(Type type,
java.lang.String descriptorPrefix,
boolean includeInterfaces,
boolean publicOnly)
|
|
static java.lang.Object |
get(java.lang.Object object,
Field field)
|
|
static Type<?> |
getBinaryType(Type<?> type)
|
|
static
|
getDeclaredAnnotation(Member member,
java.lang.Class<T> cls)
|
|
static Field |
getDeclaredField(Type type,
java.lang.String nameOrDescriptor)
|
|
static Field[] |
getDeclaredFields(Type type)
|
|
static Type[] |
getDeclaredInterfaces(Type type)
|
|
static Method |
getDeclaredMethod(Type type,
java.lang.String nameOrDescriptor)
|
|
static Method[] |
getDeclaredMethods(Type type)
|
|
static Type |
getDeclaredType(Type type,
java.lang.String nameOrDescriptor)
|
|
static Type[] |
getDeclaredTypes(Type type)
|
|
static Method |
getDefaultConstructor(Type type)
|
|
static java.lang.String |
getDescription(Member m)
|
|
static java.lang.String |
getDescriptor(Type[] types)
|
|
static int |
getDimensionCount(Type type)
|
|
static Method |
getElementMethod(Type type,
java.lang.String element)
|
|
static Type |
getEnclosingType(Type inner,
Member member)
Returns the innermost of the enclosing types of inner
of which member is a member. |
|
static Type[] |
getExceptions(Method method)
|
|
static java.lang.String |
getFieldDescriptor(java.lang.String name,
Type type)
|
|
static char |
getJVMPrefix(int typeId)
|
|
static char |
getJVMPrefix(Type type)
|
|
static int |
getJVMStackSize(Type type)
Returns the number of stack elements which are needed for the storage of values of the given type within
the Java virtual machine. |
|
static int |
getJVMStackSize(Type[] types)
|
|
static int |
getJVMTypeId(Type type)
|
|
static java.lang.String |
getMethodDescriptor(java.lang.String name,
Type returnType,
Type[] parameterTypes)
|
|
static Method |
getMostSpecificPublicConstructor(Type type,
java.lang.Object value)
|
|
static Type |
getParameterType(Signature m,
int index,
boolean varArity)
|
|
static Type[] |
getParameterTypes(Signature m)
|
|
static Type |
getPublicType(Type[] types)
|
|
static java.lang.String |
getSyntheticName(Member[] members,
java.lang.String name)
|
|
static Type |
getTopLevelType(Type type)
|
|
static Type |
getType(java.lang.Class cls)
|
|
static Type |
getType(int typeId)
|
|
static Type |
getType(java.lang.Object object)
|
|
static Type |
getType(java.lang.String type,
java.lang.ClassLoader loader)
|
|
static java.lang.String |
getTypeName(int typeId)
|
|
static java.lang.String |
getTypeSuffix(int typeId)
|
|
static Type |
getUnwrappedType(Type type)
If the input type is one of the wrapper classes (Boolean, Byte, Short, Integer, Long, Float, Double, Character), return the matching unwrapped type (boolean, byte, short, int, long, float, double, char), otherwise return Type.INVALID instead. |
|
static java.lang.Class |
getWrapperClass(int typeId)
|
|
static boolean |
hasCategory2(int typeId)
|
|
static boolean |
hasDefaultAccess(Member m)
|
|
static boolean |
incompatibleReturnTypesExist(Type t1,
Type t2)
|
|
static boolean |
isAbstract(Member m)
|
|
static boolean |
isAccessible(Member m,
Type instance,
Type scope)
Determines if member m is accessible on
instance in the context scope . |
|
static boolean |
isAncestorOrSame(java.lang.ClassLoader a,
java.lang.ClassLoader b)
|
|
static boolean |
isArray(Type type)
|
|
static boolean |
isAssignableFrom(Type target,
Type source)
|
|
static boolean |
isCastableFrom(Type target,
Type source)
|
|
static boolean |
isCtor(Method m)
Returns true if the method m is a constructor, otherwise returns false. |
|
static boolean |
isFinal(Member m)
|
|
static boolean |
isInner(Type m)
|
|
static boolean |
isIntegral(Type type)
|
|
static boolean |
isInterface(Type type)
|
|
static boolean |
isInvalid(Type type)
|
|
static boolean |
isMember(Member member,
Type type)
Returns true iff member is a member
of type . |
|
static boolean |
isMoreVisible(int mods1,
int mods2)
|
|
static boolean |
isPrimitive(Type type)
|
|
static boolean |
isPrimitiveOrString(Type type)
|
|
static boolean |
isPrimitiveOrVoid(Type type)
|
|
static boolean |
isPrivate(Member m)
|
|
static boolean |
isProtected(Member m)
|
|
static boolean |
isPublic(Member m)
|
|
static boolean |
isStatic(Member m)
|
|
static boolean |
isSuperclassOrSame(java.lang.Class sup,
Type type)
|
|
static boolean |
isSuperclassOrSame(java.lang.String sup,
Type type)
|
|
static boolean |
isSuperclassOrSame(Type sup,
Type type)
|
|
static boolean |
isSupertype(Type sup,
Type type)
|
|
static boolean |
isSupertypeOrSame(java.lang.Class sup,
Type type)
|
|
static boolean |
isSupertypeOrSame(java.lang.String sup,
Type type)
|
|
static boolean |
isSupertypeOrSame(Type sup,
Type type)
|
|
static boolean |
isWideningConversion(int src,
int dest)
|
|
static boolean |
isWideningConversion(Type src,
Type dest)
|
|
static boolean |
membersEqual(Member m1,
Member m2,
boolean ignoreDeclaringType)
|
|
static java.lang.String |
modifiersToString(int mods)
|
|
static boolean |
overlaps(FieldChain a,
int[] aindices,
FieldChain b,
int[] bindices)
|
|
static void |
set(java.lang.Object object,
Field field,
java.lang.Object value)
|
|
static java.lang.String |
toString(Field field)
|
|
static java.lang.String |
toString(Type t)
|
|
static java.lang.Object |
toType(java.lang.Object v,
Type t)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static boolean canLoad(java.lang.ClassLoader loader, java.lang.Class cls)
public static boolean equal(java.lang.Class t1, Type t2)
public static boolean equal(Signature s1, Signature s2)
public static boolean equal(Type t1, Type t2)
public static Member find(Member[] members, java.lang.String nameOrDescriptor)
public static Field findFieldInClasses(Type type, java.lang.String nameOrDescriptor)
public static Type findFirst(Type[] types, Type type)
public static Method findMethodInClasses(Type type, java.lang.String name)
public static Method findMethodWithPrefixInTypes(Type type, java.lang.String descriptorPrefix, boolean includeInterfaces, boolean publicOnly)
public static java.lang.Object get(java.lang.Object object, Field field) throws java.lang.IllegalAccessException
java.lang.IllegalAccessException
public static Type<?> getBinaryType(Type<?> type)
public static <T extends java.lang.annotation.Annotation> Annotation<T> getDeclaredAnnotation(Member member, java.lang.Class<T> cls)
public static Field getDeclaredField(Type type, java.lang.String nameOrDescriptor)
public static Field[] getDeclaredFields(Type type)
public static Type[] getDeclaredInterfaces(Type type)
public static Method getDeclaredMethod(Type type, java.lang.String nameOrDescriptor)
public static Method[] getDeclaredMethods(Type type)
public static Type getDeclaredType(Type type, java.lang.String nameOrDescriptor)
public static Type[] getDeclaredTypes(Type type)
public static Method getDefaultConstructor(Type type)
public static java.lang.String getDescription(Member m)
public static java.lang.String getDescriptor(Type[] types)
public static int getDimensionCount(Type type)
public static Method getElementMethod(Type type, java.lang.String element)
public static Type getEnclosingType(Type inner, Member member)
inner
of which member
is a member. May be inner
itself. Returns null
if no such type can be found.
inner
- a typemember
- a member
inner
which has member
as memberpublic static Type[] getExceptions(Method method)
public static java.lang.String getFieldDescriptor(java.lang.String name, Type type)
public static char getJVMPrefix(int typeId)
public static char getJVMPrefix(Type type)
public static int getJVMStackSize(Type type)
type
within
the Java virtual machine.
type
- a type
public static int getJVMStackSize(Type[] types)
public static int getJVMTypeId(Type type)
public static java.lang.String getMethodDescriptor(java.lang.String name, Type returnType, Type[] parameterTypes)
public static Method getMostSpecificPublicConstructor(Type type, java.lang.Object value)
public static Type getParameterType(Signature m, int index, boolean varArity)
public static Type[] getParameterTypes(Signature m)
public static Type getPublicType(Type[] types)
public static java.lang.String getSyntheticName(Member[] members, java.lang.String name)
public static Type getTopLevelType(Type type)
public static Type getType(java.lang.Class cls)
public static Type getType(int typeId)
public static final Type getType(java.lang.Object object)
public static Type getType(java.lang.String type, java.lang.ClassLoader loader)
public static java.lang.String getTypeName(int typeId)
public static java.lang.String getTypeSuffix(int typeId)
public static Type getUnwrappedType(Type type)
type
-
public static java.lang.Class getWrapperClass(int typeId)
public static boolean hasCategory2(int typeId)
public static boolean hasDefaultAccess(Member m)
public static boolean incompatibleReturnTypesExist(Type t1, Type t2)
public static boolean isAbstract(Member m)
public static boolean isAccessible(Member m, Type instance, Type scope)
m
is accessible on
instance
in the context scope
.
instance
is only needed for instance methods
and fields and denotes the instance on which these members
are accessed. scope
defines the type in whose
declaration the access of m
occurs.
m
is accessible.
m
- a memberinstance
- instance for instance methods and fieldsscope
- type in whose declaration m
is accessed
true
iff the access is permittedpublic static boolean isAncestorOrSame(java.lang.ClassLoader a, java.lang.ClassLoader b)
public static boolean isArray(Type type)
public static boolean isAssignableFrom(Type target, Type source)
public static boolean isCastableFrom(Type target, Type source)
public static boolean isCtor(Method m)
m
- a method
true
iff m
is a constructorpublic static boolean isFinal(Member m)
public static boolean isInner(Type m)
public static boolean isIntegral(Type type)
public static boolean isInterface(Type type)
public static boolean isInvalid(Type type)
public static boolean isMember(Member member, Type type)
true
iff member
is a member
of type
. This is the case if member
is declared in type
or one of its supertypes.
member
- a membertype
- a type
true
iff member
is a member
of type
public static boolean isMoreVisible(int mods1, int mods2)
public static boolean isPrimitive(Type type)
public static boolean isPrimitiveOrString(Type type)
public static boolean isPrimitiveOrVoid(Type type)
public static boolean isPrivate(Member m)
public static boolean isProtected(Member m)
public static boolean isPublic(Member m)
public static boolean isStatic(Member m)
public static boolean isSuperclassOrSame(java.lang.Class sup, Type type)
public static boolean isSuperclassOrSame(java.lang.String sup, Type type)
public static boolean isSuperclassOrSame(Type sup, Type type)
public static boolean isSupertype(Type sup, Type type)
public static boolean isSupertypeOrSame(java.lang.Class sup, Type type)
public static boolean isSupertypeOrSame(java.lang.String sup, Type type)
public static boolean isSupertypeOrSame(Type sup, Type type)
public static boolean isWideningConversion(int src, int dest)
public static boolean isWideningConversion(Type src, Type dest)
public static boolean membersEqual(Member m1, Member m2, boolean ignoreDeclaringType)
public static java.lang.String modifiersToString(int mods)
public static boolean overlaps(FieldChain a, int[] aindices, FieldChain b, int[] bindices)
public static void set(java.lang.Object object, Field field, java.lang.Object value) throws java.lang.IllegalAccessException
java.lang.IllegalAccessException
public static java.lang.String toString(Field field)
public static java.lang.String toString(Type t)
public static java.lang.Object toType(java.lang.Object v, Type t)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |