Package jadex.commons
Class SReflect
- java.lang.Object
- 
- jadex.commons.SReflect
 
- 
 public class SReflect extends java.lang.ObjectThis class provides several useful static reflection methods.
- 
- 
Field SummaryFields Modifier and Type Field Description protected static java.util.MapallmethodcacheMethod lookup cache (class->(name->method[])), includes non-public methods.protected static java.util.MapbasictypesMapping from basic class name -> basic type(class).protected static java.util.Map<Tuple2<java.lang.String,java.lang.Integer>,java.lang.Class<?>>classcacheClass lookup cache (classloader(weak)->Map([name, import]->class)).protected static java.util.SetconvertabletypesString convertable types.protected static java.lang.Object[]EMPTY_ARRAYprotected static java.util.MapfieldcacheField lookup cache (class->(name->field[])).protected static java.lang.invoke.MethodHandleGET_MODULEReflective access to Class.getModule().static booleanHAS_GUIThis is set to true if the VM has a working GUI environment available.protected static java.util.MapinnerclassnamecacheInner class name lookup cache.protected static java.lang.invoke.MethodHandleIS_EXPORTEDReflective access to Module.isExported().protected static java.lang.BooleanisAndroidCached flag for android check.protected static java.lang.BooleanisAndroidTestingFlag set by testcases that indicates we're testing android projects in a desktop environment.protected static java.util.MapmethodcacheMethod lookup cache (class->(name->method[])).protected static java.util.MapwrappedtypesMapping from basic class -> object type(class).
 - 
Constructor SummaryConstructors Constructor Description SReflect()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringchooseAvailableResource(java.lang.ClassLoader cl, java.lang.String... choices)Select the first available resource from a choice of potential resources.static java.lang.StringchooseAvailableResource(java.lang.String... choices)Select the first available resource from a choice of potential resources.static java.lang.Class<?>classForName(java.lang.String name, java.lang.ClassLoader classloader)Extension for Class.forName(), because primitive types are not supported.static java.lang.Class<?>classForName0(java.lang.String name, boolean initialize, java.lang.ClassLoader classloader)Extension for Class.forName(), because primitive types are not supported.static java.lang.Class<?>classForName0(java.lang.String name, java.lang.ClassLoader classloader)Extension for Class.forName(), because primitive types are not supported.static java.lang.ObjectconvertWrappedValue(java.lang.Object value, java.lang.Class clazz)Convert a value to the correct wrapped type.static java.lang.ObjectcreateComposite(java.lang.reflect.Type type, java.util.Collection<?> values)Create an fill an object of a class that is some kind of collection.static java.lang.StringcutPackageFromClassName(java.lang.String name)Cut package off from classname.static java.lang.Object[]fillArguments(java.lang.Object[] args, java.lang.Class<?>[] paramtypes)Map arguments to parameters using varargs, if necessary.static <T> java.lang.Class<T>findClass(java.lang.String clname, java.lang.String[] imports, java.lang.ClassLoader classloader)Find a class.static <T> java.lang.Class<T>findClass0(java.lang.String clname, java.lang.String[] imports, java.lang.ClassLoader classloader)Find a class.static java.lang.reflect.Field[]getAllFields(java.lang.Class clazz)Get all fields of a class including public, protected and private fields of the class and its superclasses.static java.lang.reflect.Method[]getAllMethods(java.lang.Class clazz)Get all methods of a class including public, protected and private methods of the class and its superclasses.static java.lang.reflect.Method[]getAllMethods(java.lang.Class<?> clazz, java.lang.String name)Get all method(s) of the class by name, including public, protected and private methods.static java.lang.reflect.MethodgetAnyMethod(java.lang.Class<?> clazz, java.lang.String name, java.lang.Class<?>[] types)Get a method of the class.static java.lang.ObjectgetArray(java.lang.Object collection)Get an array for an arbitrary collection object.static java.lang.reflect.FieldgetCachedField(java.lang.Class clazz, java.lang.String name)Get a cached field.static java.lang.Class<?>getClass(java.lang.reflect.Type type)Get the class for a type.static java.lang.StringgetClassName(java.lang.Class<?> clazz)Beautifies names of arrays (eg 'String[]' instead of '[LString;').static java.lang.ObjectgetDeclared(java.lang.Object o, java.lang.String fieldname)Get the declared object, doesnt cumulate through superclasses.static java.lang.reflect.MethodgetDeclaredMethod0(java.lang.Class<?> clazz, java.lang.String methodname, java.lang.Class<?>... parametertypes)Gets a declared methods similar to Class.getDeclaredMethod() but returns null instead of throwing exception.static java.lang.Class<?>getDeclaringInterface(java.lang.Class<?> iface, java.lang.String methodname, java.lang.Class<?>... parametertypes)Finds the declaring interface of a method in a multiple-inheritance interface using a breadth-first approach.static java.lang.ObjectgetDefaultValue(java.lang.Class clazz)Get default value for basic types.static java.lang.reflect.MethodgetExportedMethod(java.lang.Class<?> clazz, java.lang.String name, java.lang.Class<?>... params)Gets a method that is exported by the module.static java.lang.reflect.FieldgetField(java.lang.Class clazz, java.lang.String name)Get a field of the class, or any of it's superclasses.static java.lang.StringgetGenericClassName(java.lang.reflect.Type t, java.lang.Class<?> c)Returns generic type name.static java.lang.StringgetInnerClassName(java.lang.Class<?> clazz)Get inner class name.static java.lang.reflect.TypegetInnerGenericType(java.lang.reflect.Type type)Unwrap a generic type.static <T> java.lang.Iterable<T>getIterable(java.lang.Object collection)Get an iterator for an arbitrary collection object.static java.lang.ClassgetIterableComponentType(java.lang.reflect.Type type)Get the component type of a class that is some kind of collection.static <T> java.util.Iterator<T>getIterator(java.lang.Object collection)Get an iterator for an arbitrary collection object.static java.lang.reflect.MethodgetMethod(java.lang.Class<?> clazz, java.lang.String name, java.lang.Class<?>[] types)Get a public method of the class.static java.lang.StringgetMethodName()Get the current method name from the caller.static java.lang.reflect.Method[]getMethods(java.lang.Class clazz, java.lang.String name)Get public method(s) of the class by name.static java.lang.StringgetMethodSignature(java.lang.reflect.Method method)Get the generic signature of a method.static java.lang.StringgetPackageName(java.lang.Class<?> clazz)Get the package of a class.static java.lang.Class[]getSuperInterfaces(java.lang.Class[] interfaces)Get the super interfaces.static java.lang.StringgetTypeName(java.lang.String name)Get unqualified type name.static java.lang.StringgetUnqualifiedClassName(java.lang.Class clazz)Get unqualified class name.static java.lang.StringgetUnqualifiedTypeName(java.lang.String name)Get unqualified type name.static java.lang.Class<?>getWrappedType(java.lang.Class<?> clazz)Get the wrapped type.static booleaninstanceOf(java.lang.Object o, java.lang.Class c)Is an object instanceof a class or its superclasses.static booleanisAndroid()Test if running on android.static java.lang.BooleanisAndroidTesting()static booleanisBasicType(java.lang.Class<?> clazz)Is basic type.static booleanisExported(java.lang.Class<?> clazz)Tests if the class is part of a package that the containing module has exported.static booleanisIterable(java.lang.Object obj)Test if object is some kind of collection.static booleanisIterableClass(java.lang.Class clazz)Test if class is some kind of collection.static booleanisStringConvertableType(java.lang.Class clazz)Test if the class is automatically convertable from/to a string.static booleanisSupertype(java.lang.Class<?> clazz1, java.lang.Class<?> clazz2)Check if a class is a supertype of, or the same as another class.static voidmain(java.lang.String[] args)static java.lang.StringmakeNiceArrayNotation(java.lang.String name)Process a type name and replace array notation with nice one.static int[]matchArgumentTypes(java.lang.Class[] argtypes, java.lang.Class[][] paramtypes)Match the given argument types to a set of parameter type arrays.static java.lang.ObjectnewInstance(java.lang.String classname, java.lang.ClassLoader cl, java.lang.Object... conparams)Reflectively instantiates an object by heuristically matching the constructor parameters.static java.lang.ObjectnewInstance(java.lang.String classname, java.lang.Object... conparams)Reflectively instantiates an object by heuristically matching the constructor parameters.static voidscanDir(java.net.URL[] urls, java.io.File file, IFilter<java.lang.Object> filter, java.util.Collection<java.lang.String> results, java.util.List<java.lang.String> donedirs)Scan directories.static voidscanDir2(java.net.URL[] urls, java.io.File file, IFilter<java.lang.Object> filter, java.util.Collection<java.lang.String> results, java.util.List<java.lang.String> donedirs)Scan directories.static java.lang.Class<?>[]scanForClasses(java.lang.ClassLoader classloader, IFilter filefilter, IFilter classfilter, boolean includebootpath)Scan for classes that fulfill certain criteria as specified by the file and classfilters.static java.lang.Class<?>[]scanForClasses(java.net.URL[] urls, java.lang.ClassLoader classloader, IFilter filefilter, IFilter classfilter)Scan for classes that fulfill certain criteria as specified by the file and classfilters.static java.util.Set<SClassReader.ClassFileInfo>scanForClassFileInfos(java.net.URL[] urls, IFilter<java.lang.Object> filefilter, IFilter<SClassReader.ClassFileInfo> classfilter)Scan for component classes in the classpath.static java.util.Set<SClassReader.ClassInfo>scanForClassInfos(java.net.URL[] urls, IFilter<java.lang.Object> filefilter, IFilter<SClassReader.ClassInfo> classfilter)Scan for component classes in the classpath.static java.lang.String[]scanForFiles(java.net.URL[] urls, IFilter<java.lang.Object> filter)Scan for files in a given list of urls.static java.util.Map<java.lang.String,java.util.Set<java.lang.String>>scanForFiles2(java.net.URL[] urls, IFilter<java.lang.Object> filter)Scan for files in a given list of urls.protected static voidsetAndroid(boolean isAndroidFlag, boolean isAndroidTestingFlag)private setter that can be made accessible for robolectric testcases.static java.lang.Class<?>unwrapGenericType(java.lang.reflect.Type type)Unwrap a generic type.static java.lang.ObjectwrapValue(boolean val)static java.lang.ObjectwrapValue(byte val)static java.lang.ObjectwrapValue(char val)static java.lang.ObjectwrapValue(double val)static java.lang.ObjectwrapValue(float val)static java.lang.ObjectwrapValue(int val)static java.lang.ObjectwrapValue(long val)static java.lang.ObjectwrapValue(short val)static java.lang.ObjectwrapValue(java.lang.Object val)
 
- 
- 
- 
Field Detail- 
classcacheprotected static final java.util.Map<Tuple2<java.lang.String,java.lang.Integer>,java.lang.Class<?>> classcache Class lookup cache (classloader(weak)->Map([name, import]->class)).
 - 
innerclassnamecacheprotected static final java.util.Map innerclassnamecache Inner class name lookup cache.
 - 
methodcacheprotected static final java.util.Map methodcache Method lookup cache (class->(name->method[])).
 - 
allmethodcacheprotected static final java.util.Map allmethodcache Method lookup cache (class->(name->method[])), includes non-public methods.
 - 
fieldcacheprotected static final java.util.Map fieldcache Field lookup cache (class->(name->field[])).
 - 
basictypesprotected static final java.util.Map basictypes Mapping from basic class name -> basic type(class).
 - 
wrappedtypesprotected static final java.util.Map wrappedtypes Mapping from basic class -> object type(class).
 - 
convertabletypesprotected static final java.util.Set convertabletypes String convertable types.
 - 
HAS_GUIpublic static final boolean HAS_GUI This is set to true if the VM has a working GUI environment available.
 - 
EMPTY_ARRAYprotected static final java.lang.Object[] EMPTY_ARRAY 
 - 
GET_MODULEprotected static final java.lang.invoke.MethodHandle GET_MODULE Reflective access to Class.getModule().
 - 
IS_EXPORTEDprotected static final java.lang.invoke.MethodHandle IS_EXPORTED Reflective access to Module.isExported().
 - 
isAndroidprotected static volatile java.lang.Boolean isAndroid Cached flag for android check.
 - 
isAndroidTestingprotected static java.lang.Boolean isAndroidTesting Flag set by testcases that indicates we're testing android projects in a desktop environment.
 
- 
 - 
Method Detail- 
getWrappedTypepublic static java.lang.Class<?> getWrappedType(java.lang.Class<?> clazz) Get the wrapped type. This method converts basic types such as boolean or int to the object types Boolean, Integer.- Parameters:
- clazz- The basic class.
- Returns:
- The wrapped type, return clazz when it is no basic type.
 
 - 
unwrapGenericTypepublic static java.lang.Class<?> unwrapGenericType(java.lang.reflect.Type type) Unwrap a generic type.- Parameters:
- type- The generic type.
- Returns:
- The unwrapped class.
 
 - 
getInnerGenericTypepublic static java.lang.reflect.Type getInnerGenericType(java.lang.reflect.Type type) Unwrap a generic type.- Parameters:
- type- The generic type.
- Returns:
- The unwrapped class.
 
 - 
getClasspublic static java.lang.Class<?> getClass(java.lang.reflect.Type type) Get the class for a type.
 - 
isStringConvertableTypepublic static boolean isStringConvertableType(java.lang.Class clazz) Test if the class is automatically convertable from/to a string. Is valid for all basic types and their object pendants.- Parameters:
- clazz- The class.
- Returns:
- True, if convertable.
 
 - 
isBasicTypepublic static boolean isBasicType(java.lang.Class<?> clazz) Is basic type.- Returns:
- True, if the class is a basic type.
 
 - 
wrapValuepublic static java.lang.Object wrapValue(boolean val) 
 - 
wrapValuepublic static java.lang.Object wrapValue(int val) 
 - 
wrapValuepublic static java.lang.Object wrapValue(long val) 
 - 
wrapValuepublic static java.lang.Object wrapValue(byte val) 
 - 
wrapValuepublic static java.lang.Object wrapValue(char val) 
 - 
wrapValuepublic static java.lang.Object wrapValue(float val) 
 - 
wrapValuepublic static java.lang.Object wrapValue(double val) 
 - 
wrapValuepublic static java.lang.Object wrapValue(short val) 
 - 
wrapValuepublic static java.lang.Object wrapValue(java.lang.Object val) 
 - 
classForName0public static java.lang.Class<?> classForName0(java.lang.String name, java.lang.ClassLoader classloader)Extension for Class.forName(), because primitive types are not supported. Uses static cache to speed up lookup.- Parameters:
- name- The class name.
- Returns:
- The class, or null if not found.
 
 - 
classForName0public static java.lang.Class<?> classForName0(java.lang.String name, boolean initialize, java.lang.ClassLoader classloader)Extension for Class.forName(), because primitive types are not supported.- Parameters:
- name- The class name.
- Returns:
- The class, or null if not found.
 
 - 
classForNamepublic static java.lang.Class<?> classForName(java.lang.String name, java.lang.ClassLoader classloader) throws java.lang.ClassNotFoundExceptionExtension for Class.forName(), because primitive types are not supported. Uses static cache to speed up lookup.- Parameters:
- name- The class name.
- Returns:
- The class.
- Throws:
- java.lang.ClassNotFoundException
 
 - 
getClassNamepublic static java.lang.String getClassName(java.lang.Class<?> clazz) Beautifies names of arrays (eg 'String[]' instead of '[LString;').- Returns:
- The beautified name of a class.
 
 - 
getGenericClassNamepublic static java.lang.String getGenericClassName(java.lang.reflect.Type t, java.lang.Class<?> c)Returns generic type name.- Parameters:
- t- The type.
- c- The class, used when type is variable declaration.
- Returns:
- The name of the type.
 
 - 
getUnqualifiedClassNamepublic static java.lang.String getUnqualifiedClassName(java.lang.Class clazz) Get unqualified class name. Also beautifies names of arrays (eg 'String[]' instead of '[LString;').- Returns:
- The unqualified (without package) name of a class.
 
 - 
getUnqualifiedTypeNamepublic static java.lang.String getUnqualifiedTypeName(java.lang.String name) Get unqualified type name.- Returns:
- The unqualified (without package) name of a class.
 
 - 
getTypeNamepublic static java.lang.String getTypeName(java.lang.String name) Get unqualified type name.- Returns:
- The unqualified (without package) name of a class.
 
 - 
makeNiceArrayNotationpublic static java.lang.String makeNiceArrayNotation(java.lang.String name) Process a type name and replace array notation with nice one.
 - 
cutPackageFromClassNamepublic static java.lang.String cutPackageFromClassName(java.lang.String name) Cut package off from classname.
 - 
mainpublic static void main(java.lang.String[] args) 
 - 
getInnerClassNamepublic static java.lang.String getInnerClassName(java.lang.Class<?> clazz) Get inner class name.- Returns:
- The inner class's name (without declaring class).
 
 - 
getPackageNamepublic static java.lang.String getPackageName(java.lang.Class<?> clazz) Get the package of a class.- Returns:
- The name of the package.
 
 - 
chooseAvailableResourcepublic static java.lang.String chooseAvailableResource(java.lang.String... choices) Select the first available resource from a choice of potential resources. Allows, e.g. swapping alternative implementations in the classpath.
 - 
chooseAvailableResourcepublic static java.lang.String chooseAvailableResource(java.lang.ClassLoader cl, java.lang.String... choices)Select the first available resource from a choice of potential resources. Allows, e.g. swapping alternative implementations in the classpath.
 - 
getMethodSignaturepublic static java.lang.String getMethodSignature(java.lang.reflect.Method method) Get the generic signature of a method.- Parameters:
- method- The method.
- Returns:
- The signature name.
 
 - 
getFieldpublic static java.lang.reflect.Field getField(java.lang.Class clazz, java.lang.String name)Get a field of the class, or any of it's superclasses. UnlikeClass.getField(String), this will also return nonpublic fields (except when running in netscape :-( ).- Parameters:
- clazz- The class to search.
- name- The name of the field to search for.
- Returns:
- The field (or null if not found).
 
 - 
getCachedFieldpublic static java.lang.reflect.Field getCachedField(java.lang.Class clazz, java.lang.String name) throws java.lang.NoSuchFieldExceptionGet a cached field.- Parameters:
- clazz- The clazz.
- name- The name.
- Returns:
- The field.
- Throws:
- java.lang.NoSuchFieldException
 
 - 
getDeclaredpublic static java.lang.Object getDeclared(java.lang.Object o, java.lang.String fieldname)Get the declared object, doesnt cumulate through superclasses.- Parameters:
- o- The object.
- fieldname- The name of the array.
 
 - 
getMethodpublic static java.lang.reflect.Method getMethod(java.lang.Class<?> clazz, java.lang.String name, java.lang.Class<?>[] types)Get a public method of the class. UnlikeClass.getMethod(String, Class[]), this uses the methodcache.- Parameters:
- clazz- The class to search.
- name- The name of the method to search for.
- types- The parameter types.
- Returns:
- The method (or null if not found).
 
 - 
getAnyMethodpublic static java.lang.reflect.Method getAnyMethod(java.lang.Class<?> clazz, java.lang.String name, java.lang.Class<?>[] types)Get a method of the class. UnlikeClass.getMethod(String, Class[]), this uses the methodcache.- Parameters:
- clazz- The class to search.
- name- The name of the method to search for.
- types- The parameter types.
- Returns:
- The method (or null if not found).
 
 - 
getMethodspublic static java.lang.reflect.Method[] getMethods(java.lang.Class clazz, java.lang.String name)Get public method(s) of the class by name.- Parameters:
- clazz- The class to search.
- name- The name of the method to search for.
- Returns:
- The method(s).
 
 - 
getAllMethodspublic static java.lang.reflect.Method[] getAllMethods(java.lang.Class<?> clazz, java.lang.String name)Get all method(s) of the class by name, including public, protected and private methods.- Parameters:
- clazz- The class to search.
- name- The name of the method to search for.
- Returns:
- The method(s).
 
 - 
getAllMethodspublic static java.lang.reflect.Method[] getAllMethods(java.lang.Class clazz) Get all methods of a class including public, protected and private methods of the class and its superclasses.- Returns:
- Array of all methods starting from the current class upwards towards Object.class.
 
 - 
getDeclaredMethod0public static final java.lang.reflect.Method getDeclaredMethod0(java.lang.Class<?> clazz, java.lang.String methodname, java.lang.Class<?>... parametertypes)Gets a declared methods similar to Class.getDeclaredMethod() but returns null instead of throwing exception.- Parameters:
- clazz- The class being operated on.
- methodname- Name of the method.
- parametertypes- The parameter types.
- Returns:
- Method, if declared method is found in the class, null otherwise.
 
 - 
getDeclaringInterfacepublic static final java.lang.Class<?> getDeclaringInterface(java.lang.Class<?> iface, java.lang.String methodname, java.lang.Class<?>... parametertypes)Finds the declaring interface of a method in a multiple-inheritance interface using a breadth-first approach.- Parameters:
- iface- The starting interface.
- methodname- The method name.
- parametertypes- The method parameter types.
- Returns:
- The declaring interface or null if none is found.
 
 - 
getAllFieldspublic static java.lang.reflect.Field[] getAllFields(java.lang.Class clazz) Get all fields of a class including public, protected and private fields of the class and its superclasses.- Returns:
- Array of all fields starting from the current class upwards towards Object.class.
 
 - 
findClasspublic static <T> java.lang.Class<T> findClass(java.lang.String clname, java.lang.String[] imports, java.lang.ClassLoader classloader) throws java.lang.ClassNotFoundExceptionFind a class. When the class name is not fully qualified, the list of imported packages is searched for the class.- Parameters:
- clname- The class name.
- imports- The comma separated list of imported packages.
- Throws:
- java.lang.ClassNotFoundException- when the class is not found in the imports.
 
 - 
findClass0public static <T> java.lang.Class<T> findClass0(java.lang.String clname, java.lang.String[] imports, java.lang.ClassLoader classloader)Find a class. Also supports basic types and arrays. When the class name is not fully qualified, the list of imported packages is searched for the class.- Parameters:
- clname- The class name.
- imports- The comma separated list of imported packages.
- Returns:
- null, when the class is not found in the imports.
 
 - 
newInstancepublic static final java.lang.Object newInstance(java.lang.String classname, java.lang.Object... conparams)Reflectively instantiates an object by heuristically matching the constructor parameters.- Parameters:
- classname- Name of the object class.
- conparams- Constructor parameters.
- Returns:
- Instantiated object.
 
 - 
newInstancepublic static final java.lang.Object newInstance(java.lang.String classname, java.lang.ClassLoader cl, java.lang.Object... conparams)Reflectively instantiates an object by heuristically matching the constructor parameters.- Parameters:
- classname- Name of the object class.
- cl- The classloader to find the class.
- conparams- Constructor parameters.
- Returns:
- Instantiated object.
 
 - 
matchArgumentTypespublic static int[] matchArgumentTypes(java.lang.Class[] argtypes, java.lang.Class[][] paramtypes)Match the given argument types to a set of parameter type arrays. The argument type array may contain null values, when an argument type is unknown. For convenience, the length of a parameter type array does not have to equal the argument array length. (although it will of course never match). The method returns the indices of the matching parameter type arrays. An empty array is returned, if no match is found. The returned matches are sorted by quality (best match first).- Parameters:
- argtypes- The array of argument types.
- paramtypes- The array of parameter type arrays.
- Returns:
- The indices of the matching parameter type arrays.
 
 - 
fillArgumentspublic static java.lang.Object[] fillArguments(java.lang.Object[] args, java.lang.Class<?>[] paramtypes)Map arguments to parameters using varargs, if necessary.
 - 
isSupertypepublic static boolean isSupertype(java.lang.Class<?> clazz1, java.lang.Class<?> clazz2)Check if a class is a supertype of, or the same as another class. Maps basic types to wrapped types, and respects the basic type hierarchy.- Parameters:
- clazz1- The assumed supertype.
- clazz2- The assumed subtype.
- Returns:
- True, if clazz1 is a supertype of, or the same as clazz2.
 
 - 
convertWrappedValuepublic static java.lang.Object convertWrappedValue(java.lang.Object value, java.lang.Class clazz)Convert a value to the correct wrapped type. Assumes that the conversion is possible.- Parameters:
- value- The value.
- clazz- The target clazz.
- Returns:
- The converted value.
- See Also:
- isSupertype(Class, Class)
 
 - 
getIterablepublic static <T> java.lang.Iterable<T> getIterable(java.lang.Object collection) Get an iterator for an arbitrary collection object. Supports iterators, enumerations, java.util.Collections, java.util.Maps, arrays. Null is converted to empty iterator.- Parameters:
- collection- The collection object.
- Returns:
- An iterator over the collection.
- Throws:
- java.lang.IllegalArgumentException- when argument is not one of (Iterator, Enumeration, Collection, Map, Array).
 
 - 
getIteratorpublic static <T> java.util.Iterator<T> getIterator(java.lang.Object collection) Get an iterator for an arbitrary collection object. Supports iterators, enumerations, java.util.Collections, java.util.Maps, arrays. Null is converted to empty iterator.- Parameters:
- collection- The collection object.
- Returns:
- An iterator over the collection.
- Throws:
- java.lang.IllegalArgumentException- when argument is not one of (Iterator, Enumeration, Collection, Map, Array).
 
 - 
isIterablepublic static boolean isIterable(java.lang.Object obj) Test if object is some kind of collection.- Parameters:
- obj- The object.
- Returns:
- True if is iterable.
 
 - 
isIterableClasspublic static boolean isIterableClass(java.lang.Class clazz) Test if class is some kind of collection.- Parameters:
- clazz- The class.
- Returns:
- True if is iterable.
 
 - 
getIterableComponentTypepublic static java.lang.Class getIterableComponentType(java.lang.reflect.Type type) Get the component type of a class that is some kind of collection.- Parameters:
- clazz- The class.
- Returns:
- The component type, i.e. type of contained elements as defined in collection class.
 
 - 
createCompositepublic static java.lang.Object createComposite(java.lang.reflect.Type type, java.util.Collection<?> values)Create an fill an object of a class that is some kind of collection.- Parameters:
- clazz- The class.
- values- The values.
 
 - 
getArraypublic static java.lang.Object getArray(java.lang.Object collection) Get an array for an arbitrary collection object. Supports iterators, enumerations, java.util.Collections, java.util.Maps, arrays. Null is converted to empty array.- Parameters:
- collection- The collection object.
- Returns:
- An array over the collection.
- Throws:
- java.lang.IllegalArgumentException- when argument is not one of (Iterator, Enumeration, Collection, Map, Array).
 
 - 
instanceOfpublic static boolean instanceOf(java.lang.Object o, java.lang.Class c)Is an object instanceof a class or its superclasses.- Parameters:
- o- The object.
- c- The class.
- Returns:
- True, when o is instance of class c.
 
 - 
getSuperInterfacespublic static java.lang.Class[] getSuperInterfaces(java.lang.Class[] interfaces) Get the super interfaces.- Parameters:
- interfaces- The interfaces
- Returns:
- All super interfaces.
 
 - 
getDefaultValuepublic static java.lang.Object getDefaultValue(java.lang.Class clazz) Get default value for basic types.
 - 
getExportedMethodpublic static final java.lang.reflect.Method getExportedMethod(java.lang.Class<?> clazz, java.lang.String name, java.lang.Class<?>... params)Gets a method that is exported by the module.- Parameters:
- clazz- Class with the method.
- name- Name of the method.
- params- Method parameters.
- Returns:
- The method or null if not found.
 
 - 
isExportedpublic static final boolean isExported(java.lang.Class<?> clazz) Tests if the class is part of a package that the containing module has exported.- Parameters:
- clazz- The class.
- Returns:
- True, if exported.
 
 - 
getMethodNamepublic static java.lang.String getMethodName() Get the current method name from the caller.- Returns:
- The method name.
 
 - 
scanForClassespublic static java.lang.Class<?>[] scanForClasses(java.lang.ClassLoader classloader, IFilter filefilter, IFilter classfilter, boolean includebootpath)Scan for classes that fulfill certain criteria as specified by the file and classfilters.
 - 
scanForClassespublic static java.lang.Class<?>[] scanForClasses(java.net.URL[] urls, java.lang.ClassLoader classloader, IFilter filefilter, IFilter classfilter)Scan for classes that fulfill certain criteria as specified by the file and classfilters.
 - 
scanForFilespublic static java.lang.String[] scanForFiles(java.net.URL[] urls, IFilter<java.lang.Object> filter)Scan for files in a given list of urls.
 - 
scanForClassInfospublic static java.util.Set<SClassReader.ClassInfo> scanForClassInfos(java.net.URL[] urls, IFilter<java.lang.Object> filefilter, IFilter<SClassReader.ClassInfo> classfilter) Scan for component classes in the classpath.
 - 
scanForClassFileInfospublic static java.util.Set<SClassReader.ClassFileInfo> scanForClassFileInfos(java.net.URL[] urls, IFilter<java.lang.Object> filefilter, IFilter<SClassReader.ClassFileInfo> classfilter) Scan for component classes in the classpath.
 - 
scanForFiles2public static java.util.Map<java.lang.String,java.util.Set<java.lang.String>> scanForFiles2(java.net.URL[] urls, IFilter<java.lang.Object> filter)Scan for files in a given list of urls.
 - 
scanDirpublic static void scanDir(java.net.URL[] urls, java.io.File file, IFilter<java.lang.Object> filter, java.util.Collection<java.lang.String> results, java.util.List<java.lang.String> donedirs)Scan directories.
 - 
scanDir2public static void scanDir2(java.net.URL[] urls, java.io.File file, IFilter<java.lang.Object> filter, java.util.Collection<java.lang.String> results, java.util.List<java.lang.String> donedirs)Scan directories.
 - 
setAndroidprotected static void setAndroid(boolean isAndroidFlag, boolean isAndroidTestingFlag)private setter that can be made accessible for robolectric testcases.
 - 
isAndroidTestingpublic static java.lang.Boolean isAndroidTesting() 
 - 
isAndroidpublic static boolean isAndroid() Test if running on android.
 
- 
 
-