| 
 | Jadex 0.941 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjadex.util.SReflect
This class provides several useful static reflection methods.
| Constructor Summary | |
| SReflect() | |
| Method Summary | |
| static Class | classForName(String name)Extension for Class.forName(), because primitive types are not supported. | 
| static Class | classForName0(String name)Extension for Class.forName(), because primitive types are not supported. | 
| static Class | classForName0(String name,
              boolean initialize)Extension for Class.forName(), because primitive types are not supported. | 
| static void | clearClassCache()Clear the classcache, e.g. when the classpath has changed. | 
| static Object | convertWrappedValue(Object value,
                    Class clazz)Convert a value to the correct wrapped type. | 
| static Object | createInnerClassInstance(Object object,
                         String name,
                         Class type)Create a new instance of an inner class. | 
| static Class | findClass(String clname,
          String[] imports)Find a class. | 
| static Class | findClass0(String clname,
           String[] imports)Find a class. | 
| static Class[] | getAnonymousInnerClasses(Class clazz)Workaround for java leaveout. | 
| static Field | getCachedField(Class clazz,
               String name)Get a cached field. | 
| static String | getClassName(Class clazz)Beautifies names of arrays (eg 'String[]' instead of '[LString;'). | 
| static Object | getDeclared(Object o,
            String fieldname)Get the declared object, doesnt cumulate through superclasses. | 
| static Field | getField(Class clazz,
         String name)Get a field of the class, or any of it's superclasses. | 
| static String | getInnerClassName(Class clazz)Get inner class name. | 
| static Iterator | getIterator(Object collection)Get an iterator for an arbitrary collection object. | 
| static Method | getMethod(Class clazz,
          String name,
          Class[] types)Get a method of the class. | 
| static Method[] | getMethods(Class clazz,
           String name)Get public method(s) of the class by name. | 
| static String | getPackageName(Class clazz)Get the package of a class. | 
| static String | getUnqualifiedClassName(Class clazz)Get unqualified class name. | 
| static Class | getWrappedType(Class clazz)Get the wrapped type. | 
| static boolean | instanceOf(Object o,
           Class c)Is an object instanceof a class or its superclasses. | 
| static boolean | instanceOf(Object o,
           String c)Is an object instanceof a class or its superclasses. | 
| static boolean | isBasicType(Class clazz)Is basic type. | 
| static boolean | isSupertype(Class clazz1,
            Class clazz2)Check if a class is a supertype of, or the same as another class. | 
| static int[] | matchArgumentTypes(Class[] argtypes,
                   Class[][] paramtypes)Match the given argument types to a set of parameter type arrays. | 
| Methods inherited from class java.lang.Object | 
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
public SReflect()
| Method Detail | 
public static Class getWrappedType(Class clazz)
clazz - The basic class.
public static boolean isBasicType(Class clazz)
public static Class classForName0(String name)
name - The class name.
public static Class classForName0(String name,
                                  boolean initialize)
name - The class name.
public static Class classForName(String name)
                          throws ClassNotFoundException
name - The class name.
ClassNotFoundException
public static Object createInnerClassInstance(Object object,
                                              String name,
                                              Class type)
object - The enclosing object.name - The inner class' name.type - The inner class' required type, or null.public static Class[] getAnonymousInnerClasses(Class clazz)
public static String getClassName(Class clazz)
public static String getUnqualifiedClassName(Class clazz)
public static String getInnerClassName(Class clazz)
public static String getPackageName(Class clazz)
public static Field getField(Class clazz,
                             String name)
Class.getField(String),
  this will also return nonpublic fields
  (except when running in netscape :-( ).
clazz - The class to search.name - The name of the field to search for.
public static Field getCachedField(Class clazz,
                                   String name)
                            throws NoSuchFieldException
clazz - The clazz.name - The name.
NoSuchFieldException
public static Object getDeclared(Object o,
                                 String fieldname)
o - The object.fieldname - The name of the array.
public static Method getMethod(Class clazz,
                               String name,
                               Class[] types)
Class.getMethod(String, Class[]),
  this uses the methodcache.
clazz - The class to search.name - The name of the method to search for.types - The parameter types.
public static Method[] getMethods(Class clazz,
                                  String name)
clazz - The class to search.name - The name of the method to search for.
public static Class findClass(String clname,
                              String[] imports)
                       throws ClassNotFoundException
clname - The class name.imports - The comma separated list of imported packages.
ClassNotFoundException - when the class is not found in the imports.
public static Class findClass0(String clname,
                               String[] imports)
clname - The class name.imports - The comma separated list of imported packages.
public static int[] matchArgumentTypes(Class[] argtypes,
                                       Class[][] paramtypes)
argtypes - The array of argument types.paramtypes - The array of parameter type arrays.
public static boolean isSupertype(Class clazz1,
                                  Class clazz2)
clazz1 - The assumed supertype.clazz2 - The assumed subtype.
public static Object convertWrappedValue(Object value,
                                         Class clazz)
value - The value.clazz - The target clazz.
isSupertype(Class, Class)public static Iterator getIterator(Object collection)
collection - The collection object.
IllegalArgumentException - when argument is not
 		one of (Iterator, Enumeration, Collection, Map, Array).
public static boolean instanceOf(Object o,
                                 Class c)
o - The object.c - The class.
public static boolean instanceOf(Object o,
                                 String c)
o - The object.c - The class.
public static void clearClassCache()
| 
 | Jadex 0.941 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Copyright (C) 2002-2005 Lars Braubach, Alexander Pokahr, Andrzej Walczak - University of Hamburg. Use is subject to license terms.