%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.torque.engine.database.model.IdMethodParameter |
|
|
1 | package org.apache.torque.engine.database.model; |
|
2 | ||
3 | /* |
|
4 | * Copyright 2001-2005 The Apache Software Foundation. |
|
5 | * |
|
6 | * Licensed under the Apache License, Version 2.0 (the "License") |
|
7 | * you may not use this file except in compliance with the License. |
|
8 | * You may obtain a copy of the License at |
|
9 | * |
|
10 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
11 | * |
|
12 | * Unless required by applicable law or agreed to in writing, software |
|
13 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
15 | * See the License for the specific language governing permissions and |
|
16 | * limitations under the License. |
|
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 | 0 | 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 | 0 | name = attrib.getValue("name"); |
40 | 0 | value = attrib.getValue("value"); |
41 | 0 | } |
42 | ||
43 | /** |
|
44 | * Get the parameter name |
|
45 | */ |
|
46 | public String getName() |
|
47 | { |
|
48 | 0 | return name; |
49 | } |
|
50 | ||
51 | /** |
|
52 | * Set the parameter name |
|
53 | */ |
|
54 | public void setName(String name) |
|
55 | { |
|
56 | 0 | this.name = name; |
57 | 0 | } |
58 | ||
59 | /** |
|
60 | * Get the parameter value |
|
61 | */ |
|
62 | public String getValue() |
|
63 | { |
|
64 | 0 | return value; |
65 | } |
|
66 | ||
67 | /** |
|
68 | * Set the parameter value |
|
69 | */ |
|
70 | public void setValue(String value) |
|
71 | { |
|
72 | 0 | this.value = value; |
73 | 0 | } |
74 | ||
75 | /** |
|
76 | * Set the parent Table of the id method |
|
77 | */ |
|
78 | public void setTable(Table parent) |
|
79 | { |
|
80 | 0 | parentTable = parent; |
81 | 0 | } |
82 | ||
83 | /** |
|
84 | * Get the parent Table of the id method |
|
85 | */ |
|
86 | public Table getTable() |
|
87 | { |
|
88 | 0 | return parentTable; |
89 | } |
|
90 | ||
91 | /** |
|
92 | * Returns the Name of the table the id method is in |
|
93 | */ |
|
94 | public String getTableName() |
|
95 | { |
|
96 | 0 | return parentTable.getName(); |
97 | } |
|
98 | ||
99 | /** |
|
100 | * XML representation of the foreign key. |
|
101 | */ |
|
102 | public String toString() |
|
103 | { |
|
104 | 0 | StringBuffer result = new StringBuffer(); |
105 | 0 | result.append(" <id-method-parameter"); |
106 | 0 | if (getName() != null) |
107 | { |
|
108 | 0 | result.append(" name=\"") |
109 | .append(getName()) |
|
110 | .append("\""); |
|
111 | } |
|
112 | 0 | result.append(" value=\"") |
113 | .append(getValue()) |
|
114 | .append("\">\n"); |
|
115 | 0 | return result.toString(); |
116 | } |
|
117 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |