Class SimpleFactory

  • All Implemented Interfaces:
    WrapperFactory

    public class SimpleFactory
    extends Object
    implements WrapperFactory
    This class can be used for creating new instances. Instances for a specific interface are created using the Registry of implementation types. The factory does a lookup in the registry for retrieving the implementation class. This class should have a public constructor with argument types (int, HttpServletRequest, HttpServletResponse). This contructor will be invoked for creating a new instance for the specified interface and id.
    • Constructor Detail

      • SimpleFactory

        public SimpleFactory()
    • Method Detail

      • getHttpServletRequest

        protected javax.servlet.http.HttpServletRequest getHttpServletRequest()
        Returns the request for this factory.
        Returns:
        the request for this factory
      • setHttpServletRequest

        public void setHttpServletRequest​(javax.servlet.http.HttpServletRequest request)
        Set the request object.
        Specified by:
        setHttpServletRequest in interface WrapperFactory
        Parameters:
        request - The request for the factory
      • getHttpServletResponse

        protected javax.servlet.http.HttpServletResponse getHttpServletResponse()
        Returns the response for this factory.
        Returns:
        the response for this factory
      • setHttpServletResponse

        public void setHttpServletResponse​(javax.servlet.http.HttpServletResponse response)
        Set the response object.
        Specified by:
        setHttpServletResponse in interface WrapperFactory
        Parameters:
        response - The request for the factory
      • getInstance

        public Object getInstance​(int id,
                                  Class targetClass)
        Create an instance of the specified class, with the specified id.
        Specified by:
        getInstance in interface WrapperFactory
        Parameters:
        id - The identifier for the new instance.
        targetClass - The type of the new instance
        Returns:
        The new instance of the specified type, with the specified id.
      • getInstance

        public Object getInstance​(int id,
                                  Class targetClass,
                                  boolean fromWrapperRegistry)
        Create an instance of the specified class, with the specified id.
        Parameters:
        id - The identifier for the new instance.
        targetClass - The type of the new instance
        fromWrapperRegistry - whether called from wrapper registry
        Returns:
        The new instance of the specified type, with the specified id.
      • getInstance

        public Object getInstance​(int id,
                                  String targetClassname)
        Description copied from interface: WrapperFactory
        Returns an instance of the class represented by the given string. Needed for classes that are only loaded in the framework and not in SiteWorks.
        Specified by:
        getInstance in interface WrapperFactory
        Returns:
        Object with HtmlObject-id id and of class represented by targetClassname
      • createInstance

        public Object createInstance​(String targetClassname)
        Description copied from interface: WrapperFactory
        Create new object of class represented by the string. Should be a fully qualified classname
        Specified by:
        createInstance in interface WrapperFactory
        Returns:
        Object of given class