Class Arg
java.lang.Object
org.apache.commons.validator.Arg
- All Implemented Interfaces:
Serializable, Cloneable
A default argument or an argument for a
specific validator definition (ex: required)
can be stored to pass into a message as parameters. This can be used in a
pluggable validator for constructing locale
sensitive messages by using MessageFormat
or an equivalent class. The resource field can be
used to determine if the value stored in the argument
is a value to be retrieved from a locale sensitive
message retrieval system like java.util.PropertyResourceBundle.
The resource field defaults to 'true'.
Instances of this class are configured with an <arg> xml element.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringThe resource bundle name that this Arg'skeyshould be resolved in (optional).protected StringThe key or value of the argument.protected StringThe name dependency that this argument goes with (optional).protected intThis argument's position in the message.protected booleanWhether or not the key is a message resource (optional). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Creates and returns a copy of this object.Gets the resource bundle name.getKey()Gets the key/value.getName()Gets the name of the dependency.intGets the replacement position.booleanTests whether or not the key is a resource key or literal value.voidSets the resource bundle name.voidSets the key/value.voidSets the name of the dependency.voidsetPosition(int position) Sets this argument's replacement position.voidsetResource(boolean resource) Sets whether or not the key is a resource.toString()Returns a string representation of the object.
-
Field Details
-
bundle
-
key
-
name
-
position
This argument's position in the message. Set position=0 to make a replacement in this string: "some msg {0}".- Since:
- 1.1
-
resource
Whether or not the key is a message resource (optional). Defaults to true. If it is 'true', the value will try to be resolved as a message resource.
-
-
Constructor Details
-
Arg
public Arg()Constructs a new instance.
-
-
Method Details
-
clone
-
getBundle
-
getKey
-
getName
-
getPosition
-
isResource
Tests whether or not the key is a resource key or literal value.- Returns:
trueif key is a resource key.
-
setBundle
-
setKey
-
setName
-
setPosition
Sets this argument's replacement position.- Parameters:
position- set this argument's replacement position.
-
setResource
Sets whether or not the key is a resource.- Parameters:
resource- If true indicates the key is a resource.
-
toString
-