View Javadoc

1   /*
2    * $Header: /home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/Attic/Constant.java,v 1.10 2004/02/21 17:10:29 rleland Exp $
3    * $Revision: 1.10 $
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  
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: &lt;constant name="zip" value="^\d{5}$" /&gt; 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 }