Class InstanceLoader

java.lang.Object
org.graffiti.util.InstanceLoader

public class InstanceLoader
extends Object
Represents an instance loader, which can be used to instantiate a class with the given name.
Since:
1.0
Version:
1.11
Recent revisions:
2.6.5
  • Constructor Details

    • InstanceLoader

      public InstanceLoader()
  • Method Details

    • overrideLoader

      public static void overrideLoader​(ClassLoader loader)
    • setClassLoader

      public static void setClassLoader​(ClassLoader newClassloader)
    • getCurrentLoader

      public static ClassLoader getCurrentLoader()
    • createInstance

      public static Object createInstance​(Class<?> theClass) throws InstanceCreationException
      Returns a new instance of the specified class.
      Parameters:
      theClass - the class to instantiate.
      Returns:
      newly instantiated instance of type theClass
      Throws:
      InstanceCreationException - when an instance couldn't be created
    • createInstance

      public static Object createInstance​(String name) throws InstanceCreationException
      Returns a new instance of the specified class.
      Parameters:
      name - the name of the class to instantiate.
      Returns:
      newly instantiated instance of type theClass
      Throws:
      InstanceCreationException - when an instance couldn't be created
    • createInstance

      public static Object createInstance​(String name, Object param) throws InstanceCreationException
      Returns a new instance of the specified class. Uses a constructor taking one argument.
      Parameters:
      name - the name of the class to instantiate.
      param - specified class' constructor argument
      Returns:
      newly instantiated instance of type theClass
      Throws:
      InstanceCreationException - when an instance couldn't be created
    • createInstance

      public static Object createInstance​(Class<?> theClass, String paramClassname, Object param) throws InstanceCreationException
      Returns a new instance of the specified class. Uses a constructor taking one argument.
      Parameters:
      theClass - the class to instantiate.
      paramClassname - the fully qualified name of the parameter class to instantiate.
      param - specified class' constructor argument
      Returns:
      newly instantiated instance of type theClass
      Throws:
      InstanceCreationException - when an instance couldn't be created
    • createInstance

      public static Object createInstance​(Class<?> theClass, Object param) throws InstanceCreationException
      Returns a new instance of the specified class. Uses a constructor taking one argument.
      Parameters:
      theClass - the name of the class to instantiate.
      param - specified class' constructor argument
      Returns:
      newly instantiated instance of type theClass
      Throws:
      InstanceCreationException - when an instance couldn't be created