Class ClassUtils

java.lang.Object
net.sf.jasperreports.engine.util.ClassUtils

public final class ClassUtils extends Object
Class utilities.
Author:
Lucian Chirita (lucianc@users.sourceforge.net)
  • Field Details

    • EXCEPTION_MESSAGE_KEY_CLASS_INSTANCE_ERROR

      public static final String EXCEPTION_MESSAGE_KEY_CLASS_INSTANCE_ERROR
      See Also:
    • EXCEPTION_MESSAGE_KEY_CLASS_LOADING_ERROR

      public static final String EXCEPTION_MESSAGE_KEY_CLASS_LOADING_ERROR
      See Also:
    • EXCEPTION_MESSAGE_KEY_CLASS_UNEXPECTED_TYPE

      public static final String EXCEPTION_MESSAGE_KEY_CLASS_UNEXPECTED_TYPE
      See Also:
  • Method Details

    • instantiateClass

      public static final Object instantiateClass(String className, Class<?> expectedType)
      Instantiates a class.

      The class is expected to have a public no-argument constructor.

      Parameters:
      className - the class name
      expectedType - the expected (super) type of the result
      Returns:
      a newly created instance of the specified class
      Throws:
      JRRuntimeException - if the class cannot be loaded or instantiated, or if it does not implement the expected type
    • getInterfaces

      public static List<Class<?>> getInterfaces(Class<?> clazz)
      Parameters:
      clazz -
      Returns:
      a list of interfaces implemented by this class and by its superclasses, or an empty list in case there are no implemented interfaces