jaxx.runtime.validator
Class BeanValidator<B>

java.lang.Object
  extended by jaxx.runtime.validator.BeanValidator<B>
Type Parameters:
B - type of the bean to validate.
Direct Known Subclasses:
SwingValidator

Deprecated. since 2.2.4, the code is moved into the org.nuiton:nuiton-validator project, will be removed in version 2.3

@Deprecated
public class BeanValidator<B>
extends Object

A customized validator for a given bean.

Note: The bean must be listenable on properyChange events (means must have public addPropertychangeListener and removePropertyChangeListener methods).

Author:
tchemit

Field Summary
protected  B bean
          Deprecated. bean to be watched
static String BEAN_PROERTY
          Deprecated. la nom de la propriété bean
protected  Class<B> beanClass
          Deprecated. the type of bean to watch
protected  EventSetDescriptor beanEventDescriptor
          Deprecated. to add and remove PropertyChangeListener on watched beans
protected  boolean changed
          Deprecated. state to indicate that validator has changed since the last time bean was setted
static String CHANGED_PROERTY
          Deprecated. la nom de l'état changed
static String CONTEXT_NAME_PROPERTY
          Deprecated. la nom de la propriété contextName
protected  String contextName
          Deprecated. the validation named context (can be null)
protected  Map<String,String> conversionErrors
          Deprecated. map of conversion errors detected by this validator
protected  Set<BeanValidatorField<B>> fields
          Deprecated. list of fields watched by this validator
protected static BeanValidatorScope[] FILTER_SCOPES_EMPTY
          Deprecated.  
protected  BeanValidatorScope[] filterScopes
          Deprecated. filter scopes (if null, no filter on scopes)
protected  PropertyChangeListener l
          Deprecated. listener that listens on bean modification
protected  EventListenerList listenerList
          Deprecated. A list of event listeners for this validators
protected static org.apache.commons.logging.Log log
          Deprecated. Logger
protected  BeanValidator<?> parentValidator
          Deprecated. to chain to a prent validator
protected  PropertyChangeSupport pcs
          Deprecated. delegate property change support
protected  boolean valid
          Deprecated. state of the validator (is true if no errors of error scope is found)
static String VALID_PROERTY
          Deprecated. la nom de l'état valid
protected  EnumMap<BeanValidatorScope,XWorkBeanValidator<B>> validators
          Deprecated. xworks scope validator *
 
Constructor Summary
BeanValidator(Class<B> beanClass, String contextName)
          Deprecated.  
BeanValidator(Class<B> beanClass, String contextName, BeanValidatorScope... filterScopes)
          Deprecated.  
 
Method Summary
 void addBeanValidatorListener(BeanValidatorListener listener)
          Deprecated.  
 void addPropertyChangeListener(PropertyChangeListener listener)
          Deprecated.  
 void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Deprecated.  
protected  boolean canValidate()
          Deprecated.  
 boolean containsField(String fieldName)
          Deprecated. Test a the validator contains the field given his name
<T> T
convert(String fieldName, String value, Class<T> valueClass)
          Deprecated. Convert a value.
 void doValidate()
          Deprecated. Methode pour forcer la revalidation d'un bean en mettant a jour les etats internes.
protected  void fireFieldChanged(BeanValidatorField<B> field, BeanValidatorScope scope, String[] toAdd, String[] toDelete)
          Deprecated.  
 B getBean()
          Deprecated.  
 Class<B> getBeanClass()
          Deprecated.  
protected  EventSetDescriptor getBeanEventDescriptor(B bean)
          Deprecated.  
 BeanValidatorListener[] getBeanValidatorListeners()
          Deprecated.  
 String getContextName()
          Deprecated.  
 BeanValidatorField<B> getField(String fieldName)
          Deprecated.  
 Set<BeanValidatorField<B>> getFields()
          Deprecated.  
 BeanValidator<?> getParentValidator()
          Deprecated.  
 Set<BeanValidatorScope> getScopes()
          Deprecated.  
 boolean hasErrors()
          Deprecated.  
 boolean hasFatalErrors()
          Deprecated.  
 boolean hasInfos()
          Deprecated.  
 boolean hasWarnings()
          Deprecated.  
protected  void initFields()
          Deprecated.  
 boolean isChanged()
          Deprecated. Retourne vrai si l'objet bean a ete modifie depuis le dernier setBean(B)
 boolean isValid()
          Deprecated.  
 boolean isValid(String fieldName)
          Deprecated.  
 void removeBeanValidatorListener(BeanValidatorListener listener)
          Deprecated.  
 void removePropertyChangeListener(PropertyChangeListener listener)
          Deprecated.  
 void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Deprecated.  
 void setBean(B bean)
          Deprecated.  
 void setChanged(boolean changed)
          Deprecated. Permet de force la remise a false de l'etat de changement du bean
 void setContextName(String contextName)
          Deprecated.  
 void setFilterScopes(BeanValidatorScope... filterScopes)
          Deprecated. Sets the filter scopes.
 void setParentValidator(BeanValidator<?> parentValidator)
          Deprecated.  
 void setValid(boolean valid)
          Deprecated.  
 String toString()
          Deprecated.  
protected  void validate()
          Deprecated. il faut eviter le code re-intrant (durant une validation, une autre est demandee).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BEAN_PROERTY

public static final String BEAN_PROERTY
Deprecated. 
la nom de la propriété bean

See Also:
Constant Field Values

CONTEXT_NAME_PROPERTY

public static final String CONTEXT_NAME_PROPERTY
Deprecated. 
la nom de la propriété contextName

See Also:
Constant Field Values

VALID_PROERTY

public static final String VALID_PROERTY
Deprecated. 
la nom de l'état valid

See Also:
Constant Field Values

CHANGED_PROERTY

public static final String CHANGED_PROERTY
Deprecated. 
la nom de l'état changed

See Also:
Constant Field Values

log

protected static final org.apache.commons.logging.Log log
Deprecated. 
Logger


FILTER_SCOPES_EMPTY

protected static final BeanValidatorScope[] FILTER_SCOPES_EMPTY
Deprecated. 

beanClass

protected final Class<B> beanClass
Deprecated. 
the type of bean to watch


contextName

protected String contextName
Deprecated. 
the validation named context (can be null)


parentValidator

protected BeanValidator<?> parentValidator
Deprecated. 
to chain to a prent validator


changed

protected boolean changed
Deprecated. 
state to indicate that validator has changed since the last time bean was setted


valid

protected boolean valid
Deprecated. 
state of the validator (is true if no errors of error scope is found)


bean

protected B bean
Deprecated. 
bean to be watched


beanEventDescriptor

protected EventSetDescriptor beanEventDescriptor
Deprecated. 
to add and remove PropertyChangeListener on watched beans


fields

protected Set<BeanValidatorField<B>> fields
Deprecated. 
list of fields watched by this validator


conversionErrors

protected Map<String,String> conversionErrors
Deprecated. 
map of conversion errors detected by this validator


validators

protected EnumMap<BeanValidatorScope,XWorkBeanValidator<B>> validators
Deprecated. 
xworks scope validator *


filterScopes

protected BeanValidatorScope[] filterScopes
Deprecated. 
filter scopes (if null, no filter on scopes)


l

protected PropertyChangeListener l
Deprecated. 
listener that listens on bean modification


pcs

protected PropertyChangeSupport pcs
Deprecated. 
delegate property change support


listenerList

protected EventListenerList listenerList
Deprecated. 
A list of event listeners for this validators

Constructor Detail

BeanValidator

public BeanValidator(Class<B> beanClass,
                     String contextName)
Deprecated. 

BeanValidator

public BeanValidator(Class<B> beanClass,
                     String contextName,
                     BeanValidatorScope... filterScopes)
Deprecated. 
Method Detail

getBeanClass

public Class<B> getBeanClass()
Deprecated. 

getParentValidator

public BeanValidator<?> getParentValidator()
Deprecated. 

getContextName

public String getContextName()
Deprecated. 

getFields

public Set<BeanValidatorField<B>> getFields()
Deprecated. 

getScopes

public Set<BeanValidatorScope> getScopes()
Deprecated. 

isChanged

public boolean isChanged()
Deprecated. 
Retourne vrai si l'objet bean a ete modifie depuis le dernier setBean(B)

Returns:
true if bean was modify since last setBean(Object) invocation

isValid

public boolean isValid()
Deprecated. 

getBean

public B getBean()
Deprecated. 

getField

public BeanValidatorField<B> getField(String fieldName)
Deprecated. 

hasFatalErrors

public boolean hasFatalErrors()
Deprecated. 

hasErrors

public boolean hasErrors()
Deprecated. 

hasWarnings

public boolean hasWarnings()
Deprecated. 

hasInfos

public boolean hasInfos()
Deprecated. 

containsField

public boolean containsField(String fieldName)
Deprecated. 
Test a the validator contains the field given his name

Parameters:
fieldName - the name of the searched field
Returns:
true if validator contaisn this field, false otherwise

isValid

public boolean isValid(String fieldName)
Deprecated. 

setChanged

public void setChanged(boolean changed)
Deprecated. 
Permet de force la remise a false de l'etat de changement du bean

Parameters:
changed - flag to force reset of property changed

setValid

public void setValid(boolean valid)
Deprecated. 

setBean

public void setBean(B bean)
Deprecated. 

setContextName

public void setContextName(String contextName)
Deprecated. 

setFilterScopes

public void setFilterScopes(BeanValidatorScope... filterScopes)
Deprecated. 
Sets the filter scopes.

Parameters:
filterScopes - the scopes to used

setParentValidator

public void setParentValidator(BeanValidator<?> parentValidator)
Deprecated. 

convert

public <T> T convert(String fieldName,
                     String value,
                     Class<T> valueClass)
Deprecated. 
Convert a value.

If an error occurs, then add an error in validator.

Type Parameters:
T - the type of conversion
Parameters:
fieldName - the name of the bean property
value - the value to convert
valueClass - the type of converted value
Returns:
the converted value, or null if conversion was not ok

doValidate

public void doValidate()
Deprecated. 
Methode pour forcer la revalidation d'un bean en mettant a jour les etats internes.

La méthode appelle validate() puis met à jour les etats internes valid et changed.

Since:
1.5

validate

protected void validate()
Deprecated. 
il faut eviter le code re-intrant (durant une validation, une autre est demandee). Pour cela on fait la validation dans un thread, et tant que la premiere validation n'est pas fini, on ne repond pas aux solicitations. Cette method est public pour permettre de force une validation par programmation, ce qui est utile par exemple si le bean ne supporte pas les 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).


toString

public String toString()
Deprecated. 
Overrides:
toString in class Object

addBeanValidatorListener

public void addBeanValidatorListener(BeanValidatorListener listener)
Deprecated. 

removeBeanValidatorListener

public void removeBeanValidatorListener(BeanValidatorListener listener)
Deprecated. 

getBeanValidatorListeners

public BeanValidatorListener[] getBeanValidatorListeners()
Deprecated. 

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Deprecated. 

addPropertyChangeListener

public void addPropertyChangeListener(String propertyName,
                                      PropertyChangeListener listener)
Deprecated. 

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Deprecated. 

removePropertyChangeListener

public void removePropertyChangeListener(String propertyName,
                                         PropertyChangeListener listener)
Deprecated. 

canValidate

protected boolean canValidate()
Deprecated. 
Returns:
true if validation is enabled, false otherwise.

fireFieldChanged

protected void fireFieldChanged(BeanValidatorField<B> field,
                                BeanValidatorScope scope,
                                String[] toAdd,
                                String[] toDelete)
Deprecated. 

initFields

protected void initFields()
Deprecated. 

getBeanEventDescriptor

protected EventSetDescriptor getBeanEventDescriptor(B bean)
Deprecated. 


Copyright © 2008-2010 CodeLutin. All Rights Reserved.