Menu

[r16]: / trunk / src / MyFKColumn.java  Maximize  Restore  History

Download this file

85 lines (63 with data), 1.9 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/**
*
*/
/**
* @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());
}
}