Interface InstanceManager

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default void backgroundProcess()
      Called by the component using the InstanceManager periodically to perform any regular maintenance that might be required.
      void destroyInstance​(java.lang.Object o)
      Destroy the given instance, performing pre-destroy callbacks.
      java.lang.Object newInstance​(java.lang.Class<?> clazz)
      Create a new instance of the given class.
      void newInstance​(java.lang.Object o)
      Perform dependency injection on the given object.
      java.lang.Object newInstance​(java.lang.String className)
      Create a new instance of the class with the given name.
      java.lang.Object newInstance​(java.lang.String fqcn, java.lang.ClassLoader classLoader)
      Create a new instance of the class with the given name using the specified class loader.
    • Method Detail

      • newInstance

        java.lang.Object newInstance​(java.lang.Class<?> clazz)
                              throws java.lang.IllegalAccessException,
                                     java.lang.reflect.InvocationTargetException,
                                     javax.naming.NamingException,
                                     java.lang.InstantiationException,
                                     java.lang.IllegalArgumentException,
                                     java.lang.NoSuchMethodException,
                                     java.lang.SecurityException
        Create a new instance of the given class.
        Parameters:
        clazz - The class to instantiate
        Returns:
        the new instance
        Throws:
        java.lang.IllegalAccessException - if the class or its nullary constructor is not accessible
        java.lang.reflect.InvocationTargetException - if the nullary constructor throws an exception
        javax.naming.NamingException - if a naming exception is encountered
        java.lang.InstantiationException - if this Class represents an abstract class, an interface, an array class, a primitive type, or void
        java.lang.IllegalArgumentException - if this method is invoked with illegal arguments
        java.lang.NoSuchMethodException - if the nullary method cannot be found
        java.lang.SecurityException - if a security manager, s, is present
      • newInstance

        java.lang.Object newInstance​(java.lang.String className)
                              throws java.lang.IllegalAccessException,
                                     java.lang.reflect.InvocationTargetException,
                                     javax.naming.NamingException,
                                     java.lang.InstantiationException,
                                     java.lang.ClassNotFoundException,
                                     java.lang.IllegalArgumentException,
                                     java.lang.NoSuchMethodException,
                                     java.lang.SecurityException
        Create a new instance of the class with the given name.
        Parameters:
        className - The name of the class to instantiate
        Returns:
        the new instance
        Throws:
        java.lang.IllegalAccessException - if the class or its nullary constructor is not accessible
        java.lang.reflect.InvocationTargetException - if the nullary constructor throws an exception
        javax.naming.NamingException - if a naming exception is encountered
        java.lang.InstantiationException - if this Class represents an abstract class, an interface, an array class, a primitive type, or void
        java.lang.ClassNotFoundException - if the class cannot be found
        java.lang.IllegalArgumentException - if this method is invoked with illegal arguments
        java.lang.NoSuchMethodException - if the nullary method cannot be found
        java.lang.SecurityException - if a security manager, s, is present
      • newInstance

        java.lang.Object newInstance​(java.lang.String fqcn,
                                     java.lang.ClassLoader classLoader)
                              throws java.lang.IllegalAccessException,
                                     java.lang.reflect.InvocationTargetException,
                                     javax.naming.NamingException,
                                     java.lang.InstantiationException,
                                     java.lang.ClassNotFoundException,
                                     java.lang.IllegalArgumentException,
                                     java.lang.NoSuchMethodException,
                                     java.lang.SecurityException
        Create a new instance of the class with the given name using the specified class loader.
        Parameters:
        fqcn - The fully qualified class name
        classLoader - The class loader to use for loading the class
        Returns:
        the new instance
        Throws:
        java.lang.IllegalAccessException - if the class or its nullary constructor is not accessible
        java.lang.reflect.InvocationTargetException - if the nullary constructor throws an exception
        javax.naming.NamingException - if a naming exception is encountered
        java.lang.InstantiationException - if this Class represents an abstract class, an interface, an array class, a primitive type, or void
        java.lang.ClassNotFoundException - if the class cannot be found
        java.lang.IllegalArgumentException - if this method is invoked with illegal arguments
        java.lang.NoSuchMethodException - if the nullary method cannot be found
        java.lang.SecurityException - if a security manager, s, is present
      • newInstance

        void newInstance​(java.lang.Object o)
                  throws java.lang.IllegalAccessException,
                         java.lang.reflect.InvocationTargetException,
                         javax.naming.NamingException
        Perform dependency injection on the given object.
        Parameters:
        o - The object to inject dependencies into
        Throws:
        java.lang.IllegalAccessException - if the class or its nullary constructor is not accessible
        java.lang.reflect.InvocationTargetException - if the nullary constructor throws an exception
        javax.naming.NamingException - if a naming exception is encountered
      • destroyInstance

        void destroyInstance​(java.lang.Object o)
                      throws java.lang.IllegalAccessException,
                             java.lang.reflect.InvocationTargetException
        Destroy the given instance, performing pre-destroy callbacks.
        Parameters:
        o - The object to destroy
        Throws:
        java.lang.IllegalAccessException - if the class or its nullary constructor is not accessible
        java.lang.reflect.InvocationTargetException - if the nullary constructor throws an exception
      • backgroundProcess

        default void backgroundProcess()
        Called by the component using the InstanceManager periodically to perform any regular maintenance that might be required. By default, this method is a NO-OP.