org.mentawai.rule
Class RequiredRule
java.lang.Object
org.mentawai.rule.RequiredRule
- All Implemented Interfaces:
- Rule
public class RequiredRule
- extends Object
- implements Rule
A validation rule that checks if an action input value is present, in other workds, not null and not empty!
- Author:
- Sergio Oliveira
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RequiredRule
public RequiredRule()
getInstance
public static RequiredRule getInstance()
check
public boolean check(String field,
Action action)
- Description copied from interface:
Rule
- Check and validate the given field from the give action.
- Specified by:
check in interface Rule
- Parameters:
field - The field to validate.action - The action from where to get the field.
- Returns:
- true if the validation succeeds.
getTokens
public Map<String,String> getTokens()
- Description copied from interface:
Rule
- Returns a map with tokens that can be used in the error messages.
The tokens in the error messages will be replaced by the token values in this map.
- Specified by:
getTokens in interface Rule
- Returns:
- A map with the token values.
Copyright © 2012. All Rights Reserved.