1. /*
  2. * Copyright 2001-2004 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package org.apache.commons.betwixt.io.read;
  17. /**
  18. * A Chain of bean creators.
  19. *
  20. * @author Robert Burrell Donkin
  21. * @since 0.5
  22. */
  23. public abstract class BeanCreationChain {
  24. //-------------------------------------------------------- Class Methods
  25. /**
  26. * Creates the default <code>BeanCreationChain</code> used when reading beans.
  27. * @return a <code>BeanCreationList</code> with the default creators loader in order, not null
  28. */
  29. public static final BeanCreationChain createDefaultChain() {
  30. // this delegates to the list but this is the canonical version
  31. // the implementation may change later
  32. return BeanCreationList.createStandardChain();
  33. }
  34. //-------------------------------------------------------- Instance Methods
  35. /**
  36. * Create a bean for the given mapping in the given context.
  37. *
  38. * @param elementMapping specifies the mapping between the type and element.
  39. * <strong>Note</strong> it is recommended that classes do not store a permenant
  40. * reference to this object since these objects may later be reused.
  41. * Not null
  42. * @param context the context in which this creation happens, not null
  43. * @return the bean, possibly null
  44. */
  45. public abstract Object create(ElementMapping elementMapping, ReadContext context);
  46. }