1 17 package org.apache.ws.jaxme.sqls; 18 19 import java.io.Serializable ; 20 import java.util.Iterator ; 21 22 23 27 public interface ForeignKey extends ColumnSet { 28 public class Mode implements Serializable { 29 private String name; 30 private Mode(String pName) { 31 name = pName; 32 } 33 public String getName() { return name; } 34 public String toString() { return name; } 35 public static final Mode CASCADE = new Mode("CASCADE"); 36 public static final Mode REJECT = new Mode("REJECT"); 37 public static final Mode SETNULL = new Mode("SETNULL"); 38 private static final Mode[] instances = new Mode[]{ 39 CASCADE, REJECT, SETNULL 40 }; 41 public static Mode[] getInstances() { 42 return instances; 43 } 44 public static Mode valueOf(String pMode) { 45 for (int i = 0; i < instances.length; i++) { 46 if (instances[i].getName().equals(pMode)) { 47 return instances[i]; 48 } 49 } 50 throw new IllegalArgumentException ("Unknown mode: " + pMode); 51 } 52 public int hashCode() { 53 return name.hashCode(); 54 } 55 public boolean equals(Object o) { 56 return o != null && (o instanceof Mode) && name.equals(((Mode) o).name); 57 } 58 } 59 60 public interface ColumnLink { 61 64 public Column getLocalColumn(); 65 68 public Column getReferencedColumn(); 69 } 70 71 73 public Table getReferencedTable(); 74 75 77 public void setOnDelete(Mode pMode); 78 79 81 public Mode getOnDelete(); 82 83 85 public void setOnUpdate(Mode pMode); 86 87 89 public Mode getOnUpdate(); 90 91 96 public void addColumnLink(Column pColumn, Column pReferencedColumn); 97 98 103 public void addColumnLink(Column.Name pName, Column.Name pReferencedName); 104 105 110 public void addColumnLink(String pName, String pReferencedName); 111 112 116 public Iterator getColumnLinks(); 117 118 120 public ColumnSet getReferencedColumns(); 121 } 122 | Popular Tags |