Interface InstanceFactory

All Known Implementing Classes:
SpringContextInstanceFactory

public interface InstanceFactory
An interface to easily instantiate objects from classes.
  • Method Details

    • getInstance

      Object getInstance(String className) throws ClassNotFoundException
      Get an instance of a class.
      Parameters:
      className - name of class.
      Returns:
      instance of class.
      Throws:
      ClassNotFoundException - if the class does not exist.
    • getInstance

      Object getInstance(String className, ClassLoader classLoader) throws ClassNotFoundException
      Get an instance of a class from a specific classloader.
      Parameters:
      className - name of class.
      classLoader - class loader.
      Returns:
      instance of class.
      Throws:
      ClassNotFoundException - if the class does not exist.
    • getInstance

      <T> T getInstance(Class<T> clazz)
      Gets an instance of a class.
      Type Parameters:
      T - type of class.
      Parameters:
      clazz - class.
      Returns:
      instance of class.