ValidatorUtils (Apache Commons Validator 1.11.0 API)
Description: declaration: package: org.apache.commons.validator.util, class: ValidatorUtils

# Class ValidatorUtils

java.lang.Object
org.apache.commons.validator.util.ValidatorUtils

public class ValidatorUtils extends Object
Basic utility methods.

The use of FastHashMap is deprecated and will be replaced in a future release.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ValidatorUtils()`
  Deprecated.
  Will be private in the next major version.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static org.apache.commons.collections.FastHashMap`
  `copyFastHashMap(org.apache.commons.collections.FastHashMap fastHashMap)`
  Deprecated.
  This method is not part of Validator's public API.
  `static Map<String,Object>`
  `copyMap(Map<String,Object> map)`
  Makes a deep copy of a `Map` if the values are `Msg`, `Arg`, or `Var`.
  `static String`
  `getValueAsString(Object bean, String property)`
  Convenience method for getting a value from a bean property as a `String`.
  `static String`
  `replace(String value, String key, String replaceValue)`
  Replace part of a `String` with another value.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ValidatorUtils

    @Deprecated public ValidatorUtils()
    Deprecated.
    Will be private in the next major version.
    Constructs a new instance.

- ## Method Details

  - ### copyFastHashMap

    @Deprecated public static org.apache.commons.collections.FastHashMap copyFastHashMap(org.apache.commons.collections.FastHashMap fastHashMap)
    Deprecated.
    This method is not part of Validator's public API. Validator will use it internally until FastHashMap references are removed. Use copyMap() instead.
    Makes a deep copy of a `FastHashMap` if the values are `Msg`, `Arg`, or `Var`. Otherwise, it is a shallow copy.
    Parameters:
      `fastHashMap` - `FastHashMap` to copy.
    Returns:
      FastHashMap A copy of the `FastHashMap` that was passed in.

  - ### copyMap

    public static Map<String,Object> copyMap(Map<String,Object> map)
    Makes a deep copy of a `Map` if the values are `Msg`, `Arg`, or `Var`. Otherwise, it is a shallow copy.
    Parameters:
      `map` - The source Map to copy.
    Returns:
      A copy of the `Map` that was passed in.

  - ### getValueAsString

    public static String getValueAsString(Object bean, String property)
    Convenience method for getting a value from a bean property as a `String`. If the property is a `String[]` or `Collection` and it is empty, an empty `String` "" is returned. Otherwise, property.toString() is returned. This method may return `null` if there was an error retrieving the property.
    Parameters:
      `bean` - The bean object.
      `property` - The name of the property to access.
    Returns:
      The value of the property.

  - ### replace

    public static String replace(String value, String key, String replaceValue)
    Replace part of a `String` with another value.
    Parameters:
      `value` - `String` to perform the replacement on.
      `key` - The name of the constant.
      `replaceValue` - The value of the constant.
    Returns:
      The modified value.