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 * A Chain of bean creators.
021 *
022 * @author Robert Burrell Donkin
023 * @since 0.5
024 */
025 public abstract class BeanCreationChain {
026
027
028 //-------------------------------------------------------- Class Methods
029
030 /**
031 * Creates the default <code>BeanCreationChain</code> used when reading beans.
032 * @return a <code>BeanCreationList</code> with the default creators loader in order, not null
033 */
034 public static final BeanCreationChain createDefaultChain() {
035 // this delegates to the list but this is the canonical version
036 // the implementation may change later
037 return BeanCreationList.createStandardChain();
038 }
039
040 //-------------------------------------------------------- Instance Methods
041
042 /**
043 * Create a bean for the given mapping in the given context.
044 *
045 * @param elementMapping specifies the mapping between the type and element.
046 * <strong>Note</strong> it is recommended that classes do not store a permenant
047 * reference to this object since these objects may later be reused.
048 * Not null
049 * @param context the context in which this creation happens, not null
050 * @return the bean, possibly null
051 */
052 public abstract Object create(ElementMapping elementMapping, ReadContext context);
053
054 }