alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

PicoContainer example source code file (ComponentFactory.java)

This example PicoContainer source code file (ComponentFactory.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - PicoContainer tags/keywords

class, componentadapter, componentfactory, componentfactory, lifecyclestrategy, lifecyclestrategy, object, object, parameter, picocompositionexception, properties, properties, util

The PicoContainer ComponentFactory.java source code

/*****************************************************************************
 * Copyright (C) PicoContainer Organization. All rights reserved.            *
 * ------------------------------------------------------------------------- *
 * The software in this package is published under the terms of the BSD      *
 * style license a copy of which has been included with this distribution in *
 * the LICENSE.txt file.                                                     *
 *                                                                           *
 * Original code by                                                          *
 *****************************************************************************/
package org.picocontainer;

import org.picocontainer.ComponentAdapter;
import org.picocontainer.Parameter;
import org.picocontainer.PicoCompositionException;
import org.picocontainer.ComponentMonitor;
import org.picocontainer.LifecycleStrategy;

import java.util.Properties;

/**
 * <p/>
 * A component factory is responsible for creating
 * {@link ComponentAdapter} component adapters. The main use of the component factory is
 * inside {@link DefaultPicoContainer#DefaultPicoContainer(ComponentFactory)}, where it can
 * be used to customize the default component adapter that is used when none is specified
 * explicitly.
 * </p>
 *
 * @author Jon Tirsén
 * @author Mauro Talevi
 * @version $Revision: 3659 $
 */
public interface ComponentFactory {

    /**
     * Create a new component adapter based on the specified arguments.
     *
     * @param componentMonitor
     * @param lifecycleStrategy
     * @param componentProperties
     * @param componentKey            the key to be associated with this adapter. This value should be returned
     *                                from a call to {@link ComponentAdapter#getComponentKey()} on the created adapter.
     * @param componentImplementation the implementation class to be associated with this adapter.
     *                                This value should be returned from a call to
     *                                {@link ComponentAdapter#getComponentImplementation()} on the created adapter. Should not
     *                                be null.
     * @param parameters              additional parameters to use by the component adapter in constructing
     *                                component instances. These may be used, for example, to make decisions about the
     *                                arguments passed into the component constructor. These should be considered hints; they
     *                                may be ignored by some implementations. May be null, and may be of zero length.
     *
     * @return a new component adapter based on the specified arguments. Should not return null.
     *
     * @throws PicoCompositionException if the creation of the component adapter results in a
     *                                  {@link PicoCompositionException}. @return The component adapter
     */
    ComponentAdapter createComponentAdapter(ComponentMonitor componentMonitor,
                                            LifecycleStrategy lifecycleStrategy,
                                            Properties componentProperties,
                                            Object componentKey,
                                            Class componentImplementation,
                                            Parameter... parameters) throws PicoCompositionException;


}

Other PicoContainer examples (source code examples)

Here is a short list of links related to this PicoContainer ComponentFactory.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.