1. /*
  2. * $Header: /home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/Attic/ValidatorUtil.java,v 1.14.2.1 2004/06/22 02:24:38 husted Exp $
  3. * $Revision: 1.14.2.1 $
  4. * $Date: 2004/06/22 02:24:38 $
  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 org.apache.commons.collections.FastHashMap; // DEPRECATED
  23. import org.apache.commons.logging.Log;
  24. import org.apache.commons.logging.LogFactory;
  25. /**
  26. * Basic utility methods.
  27. *
  28. * @deprecated This class has moved to the org.apache.commons.validator.util
  29. * package.
  30. */
  31. public class ValidatorUtil {
  32. /**
  33. * Delimiter to put around a regular expression following Perl 5 syntax.
  34. * @deprecated Use "/" directly.
  35. */
  36. public final static String REGEXP_DELIMITER = "/";
  37. /**
  38. * Logger.
  39. * @deprecated Subclasses should use their own logging instance.
  40. */
  41. protected static Log log = LogFactory.getLog(ValidatorUtil.class);
  42. /**
  43. * <p>Replace part of a <code>String</code> with another value.</p>
  44. *
  45. * @param value <code>String</code> to perform the replacement on.
  46. * @param key The name of the constant.
  47. * @param replaceValue The value of the constant.
  48. */
  49. public static String replace(
  50. String value,
  51. String key,
  52. String replaceValue) {
  53. return org.apache.commons.validator.util.ValidatorUtils.replace(value, key, replaceValue);
  54. }
  55. /**
  56. * Convenience method for getting a value from a bean property as a
  57. * <code>String</code>.
  58. */
  59. public static String getValueAsString(Object bean, String property) {
  60. return org.apache.commons.validator.util.ValidatorUtils.getValueAsString(bean, property);
  61. }
  62. /**
  63. * Makes a deep copy of a <code>FastHashMap</code> if the values
  64. * are <code>String</code>, <code>Msg</code>, <code>Arg</code>,
  65. * or <code>Var</code>. Otherwise it is a shallow copy.
  66. *
  67. * @param map <code>FastHashMap</code> to copy.
  68. * @return FastHashMap A copy of the <code>FastHashMap</code> that was
  69. * passed in.
  70. */
  71. public static FastHashMap copyFastHashMap(FastHashMap map) {
  72. return org.apache.commons.validator.util.ValidatorUtils.copyFastHashMap(map);
  73. }
  74. /**
  75. * Adds a '/' on either side of the regular expression.
  76. * @deprecated Use "/" directly.
  77. */
  78. public static String getDelimitedRegExp(String regexp) {
  79. return (REGEXP_DELIMITER + regexp + REGEXP_DELIMITER);
  80. }
  81. }