1 28 29 package com.caucho.amber.table; 30 31 import com.caucho.util.L10N; 32 33 36 public class ForeignColumn extends Column { 37 private static final L10N L = new L10N(ForeignColumn.class); 38 39 private Column _targetColumn; 40 41 48 ForeignColumn(Table table, String name, Column targetColumn) 49 { 50 super(table, name, targetColumn.getType()); 51 52 _targetColumn = targetColumn; 53 54 if (! targetColumn.isPrimaryKey()) 55 throw new IllegalStateException (L.l("Foreign column '{0}' of table '{1}' must be a primary key.", 56 targetColumn.getName(), 57 targetColumn.getTable().getName())); 58 } 59 60 63 public Column getTargetColumn() 64 { 65 return _targetColumn; 66 } 67 68 public String toString() 69 { 70 return "ForeignColumn[" + getName() + "," + _targetColumn + "]"; 71 } 72 } 73 | Popular Tags |