org.nuiton.validator.xwork2
Class XWork2ScopeValidator<O>

java.lang.Object
  extended by org.nuiton.validator.xwork2.XWork2ScopeValidator<O>
Type Parameters:
O - type of the bean to validate.

public class XWork2ScopeValidator<O>
extends Object

A customized validator for a given bean.

Use the method validate(Object) to obtain the messages detected by the validator for the given bean.

Since:
2.0
Author:
tchemit

Field Summary
protected  String context
          the validation named context (can be null)
protected static Map<String,List<String>> EMPTY_RESULT
           
protected  Set<String> fieldNames
          the list of field names detected for this validator
protected  Class<O> type
          the type of bean to validate
protected  com.opensymphony.xwork2.validator.DelegatingValidatorContext validationContext
           
protected  com.opensymphony.xwork2.ValidationAwareSupport validationSupport
           
protected  com.opensymphony.xwork2.validator.ActionValidatorManager validator
           
protected  com.opensymphony.xwork2.util.ValueStack vs
           
 
Constructor Summary
protected XWork2ScopeValidator(Class<O> type, String context, Set<String> fieldNames, com.opensymphony.xwork2.util.ValueStack vs)
           
 
Method Summary
 boolean containsField(String fieldName)
          Test if the validator contains the field given his name
 String getContext()
           
 Set<String> getFieldNames()
           
 Class<O> getType()
           
 com.opensymphony.xwork2.validator.ActionValidatorManager getValidator()
           
 String toString()
           
 Map<String,List<String>> validate(O bean)
          Valide le bean donné et retourne les messages produits.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_RESULT

protected static final Map<String,List<String>> EMPTY_RESULT

type

protected final Class<O> type
the type of bean to validate


context

protected String context
the validation named context (can be null)


fieldNames

protected Set<String> fieldNames
the list of field names detected for this validator


validationSupport

protected com.opensymphony.xwork2.ValidationAwareSupport validationSupport

validationContext

protected com.opensymphony.xwork2.validator.DelegatingValidatorContext validationContext

validator

protected com.opensymphony.xwork2.validator.ActionValidatorManager validator

vs

protected com.opensymphony.xwork2.util.ValueStack vs
Constructor Detail

XWork2ScopeValidator

protected XWork2ScopeValidator(Class<O> type,
                               String context,
                               Set<String> fieldNames,
                               com.opensymphony.xwork2.util.ValueStack vs)
Method Detail

getType

public Class<O> getType()

getContext

public String getContext()

getFieldNames

public Set<String> getFieldNames()

getValidator

public com.opensymphony.xwork2.validator.ActionValidatorManager getValidator()

containsField

public boolean containsField(String fieldName)
Test if 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

validate

public Map<String,List<String>> validate(O bean)
Valide le bean donné et retourne les messages produits.

Parameters:
bean - le bean a valider (il doit etre non null)
Returns:
le dictionnaire des messages produits par la validation indexées par le nom du champs du bean impacté.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011 CodeLutin. All Rights Reserved.