1 17 package org.apache.ws.jaxme.sqls.impl; 18 19 import org.apache.ws.jaxme.sqls.Case; 20 import org.apache.ws.jaxme.sqls.Column; 21 import org.apache.ws.jaxme.sqls.Function; 22 import org.apache.ws.jaxme.sqls.SQLFactory; 23 import org.apache.ws.jaxme.sqls.Statement; 24 import org.apache.ws.jaxme.sqls.Table; 25 import org.apache.ws.jaxme.sqls.TableReference; 26 27 28 35 public abstract class StatementImpl implements Statement { 36 private SQLFactory factory; 37 private TableReference tableReference; 38 39 protected StatementImpl(SQLFactory pFactory) { 40 factory = pFactory; 41 } 42 43 public SQLFactory getSQLFactory() { 44 return factory; 45 } 46 47 protected TableReference newTableReference(Table pTable) { 48 return new TableReferenceImpl(this, pTable); 49 } 50 51 public TableReference setTable(Table pTable) { 52 if (pTable == null) { 53 throw new NullPointerException ("The table on which the statement operates must not be null."); 54 } 55 if (tableReference != null) { 56 throw new IllegalStateException ("The table on which the statement operates was already set."); 57 } 58 tableReference = newTableReference(pTable); 59 return tableReference; 60 } 61 62 public TableReference getTableReference() { 63 return tableReference; 64 } 65 66 public Function createFunction(String pName) { 67 return getSQLFactory().getObjectFactory().newFunction(this, pName); 68 } 69 70 public Case newCase(Column.Type pType) { 71 return getSQLFactory().getObjectFactory().newCase(pType); 72 } 73 } 74 | Popular Tags |