V - type of valueD - type of datapublic abstract class Rule<V,D> extends Object
| Constructor and Description |
|---|
Rule(D data)
Make constructor matching super in derived rules
|
| Modifier and Type | Method and Description |
|---|---|
Violation |
check(V value)
Main validate method.
|
protected abstract Integer |
getCode()
Override this method to define code of rule
|
protected abstract String |
getMessage(V value)
Override this method to define fail validation message
You can use value to make message more clear
|
protected abstract String |
getName()
Override this method to define name of your derived rule
|
protected abstract ViolationLevel |
getViolationLevel()
Override this method to define violation level of your derived rule
|
protected abstract boolean |
validate(V value)
Override this method to implement your validation process
|
protected final D data
public Rule(D data)
data - data to validate values withpublic final Violation check(V value)
value - value to validateprotected abstract boolean validate(V value)
value - value to validateprotected abstract String getName()
protected abstract String getMessage(V value)
value - valueprotected abstract ViolationLevel getViolationLevel()
protected abstract Integer getCode()
Copyright © 2015. All Rights Reserved.