/**
*
*/
/**
* @author uicsantos
*/
public class MyFKColumn extends MyColumn {
private String ref_table;
private String ref_column;
/**
* First Constructor of MyForeignColumn Class
* @param ref_table The table name where this column is pointing
* @param ref_column The column name where this column is pointing
*/
public MyFKColumn(String ref_table, String ref_column) {
super("int", null);
this.ref_column = ref_column;
this.ref_table = ref_table;
}
/**
* Second Constructor of MyForeignColumn Class
* @param type The type of this column
* @param size The size of this column
* @param ref_table The table name where this column is pointing
* @param ref_column The column name where this column is pointing
*/
public MyFKColumn(String type, Integer size, String ref_table, String ref_column) {
super(type, size);
this.ref_column = ref_column;
this.ref_table = ref_table;
}
/**
* @return The Column Name that is pointed by this Instance of MyFKColumn Class
*/
public String getRefColumn(){
return this.ref_column;
}
/**
* @return The Table Name that is pointed by this Instance of MyFKColumn Class
*/
public String getRefTable(){
return this.ref_table;
}
/**
* @return Boolean that indicates that this column is a ForeignKey, Default value = true;
*/
public Boolean isForeignKey(){
return true;
}
/**
* @param args
*/
public static void main(String[] args) {
MyColumn column2 = new MyFKColumn("nvarchar",300,"User","UserId");
MyColumn column1 = new MyColumn("RoleId",50);
System.out.println(column1.getType());
System.out.println(column1.getSize());
System.out.println(column1.getRefTable());
System.out.println(column1.getRefColumn());
System.out.println(column2.getType());
System.out.println(column2.getSize());
}
}