org.apache.commons.validator

Class Msg

public class Msg extends Object implements Cloneable, Serializable

An alternative message can be associated with a Field and a pluggable validator instead of using the default message stored in the ValidatorAction (aka pluggable validator). Instances of this class are configured with a <msg> xml element.

Version: $Revision: 478334 $ $Date: 2006-11-22 21:31:54 +0000 (Wed, 22 Nov 2006) $

Field Summary
protected Stringbundle
The resource bundle name that this Msg's key should be resolved in (optional).
protected Stringkey
The key or value of the argument.
protected Stringname
The name dependency that this argument goes with (optional).
protected booleanresource
Whether or not the key is a message resource (optional).
Method Summary
Objectclone()
Creates and returns a copy of this object.
StringgetBundle()
Returns the resource bundle name.
StringgetKey()
Gets the key/value.
StringgetName()
Gets the name of the dependency.
booleanisResource()
Tests whether or not the key is a resource key or literal value.
voidsetBundle(String bundle)
Sets the resource bundle name.
voidsetKey(String key)
Sets the key/value.
voidsetName(String name)
Sets the name of the dependency.
voidsetResource(boolean resource)
Sets whether or not the key is a resource.
StringtoString()
Returns a string representation of the object.

Field Detail

bundle

protected String bundle
The resource bundle name that this Msg's key should be resolved in (optional).

Since: Validator 1.1

key

protected String key
The key or value of the argument.

name

protected String name
The name dependency that this argument goes with (optional).

resource

protected boolean 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.

Since: Validator 1.1.4

Method Detail

clone

public Object clone()
Creates and returns a copy of this object.

Returns: A copy of the Msg.

getBundle

public String getBundle()
Returns the resource bundle name.

Returns: The bundle name.

Since: Validator 1.1

getKey

public String getKey()
Gets the key/value.

Returns: The message key/value.

getName

public String getName()
Gets the name of the dependency.

Returns: The dependency name.

isResource

public boolean isResource()
Tests whether or not the key is a resource key or literal value.

Returns: true if key is a resource key.

Since: Validator 1.1.4

setBundle

public void setBundle(String bundle)
Sets the resource bundle name.

Parameters: bundle The new bundle name.

Since: Validator 1.1

setKey

public void setKey(String key)
Sets the key/value.

Parameters: key The message key/value.

setName

public void setName(String name)
Sets the name of the dependency.

Parameters: name The dependency name.

setResource

public void setResource(boolean resource)
Sets whether or not the key is a resource.

Parameters: resource If true indicates the key is a resource.

Since: Validator 1.1.4

toString

public String toString()
Returns a string representation of the object.

Returns: Msg String representation.

Copyright (c) 2001-2004 Apache Software Foundation