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