1 package org.apache.torque.engine.database.model;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.xml.sax.Attributes;
23
24 /***
25 * Information related to an ID method.
26 *
27 * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
28 * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
29 * @version $Id: IdMethodParameter.java 473814 2006-11-11 22:30:30Z tv $
30 */
31 public class IdMethodParameter
32 {
33 private String name;
34 private String value;
35 private Table parentTable;
36
37 /***
38 * Imports foreign key from an XML specification
39 */
40 public void loadFromXML (Attributes attrib)
41 {
42 name = attrib.getValue("name");
43 value = attrib.getValue("value");
44 }
45
46 /***
47 * Get the parameter name
48 */
49 public String getName()
50 {
51 return name;
52 }
53
54 /***
55 * Set the parameter name
56 */
57 public void setName(String name)
58 {
59 this.name = name;
60 }
61
62 /***
63 * Get the parameter value
64 */
65 public String getValue()
66 {
67 return value;
68 }
69
70 /***
71 * Set the parameter value
72 */
73 public void setValue(String value)
74 {
75 this.value = value;
76 }
77
78 /***
79 * Set the parent Table of the id method
80 */
81 public void setTable(Table parent)
82 {
83 parentTable = parent;
84 }
85
86 /***
87 * Get the parent Table of the id method
88 */
89 public Table getTable()
90 {
91 return parentTable;
92 }
93
94 /***
95 * Returns the Name of the table the id method is in
96 */
97 public String getTableName()
98 {
99 return parentTable.getName();
100 }
101
102 /***
103 * XML representation of the foreign key.
104 */
105 public String toString()
106 {
107 StringBuffer result = new StringBuffer();
108 result.append(" <id-method-parameter");
109 if (getName() != null)
110 {
111 result.append(" name=\"")
112 .append(getName())
113 .append("\"");
114 }
115 result.append(" value=\"")
116 .append(getValue())
117 .append("\">\n");
118 return result.toString();
119 }
120 }