Class OReflectionHelper

java.lang.Object
com.orientechnologies.common.reflection.OReflectionHelper

public class OReflectionHelper extends Object
Helper class to browse .class files. See also: http://forums.sun.com/thread.jspa?threadID=341935&start=15&tstart=0
Author:
Antony Stubbs
  • Constructor Details

    • OReflectionHelper

      public OReflectionHelper()
  • Method Details

    • getClassesFor

      public static List<Class<?>> getClassesFor(Collection<String> classNames, ClassLoader classLoader) throws ClassNotFoundException
      Throws:
      ClassNotFoundException
    • getClassesFor

      public static List<Class<?>> getClassesFor(String iPackageName, ClassLoader iClassLoader) throws ClassNotFoundException
      Throws:
      ClassNotFoundException
    • getClassessOfInterface

      public static List<Class<?>> getClassessOfInterface(String thePackage, Class<?> theInterface, ClassLoader iClassLoader)
      Filters discovered classes to see if they implement a given interface.
      Parameters:
      thePackage -
      theInterface -
      iClassLoader -
      Returns:
      The list of classes that implements the requested interface
    • getGenericTypes

      public static Type[] getGenericTypes(Class<?> iClass)
      Returns the declared generic types of a class.
      Parameters:
      iClass - Class to examine
      Returns:
      The array of Type if any, otherwise null
    • getGenericMultivalueType

      public static Class<?> getGenericMultivalueType(Field p)
      Returns the generic class of multi-value objects.
      Parameters:
      p - Field to examine
      Returns:
      The Class<?> of generic type if any, otherwise null
    • isJavaType

      public static boolean isJavaType(Class<?> clazz)
      Checks if a class is a Java type: Map, Collection,arrays, Number (extensions and primitives), String, Boolean..
      Parameters:
      clazz - Class<?> to examine
      Returns:
      true if clazz is Java type, false otherwise