Interface ObjectFactory

  • All Known Implementing Classes:
    DefaultObjectFactory

    public interface ObjectFactory
    A simple interface for creating class instances
    Version:
    $Revision: 5951 $ $Date: 2003-04-23 00:36:31 -0600 (Wed, 23 Apr 2003) $
    Author:
    Keith Visco
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.Object createInstance​(java.lang.Class type)
      Creates a default instance of the given class.
      java.lang.Object createInstance​(java.lang.Class type, java.lang.Class[] argTypes, java.lang.Object[] args)
      Creates a default instance of the given class.
      java.lang.Object createInstance​(java.lang.Class type, java.lang.Object[] args)
      Creates a default instance of the given class.
    • Method Detail

      • createInstance

        java.lang.Object createInstance​(java.lang.Class type)
                                 throws java.lang.IllegalAccessException,
                                        java.lang.InstantiationException
        Creates a default instance of the given class.
        Parameters:
        type - the Class to create an instance of
        Returns:
        the new instance of the given class
        Throws:
        java.lang.IllegalAccessException
        java.lang.InstantiationException
      • createInstance

        java.lang.Object createInstance​(java.lang.Class type,
                                        java.lang.Object[] args)
                                 throws java.lang.IllegalAccessException,
                                        java.lang.InstantiationException
        Creates a default instance of the given class.
        Parameters:
        type - the Class to create an instance of
        args - the array of arguments to pass to the Class constructor
        Returns:
        the new instance of the given class
        Throws:
        java.lang.IllegalAccessException
        java.lang.InstantiationException
      • createInstance

        java.lang.Object createInstance​(java.lang.Class type,
                                        java.lang.Class[] argTypes,
                                        java.lang.Object[] args)
                                 throws java.lang.IllegalAccessException,
                                        java.lang.InstantiationException
        Creates a default instance of the given class.
        Parameters:
        type - the Class to create an instance of
        argTypes - the Class types for each argument, used to find the correct constructor
        args - the array of arguments to pass to the Class constructor
        Returns:
        the new instance of the given class
        Throws:
        java.lang.IllegalAccessException
        java.lang.InstantiationException