org.apache.commons.betwixt.io.read
Class BeanCreationList

java.lang.Object
  extended by org.apache.commons.betwixt.io.read.BeanCreationChain
      extended by org.apache.commons.betwixt.io.read.BeanCreationList

public class BeanCreationList
extends BeanCreationChain

Chain implementation that's backed by a list. This is the default implementation used by Betwixt.

Note this implementation is not intended to allow multiple threads of execution to perform modification operations concurrently with traversal of the chain. Users who require this behaviour are advised to create their own implementation.

Since:
0.5
Author:
Robert Burrell Donkin

Constructor Summary
BeanCreationList()
           
 
Method Summary
 void addBeanCreator(ChainedBeanCreator beanCreator)
          Adds a BeanCreator to the end of the chain.
 void clearBeanCreators()
          Clears the creator chain.
 java.lang.Object create(ElementMapping elementMapping, ReadContext readContext)
          Creates an Object based on the given element mapping and read context.
static BeanCreationList createStandardChain()
          Creates the default BeanCreationChain used when reading beans.
 int getSize()
          Gets the number of BeanCreators in the wrapped chain.
 void insertBeanCreator(int index, ChainedBeanCreator beanCreator)
          Inserts a BeanCreator at the given position in the chain.
 
Methods inherited from class org.apache.commons.betwixt.io.read.BeanCreationChain
createDefaultChain
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanCreationList

public BeanCreationList()
Method Detail

createStandardChain

public static final BeanCreationList createStandardChain()
Creates the default BeanCreationChain used when reading beans.

Returns:
a BeanCreationList with the default creators loader in order, not null

create

public java.lang.Object create(ElementMapping elementMapping,
                               ReadContext readContext)
Creates an Object based on the given element mapping and read context. Delegates to chain.

Specified by:
create in class BeanCreationChain
Parameters:
elementMapping - the element mapping details
readContext - create against this context
Returns:
the created bean, possibly null

getSize

public int getSize()
Gets the number of BeanCreators in the wrapped chain.

Returns:
the number of ChainedBeanCreator's in the current chain

insertBeanCreator

public void insertBeanCreator(int index,
                              ChainedBeanCreator beanCreator)
                       throws java.lang.IndexOutOfBoundsException
Inserts a BeanCreator at the given position in the chain. Shifts the object currently in that position - and any subsequent elements - to the right.

Parameters:
index - index at which the creator should be inserted
beanCreator - the BeanCreator to be inserted, not null
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of the range (index < 0 || index > getSize())

addBeanCreator

public void addBeanCreator(ChainedBeanCreator beanCreator)
Adds a BeanCreator to the end of the chain.

Parameters:
beanCreator - the BeanCreator to be inserted, not null

clearBeanCreators

public void clearBeanCreators()
Clears the creator chain.



Copyright © 2002-2008 The Apache Software Foundation. All Rights Reserved.