org.mentawai.rule
Class MethodRule
java.lang.Object
org.mentawai.rule.BasicRule
org.mentawai.rule.MethodRule
- All Implemented Interfaces:
- Rule
public class MethodRule
- extends BasicRule
A validation rule that calls a method by reflection to validate.
Good for validation that requires database access for example.
- Author:
- Sergio Oliveira
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MethodRule
public MethodRule(Object target,
String methodName)
getInstance
public static MethodRule getInstance(Object target,
String methodName)
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- Overrides:
getTokens in class BasicRule
- Returns:
- A map with the token values.
check
public boolean check(String value)
- Description copied from class:
BasicRule
- Check a single input value from this action.
Override this method to implement a basic rule for validation.
- Specified by:
check in class BasicRule
- Parameters:
value - The value to validate.
- Returns:
- true if the validation was successful.
Copyright © 2012. All Rights Reserved.