public class BeanListValidator<O> extends AbstractValidator<O>
BeanListValidator.NuitonValidatorContext.| Modifier and Type | Class and Description |
|---|---|
static class |
BeanListValidator.NuitonValidatorContext<O> |
| Modifier and Type | Field and Description |
|---|---|
protected Map<O,BeanListValidator.NuitonValidatorContext<O>> |
contexts
Context for each bean registred.
|
protected NuitonValidator<O> |
delegate
The delegate validator used to validate the bean.
|
canValidate, changed, CHANGED_PROPERTY, CONTEXT_PROPERTY, l, listenerList, pcs, SCOPES_PROPERTY, valid, VALID_PROPERTY, validatorProvider| Constructor and Description |
|---|
BeanListValidator(NuitonValidatorProvider validatorProvider,
Class<O> beanClass,
String context) |
BeanListValidator(NuitonValidatorProvider validatorProvider,
Class<O> beanClass,
String context,
NuitonValidatorScope... scopes) |
| Modifier and Type | Method and Description |
|---|---|
void |
addAllBeans(Collection<O> beansToAdd) |
void |
addBean(O bean)
Add a bean to validate.
|
void |
addBeanListValidatorListener(BeanListValidatorListener listener) |
<T> T |
convert(O bean,
String fieldName,
String value,
Class<T> valueClass)
Convert a value.
|
void |
doValidate() |
protected void |
doValidate(O bean) |
protected void |
fireFieldChanged(BeanListValidatorEvent evt) |
BeanListValidatorListener[] |
getBeanListValidatorListeners() |
Set<O> |
getBeans() |
BeanListValidator.NuitonValidatorContext<O> |
getContext(O bean) |
protected NuitonValidator<O> |
getDelegate() |
NuitonValidatorScope |
getHighestScope(String field) |
boolean |
hasErrors() |
boolean |
hasFatalErrors() |
boolean |
hasInfos() |
boolean |
hasWarnings() |
boolean |
isValid(String fieldName) |
protected boolean |
isValid0() |
protected void |
mergeMessages(BeanListValidator.NuitonValidatorContext<O> context,
NuitonValidatorResult newMessages) |
static <O> BeanListValidator<O> |
newValidator(Class<O> type,
String context,
NuitonValidatorScope... scopes)
Obtain a new
BeanListValidator for the given parameters. |
static <O> BeanListValidator<O> |
newValidator(String providerName,
Class<O> type,
String context,
NuitonValidatorScope... scopes)
Obtain a new
BeanListValidator for the given parameters. |
protected void |
rebuildDelegateValidator(Class<O> beanType,
String context,
NuitonValidatorScope... scopes) |
void |
removeAllBeans()
Shortcut method to unregister all previously registred beans from
this validator.
|
void |
removeAllBeans(Collection<O> beansToRemove)
Remove all the given beans fro this validator.
|
void |
removeBean(O bean)
Remove the given bean from the validaotr.
|
void |
removeBeanListValidatorListener(BeanListValidatorListener listener) |
protected void |
validate()
il faut eviter le code re-intrant (durant une validation, une autre est
demandee).
|
protected void |
validate(O bean) |
addPropertyChangeListener, addPropertyChangeListener, containsField, firePropertyChange, getContext, getEffectiveFields, getEffectiveFields, getEffectiveScopes, getModel, getScopes, getType, isCanValidate, isChanged, isValid, removePropertyChangeListener, removePropertyChangeListener, setCanValidate, setChanged, setContext, setScopes, setValidprotected final Map<O,BeanListValidator.NuitonValidatorContext<O>> contexts
protected NuitonValidator<O> delegate
public BeanListValidator(NuitonValidatorProvider validatorProvider, Class<O> beanClass, String context)
public BeanListValidator(NuitonValidatorProvider validatorProvider, Class<O> beanClass, String context, NuitonValidatorScope... scopes)
public static <O> BeanListValidator<O> newValidator(Class<O> type, String context, NuitonValidatorScope... scopes) throws NullPointerException
BeanListValidator for the given parameters.
Note: It will use the default provider of NuitonValidatorO - type of bean to validatetype - type of bean to validatecontext - context of validationscopes - authorized scopes (if null, will use all scopes)BeanListValidator.NullPointerException - if type is nullNuitonValidatorFactory.getDefaultProviderName()public static <O> BeanListValidator<O> newValidator(String providerName, Class<O> type, String context, NuitonValidatorScope... scopes) throws NullPointerException
BeanListValidator for the given parameters.
Note: It will use the provider of NuitonValidator
defined by the providerName.O - type of bean to validateproviderName - name of NuitonValidator to usetype - type of bean to validatecontext - context of validationscopes - authorized scopes (if null, will use all scopes)BeanListValidator.NullPointerException - if type is nullNuitonValidatorFactory.getProvider(String)public void addBean(O bean)
bean - the bean to attach (can not be null).public void addAllBeans(Collection<O> beansToAdd)
public void removeBean(O bean)
null, nor not has been previously
registred in this validator.bean - the bean to unregisterpublic void removeAllBeans(Collection<O> beansToRemove)
removeBean(Object), each bean must be not
null and has been previously registred in this validator.beansToRemove - beans to remove from this validatorpublic void removeAllBeans()
public boolean hasFatalErrors()
hasFatalErrors in class AbstractValidator<O>public boolean hasErrors()
hasErrors in class AbstractValidator<O>public boolean hasWarnings()
hasWarnings in class AbstractValidator<O>public boolean hasInfos()
hasInfos in class AbstractValidator<O>public boolean isValid(String fieldName)
isValid in class AbstractValidator<O>public NuitonValidatorScope getHighestScope(String field)
getHighestScope in class AbstractValidator<O>public void doValidate()
doValidate in class AbstractValidator<O>public <T> T convert(O bean, String fieldName, String value, Class<T> valueClass)
convert in class AbstractValidator<O>T - the type of conversionfieldName - the name of the bean propertyvalue - the value to convertvalueClass - the type of converted valuepublic void addBeanListValidatorListener(BeanListValidatorListener listener)
public void removeBeanListValidatorListener(BeanListValidatorListener listener)
public BeanListValidatorListener[] getBeanListValidatorListeners()
protected void doValidate(O bean)
doValidate in class AbstractValidator<O>protected NuitonValidator<O> getDelegate()
getDelegate in class AbstractValidator<O>protected void rebuildDelegateValidator(Class<O> beanType, String context, NuitonValidatorScope... scopes)
rebuildDelegateValidator in class AbstractValidator<O>protected void validate()
PropertyChangeListener
Note: la methode est protected et on utilise la methode
doValidate() car la méthode ne modifie pas les etats
internes et cela en rend son utilisation delicate (le validateur entre
dans un etat incoherent par rapport aux messages envoyés).protected void validate(O bean)
protected boolean isValid0()
protected void mergeMessages(BeanListValidator.NuitonValidatorContext<O> context, NuitonValidatorResult newMessages)
protected void fireFieldChanged(BeanListValidatorEvent evt)
public BeanListValidator.NuitonValidatorContext<O> getContext(O bean)
Copyright © 2013–2014 CodeLutin. All rights reserved.