1 /*
2 * $Header: /home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/Msg.java,v 1.12 2004/02/21 17:10:29 rleland Exp $
3 * $Revision: 1.12 $
4 * $Date: 2004/02/21 17:10:29 $
5 *
6 * ====================================================================
7 * Copyright 2001-2004 The Apache Software Foundation
8 *
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 */
21
22 package org.apache.commons.validator;
23
24 import java.io.Serializable;
25
26 /***
27 * An alternative message can be associated with a <code>Field</code>
28 * and a pluggable validator instead of using the default message
29 * stored in the <code>ValidatorAction</code> (aka pluggable validator).
30 * Instances of this class are configured with a <msg> xml element.
31 */
32 public class Msg implements Cloneable, Serializable {
33
34 /***
35 * The resource bundle name that this Msg's <code>key</code> should be
36 * resolved in (optional).
37 * @since Validator 1.1
38 */
39 protected String bundle = null;
40
41 /***
42 * The key or value of the argument.
43 */
44 protected String key = null;
45
46 /***
47 * The name dependency that this argument goes with (optional).
48 */
49 protected String name = null;
50
51 /***
52 * Returns the resource bundle name.
53 * @since Validator 1.1
54 */
55 public String getBundle() {
56 return this.bundle;
57 }
58
59 /***
60 * Sets the resource bundle name.
61 * @param bundle The new bundle name.
62 * @since Validator 1.1
63 */
64 public void setBundle(String bundle) {
65 this.bundle = bundle;
66 }
67
68 /***
69 * Gets the name of the dependency.
70 */
71 public String getName() {
72 return name;
73 }
74
75 /***
76 * Sets the name of the dependency.
77 */
78 public void setName(String name) {
79 this.name = name;
80 }
81
82 /***
83 * Gets the key/value.
84 */
85 public String getKey() {
86 return key;
87 }
88
89 /***
90 * Sets the key/value.
91 */
92 public void setKey(String key) {
93 this.key = key;
94 }
95
96 /***
97 * Creates and returns a copy of this object.
98 */
99 public Object clone() {
100 try {
101 return super.clone();
102
103 } catch(CloneNotSupportedException e) {
104 throw new RuntimeException(e.toString());
105 }
106 }
107
108 /***
109 * Returns a string representation of the object.
110 */
111 public String toString() {
112 StringBuffer results = new StringBuffer();
113
114 results.append("Msg: name=");
115 results.append(name);
116 results.append(" key=");
117 results.append(key);
118 results.append("\n");
119
120 return results.toString();
121 }
122
123 }
This page was automatically generated by Maven