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