1 28 29 package com.caucho.config; 30 31 import com.caucho.util.L10N; 32 33 import java.util.ArrayList ; 34 35 public class BuilderProgramContainer extends BuilderProgram { 36 static final L10N L = new L10N(BuilderProgramContainer.class); 37 38 private ArrayList <BuilderProgram> _programList = 39 new ArrayList <BuilderProgram>(); 40 41 public BuilderProgramContainer() 42 { 43 this(NodeBuilder.getCurrentBuilder()); 44 } 45 46 public BuilderProgramContainer(NodeBuilder builder) 47 { 48 super(builder); 49 } 50 51 public void addProgram(BuilderProgram program) 52 { 53 _programList.add(program); 54 } 55 56 public void configureImpl(NodeBuilder builder, Object bean) 57 throws ConfigException 58 { 59 for (int i = 0; i < _programList.size(); i++) { 60 BuilderProgram program = _programList.get(i); 61 62 program.configureImpl(builder, bean); 63 } 64 } 65 66 protected Object configureImpl(NodeBuilder builder, Class type) 67 throws ConfigException 68 { 69 Object bean = null; 70 71 for (int i = 0; i < _programList.size(); i++) { 72 BuilderProgram program = _programList.get(i); 73 74 if (bean == null) 75 bean = program.configureImpl(builder, type); 76 else 77 program.configureImpl(builder, bean); 78 } 79 80 return bean; 81 } 82 } 83 | Popular Tags |