java.io.Serializable
, java.lang.Cloneable
public class Field
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
The use of FastHashMap is deprecated and will be replaced in a future release.
Form
,
Serialized FormModifier and Type | Field | Description |
---|---|---|
protected java.util.Map<java.lang.String,Arg>[] |
args |
Holds Maps of arguments.
|
protected boolean |
clientValidation |
The flag that indicates whether scripting should be generated
by the client for client-side validation.
|
protected java.lang.String |
depends |
A comma separated list of validator's this field depends on.
|
protected int |
fieldOrder |
The order of the Field in the Form.
|
protected org.apache.commons.collections.FastHashMap |
hMsgs |
Deprecated.
Subclasses should use getMsgMap() instead.
|
protected org.apache.commons.collections.FastHashMap |
hVars |
Deprecated.
Subclasses should use getVarMap() instead.
|
protected java.lang.String |
indexedListProperty |
The Field's indexed list property name.
|
protected java.lang.String |
indexedProperty |
The Field's indexed property name.
|
protected java.lang.String |
key |
The Field's unique key.
|
protected int |
page |
The Page Number
|
protected java.lang.String |
property |
The Field's property name.
|
protected static java.lang.String |
TOKEN_END |
The end of a token.
|
static java.lang.String |
TOKEN_INDEXED |
This indicates an indexed property is being referenced.
|
protected static java.lang.String |
TOKEN_START |
The start of a token.
|
protected static java.lang.String |
TOKEN_VAR |
A Vriable token.
|
Constructor | Description |
---|---|
Field() |
Modifier and Type | Method | Description |
---|---|---|
void |
addArg(Arg arg) |
Add an
Arg to the replacement argument list. |
void |
addMsg(Msg msg) |
Add a
Msg to the Field . |
void |
addVar(java.lang.String name,
java.lang.String value,
java.lang.String jsType) |
Add a
Var , based on the values passed in, to the
Field . |
void |
addVar(Var v) |
Add a
Var to the Field . |
java.lang.Object |
clone() |
Creates and returns a copy of this object.
|
void |
generateKey() |
Generate correct
key value. |
Arg |
getArg(int position) |
Gets the default
Arg object at the given position. |
Arg |
getArg(java.lang.String key,
int position) |
Gets the
Arg object at the given position. |
Arg[] |
getArgs(java.lang.String key) |
Retrieves the Args for the given validator name.
|
java.util.List<java.lang.String> |
getDependencyList() |
Gets an unmodifiable
List of the dependencies in the same
order they were defined in parameter passed to the setDepends() method. |
java.lang.String |
getDepends() |
Gets the validation rules for this field as a comma separated list.
|
int |
getFieldOrder() |
Gets the position of the
Field in the validation list. |
java.lang.String |
getIndexedListProperty() |
Gets the indexed property name of the field.
|
java.lang.String |
getIndexedProperty() |
Gets the indexed property name of the field.
|
java.lang.String |
getKey() |
Gets a unique key based on the property and indexedProperty fields.
|
Msg |
getMessage(java.lang.String key) |
Retrieve a message object.
|
java.util.Map<java.lang.String,Msg> |
getMessages() |
The
Field 's messages are returned as an
unmodifiable Map . |
java.lang.String |
getMsg(java.lang.String key) |
Retrieve a message value.
|
protected java.util.Map<java.lang.String,Msg> |
getMsgMap() |
Returns a Map of String Msg names to Msg objects.
|
int |
getPage() |
Gets the page value that the Field is associated with for
validation.
|
java.lang.String |
getProperty() |
Gets the property name of the field.
|
Var |
getVar(java.lang.String mainKey) |
Retrieve a variable.
|
protected java.util.Map<java.lang.String,Var> |
getVarMap() |
Returns a Map of String Var names to Var objects.
|
java.util.Map<java.lang.String,Var> |
getVars() |
The
Field 's variables are returned as an
unmodifiable Map . |
java.lang.String |
getVarValue(java.lang.String mainKey) |
Retrieve a variable's value.
|
boolean |
isClientValidation() |
Determines whether client-side scripting should be generated
for this field.
|
boolean |
isDependency(java.lang.String validatorName) |
Checks if the validator is listed as a dependency.
|
boolean |
isIndexed() |
If there is a value specified for the indexedProperty field then
true will be returned. |
void |
setClientValidation(boolean clientValidation) |
Sets the flag that determines whether client-side scripting should
be generated for this field.
|
void |
setDepends(java.lang.String depends) |
Sets the validation rules for this field as a comma separated list.
|
void |
setFieldOrder(int fieldOrder) |
Sets the position of the
Field in the validation list. |
void |
setIndexedListProperty(java.lang.String indexedListProperty) |
Sets the indexed property name of the field.
|
void |
setIndexedProperty(java.lang.String indexedProperty) |
Sets the indexed property name of the field.
|
void |
setKey(java.lang.String key) |
Sets a unique key for the field.
|
void |
setPage(int page) |
Sets the page value that the Field is associated with for
validation.
|
void |
setProperty(java.lang.String property) |
Sets the property name of the field.
|
java.lang.String |
toString() |
Returns a string representation of the object.
|
ValidatorResults |
validate(java.util.Map<java.lang.String,java.lang.Object> params,
java.util.Map<java.lang.String,ValidatorAction> actions) |
Run the configured validations on this field.
|
public static final java.lang.String TOKEN_INDEXED
protected static final java.lang.String TOKEN_START
protected static final java.lang.String TOKEN_END
protected static final java.lang.String TOKEN_VAR
protected java.lang.String property
protected java.lang.String indexedProperty
protected java.lang.String indexedListProperty
protected java.lang.String key
protected java.lang.String depends
protected int page
protected boolean clientValidation
protected int fieldOrder
@Deprecated protected org.apache.commons.collections.FastHashMap hVars
@Deprecated protected org.apache.commons.collections.FastHashMap hMsgs
protected java.util.Map<java.lang.String,Arg>[] args
public int getPage()
public void setPage(int page)
page
- The page number.public int getFieldOrder()
Field
in the validation list.public void setFieldOrder(int fieldOrder)
Field
in the validation list.fieldOrder
- The field position.public java.lang.String getProperty()
public void setProperty(java.lang.String property)
property
- The field's property name.public java.lang.String getIndexedProperty()
int
as
a parameter for indexed property value retrieval.public void setIndexedProperty(java.lang.String indexedProperty)
indexedProperty
- The field's indexed property name.public java.lang.String getIndexedListProperty()
Collection
used to retrieve the
list and then loop through the list performing the specified
validations.public void setIndexedListProperty(java.lang.String indexedListProperty)
indexedListProperty
- The field's indexed List property name.public java.lang.String getDepends()
public void setDepends(java.lang.String depends)
depends
- A comma separated list of validator names.public void addMsg(Msg msg)
Msg
to the Field
.msg
- A validation message.public java.lang.String getMsg(java.lang.String key)
key
- Validation key.public Msg getMessage(java.lang.String key)
key
- Validation key.public java.util.Map<java.lang.String,Msg> getMessages()
Field
's messages are returned as an
unmodifiable Map
.public boolean isClientValidation()
true
true
for scripting; otherwise falsesetClientValidation(boolean)
public void setClientValidation(boolean clientValidation)
clientValidation
- the scripting flagisClientValidation()
public void addArg(Arg arg)
Arg
to the replacement argument list.arg
- Validation message's argument.public Arg getArg(int position)
Arg
object at the given position.position
- Validation message argument's position.public Arg getArg(java.lang.String key, int position)
Arg
object at the given position. If the key
finds a null
value then the default value will be
retrieved.key
- The name the Arg is stored under. If not found, the default
Arg for the given position (if any) will be retrieved.position
- The Arg number to find.public Arg[] getArgs(java.lang.String key)
key
- The validator's args to retrieve.public void addVar(Var v)
Var
to the Field
.v
- The Validator Argument.public void addVar(java.lang.String name, java.lang.String value, java.lang.String jsType)
Var
, based on the values passed in, to the
Field
.name
- Name of the validation.value
- The Argument's value.jsType
- The Javascript type.public Var getVar(java.lang.String mainKey)
mainKey
- The Variable's keypublic java.lang.String getVarValue(java.lang.String mainKey)
mainKey
- The Variable's keypublic java.util.Map<java.lang.String,Var> getVars()
Field
's variables are returned as an
unmodifiable Map
.public java.lang.String getKey()
public void setKey(java.lang.String key)
key
- a unique key for the fieldpublic boolean isIndexed()
true
will be returned. Otherwise it will be
false
.public void generateKey()
key
value.public boolean isDependency(java.lang.String validatorName)
validatorName
- Name of the validator to check.public java.util.List<java.lang.String> getDependencyList()
List
of the dependencies in the same
order they were defined in parameter passed to the setDepends() method.public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public ValidatorResults validate(java.util.Map<java.lang.String,java.lang.Object> params, java.util.Map<java.lang.String,ValidatorAction> actions) throws ValidatorException
params
- A Map of parameter class names to parameter values to pass
into validation methods.actions
- A Map of validator names to ValidatorAction objects.ValidatorException
- If an error occurs during validation.protected java.util.Map<java.lang.String,Msg> getMsgMap()
protected java.util.Map<java.lang.String,Var> getVarMap()
Copyright © 2002–2018. All rights reserved.