Package org.apache.commons.validator
Class Var
- java.lang.Object
-
- org.apache.commons.validator.Var
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
public class Var extends java.lang.Object implements java.lang.Cloneable, java.io.SerializableA variable that can be associated with aFieldfor passing in information to a pluggable validator. Instances of this class are configured with a <var> xml element.- Version:
- $Revision: 1713331 $
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringbundleThe bundle for a variable (when resource = 'true').private java.lang.StringjsTypeThe optional JavaScript type of the variable.static java.lang.StringJSTYPE_INTInt Constant for JavaScript type.static java.lang.StringJSTYPE_REGEXPRegular Expression Constant for JavaScript type.static java.lang.StringJSTYPE_STRINGString Constant for JavaScript type.private java.lang.StringnameThe name of the variable.private booleanresourceWhether the variable is a resource [false]private static longserialVersionUIDprivate java.lang.StringvalueThe key or value the variable.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()Creates and returns a copy of this object.java.lang.StringgetBundle()Returns the resource bundle name.java.lang.StringgetJsType()Gets the JavaScript type of the variable.java.lang.StringgetName()Gets the name of the variable.java.lang.StringgetValue()Gets the value of the variable.booleanisResource()Tests whether or not the value is a resource key or literal value.voidsetBundle(java.lang.String bundle)Sets the resource bundle name.voidsetJsType(java.lang.String jsType)Sets the JavaScript type of the variable.voidsetName(java.lang.String name)Sets the name of the variable.voidsetResource(boolean resource)Sets whether or not the value is a resource.voidsetValue(java.lang.String value)Sets the value of the variable.java.lang.StringtoString()Returns a string representation of the object.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
JSTYPE_INT
public static final java.lang.String JSTYPE_INT
Int Constant for JavaScript type. This can be used when auto-generating JavaScript.- See Also:
- Constant Field Values
-
JSTYPE_STRING
public static final java.lang.String JSTYPE_STRING
String Constant for JavaScript type. This can be used when auto-generating JavaScript.- See Also:
- Constant Field Values
-
JSTYPE_REGEXP
public static final java.lang.String JSTYPE_REGEXP
Regular Expression Constant for JavaScript type. This can be used when auto-generating JavaScript.- See Also:
- Constant Field Values
-
name
private java.lang.String name
The name of the variable.
-
value
private java.lang.String value
The key or value the variable.
-
jsType
private java.lang.String jsType
The optional JavaScript type of the variable.
-
resource
private boolean resource
Whether the variable is a resource [false]
-
bundle
private java.lang.String bundle
The bundle for a variable (when resource = 'true').
-
-
Constructor Detail
-
Var
public Var()
Default Constructor.
-
Var
public Var(java.lang.String name, java.lang.String value, java.lang.String jsType)Constructs a variable with a specified name, value and Javascript type.- Parameters:
name- Variable name.value- Variable value.jsType- Variable Javascript type.
-
-
Method Detail
-
getName
public java.lang.String getName()
Gets the name of the variable.- Returns:
- The name of the variable.
-
setName
public void setName(java.lang.String name)
Sets the name of the variable.- Parameters:
name- The name of the variable.
-
getValue
public java.lang.String getValue()
Gets the value of the variable.- Returns:
- The value of the variable.
-
setValue
public void setValue(java.lang.String value)
Sets the value of the variable.- Parameters:
value- The value of the variable.
-
isResource
public boolean isResource()
Tests whether or not the value is a resource key or literal value.- Returns:
trueif value is a resource key.- Since:
- Validator 1.2.0
-
setResource
public void setResource(boolean resource)
Sets whether or not the value is a resource.- Parameters:
resource- If true indicates the value is a resource.- Since:
- Validator 1.2.0
-
getBundle
public java.lang.String getBundle()
Returns the resource bundle name.- Returns:
- The bundle name.
- Since:
- Validator 1.2.0
-
setBundle
public void setBundle(java.lang.String bundle)
Sets the resource bundle name.- Parameters:
bundle- The new bundle name.- Since:
- Validator 1.2.0
-
getJsType
public java.lang.String getJsType()
Gets the JavaScript type of the variable.- Returns:
- The Javascript type of the variable.
-
setJsType
public void setJsType(java.lang.String jsType)
Sets the JavaScript type of the variable.- Parameters:
jsType- The Javascript type of the variable.
-
clone
public java.lang.Object clone()
Creates and returns a copy of this object.- Overrides:
clonein classjava.lang.Object- Returns:
- A copy of the variable.
-
toString
public java.lang.String toString()
Returns a string representation of the object.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the variable.
-
-