1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package org.apache.commons.validator;
24
25 import java.io.Serializable;
26
27
28 /***
29 * <p>A constant can be used to define a global or
30 * locale level constant that can be used to replace
31 * values in certain fields. The <code>Field</code>'s
32 * property field, the <code>Var</code>'s value field,
33 * the <code>Msg</code>'s key field, and the <code>Arg</code>'s
34 * key field can all contain constants reference for replacement.
35 * <br>
36 * ex: <constant name="zip" value="^\d{5}$" /> mask="${zip}" </p>
37 *
38 * @deprecated This class is no longer needed.
39 */
40 public class Constant implements Serializable {
41
42 /***
43 * The name of the constant.
44 */
45 private String name = null;
46
47 /***
48 * The name of the constant.
49 */
50 private String value = null;
51
52 /***
53 * Gets the name of the constant.
54 * @return the name o fthe constant.
55 */
56 public String getName() {
57 return name;
58 }
59
60 /***
61 * Sets the name of the constant.
62 * @param name sets the name of the constant.
63 */
64 public void setName(String name) {
65 this.name = name;
66 }
67
68 /***
69 * Gets the value of the constant.
70 * @return the value of the constant.
71 */
72 public String getValue() {
73 return value;
74 }
75
76 /***
77 * Sets the value of the constant.
78 * @param value the value of the constant.
79 */
80 public void setValue(String value) {
81 this.value = value;
82 }
83
84 /***
85 * Returns a string representation of the object.
86 * @return the string representation of the object.
87 */
88 public String toString() {
89 StringBuffer results = new StringBuffer();
90
91 results.append("Constant: name=");
92 results.append(name);
93 results.append(" value=");
94 results.append(value);
95 results.append("\n");
96
97 return results.toString();
98 }
99
100 }