001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     * 
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     * 
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */ 
017    package org.apache.commons.betwixt.io.read;
018    
019    /**  
020      * Creator of beans that may delegate responsibility to members down the chain.
021      *
022      * @author Robert Burrell Donkin
023      * @since 0.5
024      */
025    public interface ChainedBeanCreator {
026        
027        /**
028          * Creates a bean either directly or by delegating the responsibility to the other
029          * members of the chain.
030          *
031          * @param elementMapping  specifies the mapping between the type and element.
032          * <strong>Note</strong> it is recommended that classes do not store a permenant
033          * reference to this object since these objects may later be reused.
034          * Not null
035          * @param context the context in which this converision happens, not null
036          * @param chain not null
037          * @return the Object created, possibly null
038          */
039        
040        // TODO: is element mapping really necessary here?
041        // TODO: what about exception handling? 
042        public Object create(
043                                ElementMapping elementMapping, 
044                                ReadContext context, 
045                                BeanCreationChain chain);
046        
047    }