1 18 19 package org.apache.beehive.controls.system.jdbc.parser; 20 21 import org.apache.beehive.controls.api.context.ControlBeanContext; 22 23 import java.lang.reflect.Method ; 24 import java.util.ArrayList ; 25 26 29 public abstract class SqlFragmentContainer extends SqlFragment { 30 31 32 protected ArrayList <SqlFragment> _children; 33 34 37 SqlFragmentContainer() { 38 _children = new ArrayList <SqlFragment>(); 39 } 40 41 45 boolean hasParamValue() { 46 for (SqlFragment f : _children) { 47 if (f.hasParamValue()) { 48 return true; 49 } 50 } 51 return false; 52 } 53 54 58 void addChild(SqlFragment child) { 59 _children.add(child); 60 } 61 62 66 SqlFragment[] getChildren() { 67 SqlFragment[] fragments = new SqlFragment[_children.size()]; 68 return _children.toArray(fragments); 69 } 70 71 75 public String toString() { 76 StringBuilder s = new StringBuilder (); 77 for (SqlFragment f : _children) { 78 s.append(f.toString()); 79 } 80 return s.toString(); 81 } 82 83 91 String getPreparedStatementText(ControlBeanContext context, Method m, Object [] args) { 92 StringBuilder sb = new StringBuilder (); 93 for (SqlFragment sf : _children) { 94 sb.append(sf.getPreparedStatementText(context, m, args)); 95 } 96 return sb.toString(); 97 } 98 } 99 | Popular Tags |