Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
IdMethodParameter |
|
| 1.1111111111111112;1.111 |
1 | package org.apache.torque.engine.database.model; | |
2 | ||
3 | /* | |
4 | * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE | |
5 | * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file | |
6 | * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the | |
7 | * License. You may obtain a copy of the License at | |
8 | * | |
9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
10 | * | |
11 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | |
12 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | |
13 | * specific language governing permissions and limitations under the License. | |
14 | */ | |
15 | ||
16 | import org.xml.sax.Attributes; | |
17 | ||
18 | /** | |
19 | * Information related to an ID method. | |
20 | * | |
21 | * @author <a href="mailto:jmcnally@collab.net">John McNally</a> | |
22 | * @author <a href="mailto:dlr@collab.net">Daniel Rall</a> | |
23 | * @version $Id: IdMethodParameter.java,v 1.1 2007-10-21 07:57:27 abyrne Exp $ | |
24 | */ | |
25 | 0 | public class IdMethodParameter { |
26 | private String name; | |
27 | private String value; | |
28 | private Table parentTable; | |
29 | ||
30 | /** | |
31 | * Imports foreign key from an XML specification | |
32 | */ | |
33 | public void loadFromXML(Attributes attrib) { | |
34 | 0 | name = attrib.getValue("name"); |
35 | 0 | value = attrib.getValue("value"); |
36 | 0 | } |
37 | ||
38 | /** | |
39 | * Get the parameter name | |
40 | */ | |
41 | public String getName() { | |
42 | 0 | return name; |
43 | } | |
44 | ||
45 | /** | |
46 | * Set the parameter name | |
47 | */ | |
48 | public void setName(String name) { | |
49 | 0 | this.name = name; |
50 | 0 | } |
51 | ||
52 | /** | |
53 | * Get the parameter value | |
54 | */ | |
55 | public String getValue() { | |
56 | 0 | return value; |
57 | } | |
58 | ||
59 | /** | |
60 | * Set the parameter value | |
61 | */ | |
62 | public void setValue(String value) { | |
63 | 0 | this.value = value; |
64 | 0 | } |
65 | ||
66 | /** | |
67 | * Set the parent Table of the id method | |
68 | */ | |
69 | public void setTable(Table parent) { | |
70 | 0 | parentTable = parent; |
71 | 0 | } |
72 | ||
73 | /** | |
74 | * Get the parent Table of the id method | |
75 | */ | |
76 | public Table getTable() { | |
77 | 0 | return parentTable; |
78 | } | |
79 | ||
80 | /** | |
81 | * Returns the Name of the table the id method is in | |
82 | */ | |
83 | public String getTableName() { | |
84 | 0 | return parentTable.getName(); |
85 | } | |
86 | ||
87 | /** | |
88 | * XML representation of the foreign key. | |
89 | */ | |
90 | public String toString() { | |
91 | 0 | StringBuffer result = new StringBuffer(); |
92 | 0 | result.append(" <id-method-parameter"); |
93 | 0 | if (getName() != null) { |
94 | 0 | result.append(" name=\"").append(getName()).append("\""); |
95 | } | |
96 | 0 | result.append(" value=\"").append(getValue()).append("\">\n"); |
97 | 0 | return result.toString(); |
98 | } | |
99 | } |