|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--adavid.reflect.ClassReflect
useful functions to perform operations on Class without any instance
Field Summary | |
static int |
ALLACCESS
filter mode definition |
static int |
ANY
|
static java.lang.Class |
CHAR
classes used for tests: better to have then once here, and they are usable by other classes as well |
static java.lang.Class |
CHARACTER
classes used for tests: better to have then once here, and they are usable by other classes as well |
static java.lang.Class |
COLOR
classes used for tests: better to have then once here, and they are usable by other classes as well |
static int |
NO
|
static int |
PACKAGE
filter mode definition |
static java.lang.Class |
STRING
classes used for tests: better to have then once here, and they are usable by other classes as well |
static java.lang.Class |
STRINGBUFFER
classes used for tests: better to have then once here, and they are usable by other classes as well |
static int |
YES
|
Constructor Summary | |
ClassReflect(java.lang.Class theClass)
wraps a class in order to return a proper string representation with respect to the flags |
Method Summary | |
static void |
enableSort(boolean b)
|
static void |
enableSortModifiers(boolean b)
|
static java.lang.Class[] |
findClasses(java.lang.String name,
boolean all)
tries to make a class from its name, possibly incomplete (without package prefix) returns all found classes with the given name (several packages) if the flag is true |
static int |
getAbstractFilter()
|
static int |
getAccessFilter()
|
static java.lang.Class |
getClass(java.lang.String name)
used to initialize the Class static members |
static java.lang.String |
getColorName(java.awt.Color color)
returns the string representation of a color, try the name representation |
java.lang.reflect.Constructor[] |
getConstructors()
|
static java.lang.reflect.Constructor[] |
getConstructors(java.lang.Class obj)
returns the corresponding constructors with respect to the above filters |
java.lang.reflect.Field[] |
getFields()
|
static java.lang.reflect.Field[] |
getFields(java.lang.Class obj)
returns the corresponding fields with respect to the above filters |
static int |
getFinalFilter()
|
java.lang.Class[] |
getHierarchy()
|
static java.lang.Class[] |
getHierarchy(java.lang.Class current)
returns the class hierarchy of a given class |
java.lang.Class[] |
getInterfaces()
|
java.lang.reflect.Method[] |
getMethods()
|
static java.lang.reflect.Method[] |
getMethods(java.lang.Class obj)
returns the corresponding methods with respect to the above filters |
static java.lang.StringBuffer |
getModifiers(java.lang.Class theClass)
returns the modifiers of a class |
static java.lang.StringBuffer |
getModifiers(java.lang.reflect.Constructor constructor)
returns the modifiers of the given constructor |
static java.lang.StringBuffer |
getModifiers(java.lang.reflect.Field field)
returns the modifiers string of a field |
static java.lang.StringBuffer |
getModifiers(java.lang.reflect.Method method)
returns the modifiers prefix for a method |
static java.lang.String[] |
getNames(java.lang.Class[] list)
returns the long representation of the classes in argument |
static java.lang.String[] |
getNames(java.lang.Class[] list,
boolean isShort)
returns short/long representation of the classes in argument |
static int |
getNativeFilter()
|
static java.lang.String[] |
getShortNames(java.lang.Class[] list)
returns the short representation of the classes in argument |
static java.lang.String[] |
getShortNames(java.lang.String[] list)
returns the short representation of the classes in argument |
static SortableClass |
getSortableClass(java.lang.Class type)
returns the SortableClass of a class according to the flags above |
static SortableClass[] |
getSortableClasses(java.lang.Class[] classes)
|
static SortableConstructor |
getSortableConstructor(java.lang.reflect.Constructor constructor)
returns the SortableConstructor object of this constructor, according to the flags above |
static SortableConstructor[] |
getSortableConstructors(java.lang.reflect.Constructor[] constructors)
|
static SortableField |
getSortableField(java.lang.reflect.Field field)
returns the SortableField of the field given in arguments, according to the flags above |
static SortableField[] |
getSortableFields(java.lang.reflect.Field[] fields)
|
static SortableMethod |
getSortableMethod(java.lang.reflect.Method method)
returns a sortable method with its strings in accord to the above flags |
static SortableMethod[] |
getSortableMethods(java.lang.reflect.Method[] methods)
|
static int |
getStaticFilter()
|
static java.lang.String |
getString(java.lang.Class type)
returns the string representation of a class, in accord to the above flags |
static java.lang.String |
getString(java.lang.reflect.Constructor constructor)
returns the string representation of the constructor given in argument, according to the flags above, but without modifiers |
static java.lang.String |
getString(java.lang.reflect.Field field)
returns the string representation of the field given in argument, according to the flags above, but without modifiers |
static java.lang.String |
getString(java.lang.reflect.Method method)
returns a string representation of the method according to the above flags, but without modifiers |
static java.lang.String[] |
getStrings(java.lang.Class[] classes)
|
static java.lang.String[] |
getStrings(java.lang.reflect.Constructor[] constructors)
|
static java.lang.String[] |
getStrings(java.lang.reflect.Field[] fields)
|
static java.lang.String[] |
getStrings(java.lang.reflect.Method[] methods)
convenient methods:+ modifiers |
static int |
getSynchronizedFilter()
|
static int |
getTransientFilter()
|
static int |
getVolatileFilter()
|
java.lang.Class |
getWrappedClass()
methods relative to the wrapped class |
static boolean |
isExtensionOf(java.lang.Class data,
java.lang.Class parent)
says if the class data is an extension of the class parent |
static boolean |
isExtensionOf(java.lang.Class data,
java.lang.String className)
says if the class data is an extension of the className class name |
static boolean |
isImplementationOf(java.lang.Class data,
java.lang.String classname)
says if the class data implements a given interface |
static boolean |
isSameClass(java.lang.Class c,
java.lang.String className)
says if the class is the same as the className class name |
static boolean |
isShorterNames()
|
static boolean |
isShorterTypes()
|
static boolean |
isSortEnabled()
|
static boolean |
isSortModifiers()
|
static void |
main(java.lang.String[] args)
test |
static void |
putString(java.lang.Class[] list,
java.lang.StringBuffer buffer)
fills the buffer with the string representations of the list given in argument |
static void |
setAbstractFilter(int filter)
|
static void |
setAccessFilter(int filter)
manages the different filters |
static void |
setFinalFilter(int filter)
|
static void |
setNativeFilter(int filter)
|
static void |
setShorterNames(boolean b)
manage the different modes |
static void |
setShorterTypes(boolean b)
|
static void |
setStaticFilter(int filter)
|
static void |
setSynchronizedFilter(int filter)
|
static void |
setTransientFilter(int filter)
|
static void |
setVolatileFilter(int filter)
|
java.lang.String |
toString()
returns a formated string of the class content |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final java.lang.Class STRING
public static final java.lang.Class CHAR
public static final java.lang.Class CHARACTER
public static final java.lang.Class STRINGBUFFER
public static final java.lang.Class COLOR
public static final int PACKAGE
public static final int ALLACCESS
public static final int YES
public static final int NO
public static final int ANY
Constructor Detail |
public ClassReflect(java.lang.Class theClass)
Method Detail |
public static java.lang.Class getClass(java.lang.String name)
public java.lang.String toString()
public java.lang.Class getWrappedClass()
public java.lang.reflect.Constructor[] getConstructors()
public java.lang.reflect.Field[] getFields()
public java.lang.reflect.Method[] getMethods()
public java.lang.Class[] getHierarchy()
public java.lang.Class[] getInterfaces()
public static java.lang.Class[] getHierarchy(java.lang.Class current)
public static boolean isImplementationOf(java.lang.Class data, java.lang.String classname)
public static boolean isExtensionOf(java.lang.Class data, java.lang.Class parent)
public static boolean isExtensionOf(java.lang.Class data, java.lang.String className)
public static boolean isSameClass(java.lang.Class c, java.lang.String className)
public static void setShorterNames(boolean b)
public static boolean isShorterNames()
public static void setShorterTypes(boolean b)
public static boolean isShorterTypes()
public static void enableSort(boolean b)
public static boolean isSortEnabled()
public static void enableSortModifiers(boolean b)
public static boolean isSortModifiers()
public static void setAccessFilter(int filter)
public static int getAccessFilter()
public static void setAbstractFilter(int filter)
public static int getAbstractFilter()
public static void setFinalFilter(int filter)
public static int getFinalFilter()
public static void setStaticFilter(int filter)
public static int getStaticFilter()
public static void setNativeFilter(int filter)
public static int getNativeFilter()
public static void setSynchronizedFilter(int filter)
public static int getSynchronizedFilter()
public static void setTransientFilter(int filter)
public static int getTransientFilter()
public static void setVolatileFilter(int filter)
public static int getVolatileFilter()
public static SortableClass getSortableClass(java.lang.Class type)
public static java.lang.String getString(java.lang.Class type)
public static java.lang.StringBuffer getModifiers(java.lang.Class theClass)
public static SortableMethod getSortableMethod(java.lang.reflect.Method method)
public static java.lang.String getString(java.lang.reflect.Method method)
public static java.lang.StringBuffer getModifiers(java.lang.reflect.Method method)
public static SortableField getSortableField(java.lang.reflect.Field field)
public static java.lang.String getString(java.lang.reflect.Field field)
public static java.lang.String getColorName(java.awt.Color color)
public static java.lang.StringBuffer getModifiers(java.lang.reflect.Field field)
public static SortableConstructor getSortableConstructor(java.lang.reflect.Constructor constructor)
public static java.lang.String getString(java.lang.reflect.Constructor constructor)
public static java.lang.StringBuffer getModifiers(java.lang.reflect.Constructor constructor)
public static void putString(java.lang.Class[] list, java.lang.StringBuffer buffer)
public static java.lang.String[] getShortNames(java.lang.Class[] list)
public static java.lang.String[] getNames(java.lang.Class[] list, boolean isShort)
public static java.lang.String[] getShortNames(java.lang.String[] list)
public static java.lang.String[] getNames(java.lang.Class[] list)
public static java.lang.String[] getStrings(java.lang.reflect.Method[] methods)
public static java.lang.String[] getStrings(java.lang.reflect.Field[] fields)
public static java.lang.String[] getStrings(java.lang.reflect.Constructor[] constructors)
public static java.lang.String[] getStrings(java.lang.Class[] classes)
public static SortableMethod[] getSortableMethods(java.lang.reflect.Method[] methods)
public static SortableField[] getSortableFields(java.lang.reflect.Field[] fields)
public static SortableConstructor[] getSortableConstructors(java.lang.reflect.Constructor[] constructors)
public static SortableClass[] getSortableClasses(java.lang.Class[] classes)
public static java.lang.reflect.Field[] getFields(java.lang.Class obj)
public static java.lang.reflect.Constructor[] getConstructors(java.lang.Class obj)
public static java.lang.reflect.Method[] getMethods(java.lang.Class obj)
public static java.lang.Class[] findClasses(java.lang.String name, boolean all)
public static void main(java.lang.String[] args)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |