O - type of bean to validateV - type of bean validator usedE - type of event to createpublic abstract class AbstractNuitonValidatorContext<O,V,E> extends Object
BeanValidator will then used one of this object and
BeanListValidator as many as it contains beans.
This object box a NuitonValidator to get validation state each time
a higher validator requires it.
It also offers the way to create events (merge logic| Modifier and Type | Field and Description |
|---|---|
protected O |
bean
Bean to validate.
|
protected boolean |
canValidate
State to know if the validator can be used (we keep this state for
performance reasons : do not want to compute this value each time a
validation is asked...).
|
protected Map<String,String> |
conversionErrors
map of conversion errors detected by this validator
|
protected NuitonValidatorResult |
messages
State of validation (keep all messages of validation for the filled
bean).
|
protected NuitonValidator<O> |
validator
Validator.
|
| Constructor and Description |
|---|
AbstractNuitonValidatorContext() |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
convert(String fieldName,
String value,
Class<T> valueClass)
Convert a value.
|
protected abstract E |
createEvent(V source,
O bean,
String field,
NuitonValidatorScope scope,
String[] toAdd,
String[] toDelete) |
O |
getBean() |
NuitonValidatorScope |
getHighestScope(String field) |
NuitonValidatorResult |
getMessages() |
NuitonValidator<O> |
getValidator() |
boolean |
hasErrors() |
boolean |
hasFatalErrors() |
boolean |
hasInfos() |
boolean |
hasWarnings() |
boolean |
isCanValidate() |
boolean |
isValid() |
boolean |
isValid(String fieldName) |
List<E> |
mergeMessages(V beanValidator,
NuitonValidatorResult newMessages) |
protected void |
mergeMessages(V beanValidator,
NuitonValidatorScope scope,
NuitonValidatorResult newMessages,
List<E> events) |
void |
setBean(O bean) |
void |
setCanValidate(boolean canValidate) |
void |
setValidator(NuitonValidator<O> validator) |
NuitonValidatorResult |
validate() |
protected O bean
protected NuitonValidatorResult messages
protected NuitonValidator<O> validator
protected final Map<String,String> conversionErrors
protected boolean canValidate
protected abstract E createEvent(V source, O bean, String field, NuitonValidatorScope scope, String[] toAdd, String[] toDelete)
public O getBean()
public void setBean(O bean)
public NuitonValidator<O> getValidator()
public NuitonValidatorResult getMessages()
public boolean isCanValidate()
public void setCanValidate(boolean canValidate)
public boolean isValid()
public boolean hasFatalErrors()
public boolean hasErrors()
public boolean hasWarnings()
public boolean hasInfos()
public boolean isValid(String fieldName)
public NuitonValidatorScope getHighestScope(String field)
public void setValidator(NuitonValidator<O> validator)
public NuitonValidatorResult validate()
public <T> T convert(String fieldName, String value, Class<T> valueClass)
T - the type of conversionfieldName - the name of the bean propertyvalue - the value to convertvalueClass - the type of converted valuepublic List<E> mergeMessages(V beanValidator, NuitonValidatorResult newMessages)
protected void mergeMessages(V beanValidator, NuitonValidatorScope scope, NuitonValidatorResult newMessages, List<E> events)
Copyright © 2013 CodeLutin. All rights reserved.