001/**
002 * Get more info at : www.jrebirth.org .
003 * Copyright JRebirth.org © 2011-2016
004 * Contact : sebastien.bordes@jrebirth.org
005 *
006 * Licensed under the Apache License, Version 2.0 (the "License");
007 * you may not use this file except in compliance with the License.
008 * You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.jrebirth.af.api.component.factory;
019
020import java.util.List;
021
022import org.jrebirth.af.api.exception.CoreException;
023
024/**
025 * The interface <strong>ComponentFactory</strong> is used to build EnhancedComponent (Model, Service, Command) classes.
026 *
027 * @author Sébastien Bordes
028 */
029public interface ComponentFactory {
030
031    /**
032     * Define a Component contract.
033     *
034     * @param item the registration point item
035     */
036    void define(final RegistrationPointItem item);
037
038    /**
039     * Register an implementation class for an interface.
040     *
041     * @param item the registration item
042     */
043    void register(final RegistrationItem item);
044
045    /**
046     * Build a fresh instance of a component.<br />
047     * (that implements {@link org.jrebirth.af.api.facade.FacadeReady.FacadeReady} interface)
048     *
049     * @param clazz the component class
050     *
051     * @return a list of fresh instance of components
052     *
053     * @param <R> the ReadyObject, it's a component class
054     *
055     * @throws CoreException CoreException if an error has occurred
056     */
057    <R extends Object> List<R> buildComponents(final Class<R> clazz) throws CoreException;
058
059}