1 17 package org.apache.ws.jaxme.sqls.impl; 18 19 import java.util.Iterator ; 20 21 import org.apache.ws.jaxme.sqls.Column; 22 import org.apache.ws.jaxme.sqls.Index; 23 import org.apache.ws.jaxme.sqls.Table; 24 25 26 30 public class ColumnImpl extends AbstractColumn { 31 public static class NameImpl extends SQLFactoryImpl.IdentImpl implements Column.Name { 32 public NameImpl(String pName) { 33 super(pName); 34 } 35 public boolean equals(Object o) { 36 return o != null && (o instanceof Column.Name) && super.equals(o); 37 } 38 } 39 public static class TypeImpl extends SQLFactoryImpl.IdentImpl implements Column.Type { 40 private int jdbcType; 41 public TypeImpl(String pName, int pJDBCType) { 42 super(pName); 43 jdbcType = pJDBCType; 44 } 45 public int getJDBCType() { 46 return jdbcType; 47 } 48 } 49 50 51 private Table table; 52 53 protected ColumnImpl(Table pTable, Column.Name pName, Column.Type pType) { 54 super(pName, pType); 55 table = pTable; 56 } 57 58 public Table getTable() { return table; } 59 public String getQName() { return getTable().getQName() + "." + getName(); } 60 public boolean isVirtual() { return false; } 61 62 public boolean isPrimaryKeyPart() { 63 Index index = getTable().getPrimaryKey(); 64 if (index == null) { 65 return false; 66 } 67 for (Iterator iter = index.getColumns(); iter.hasNext(); ) { 68 Column column = (Column) iter.next(); 69 if (column.equals(this)) { 70 return true; 71 } 72 } 73 return false; 74 } 75 } 76 | Popular Tags |