com.sun.jsftemplating.component.factory.ComponentFactory Maven / Gradle / Ivy
/*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the license at
* https://jsftemplating.dev.java.net/cddl1.html or
* jsftemplating/cddl1.txt.
* See the License for the specific language governing
* permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at jsftemplating/cddl1.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* you own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
*/
package com.sun.jsftemplating.component.factory;
import java.io.Serializable;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import com.sun.jsftemplating.layout.descriptors.LayoutComponent;
/**
* This interface must be implemented by all UIComponent factories.
* This enabled UIComponents to be created via a consistent interface.
* This is critical to classes such as
* {@link com.sun.jsftemplating.component.TemplateComponentBase}
* and {@link LayoutComponent}.
*
* @author Ken Paulsen ([email protected])
*/
public interface ComponentFactory {
/**
* This is the factory method responsible for creating the
* UIComponent
.
*
* @param context The FacesContext
* @param descriptor The {@link LayoutComponent} descriptor associated
* with the requested UIComponent
.
* @param parent The parent UIComponent
*
* @return The newly created UIComponent
.
*/
public UIComponent create(FacesContext context, LayoutComponent descriptor, UIComponent parent);
/**
* This method returns the extraInfo that was set for this
* ComponentFactory
from the
* {@link com.sun.jsftemplating.layout.descriptors.ComponentType}.
*/
public Serializable getExtraInfo();
/**
* This method is invoked from the
* {@link com.sun.jsftemplating.layout.descriptors.ComponentType} to
* provide more information to the factory. For example, if the JSF
* component type was passed in, a single factory class could
* instatiate multiple components the extra info that is passed in.
*
* Some factory implementations may want to use this method to
* execute intialization code for the factory based in the value
* passed in.
*/
public void setExtraInfo(Serializable extraInfo);
}