Class XWork2ScopeValidator<O>

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

public class XWork2ScopeValidator<O>
extends java.lang.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:
Tony Chemit - chemit@codelutin.com
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected java.lang.String context
    the validation named context (can be null)
    protected static java.util.Map<java.lang.String,​java.util.List<java.lang.String>> EMPTY_RESULT  
    protected java.util.Set<java.lang.String> fieldNames
    the list of field names detected for this validator
    protected java.lang.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

    Constructors 
    Modifier Constructor Description
    protected XWork2ScopeValidator​(java.lang.Class<O> type, java.lang.String context, java.util.Set<java.lang.String> fieldNames, com.opensymphony.xwork2.util.ValueStack vs)  
  • Method Summary

    Modifier and Type Method Description
    boolean containsField​(java.lang.String fieldName)
    Test if the validator contains the field given his name
    java.lang.String getContext()  
    java.util.Set<java.lang.String> getFieldNames()  
    java.lang.Class<O> getType()  
    com.opensymphony.xwork2.validator.ActionValidatorManager getValidator()  
    java.lang.String toString()  
    java.util.Map<java.lang.String,​java.util.List<java.lang.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 Details

    • EMPTY_RESULT

      protected static final java.util.Map<java.lang.String,​java.util.List<java.lang.String>> EMPTY_RESULT
    • type

      protected final java.lang.Class<O> type
      the type of bean to validate
    • context

      protected java.lang.String context
      the validation named context (can be null)
    • fieldNames

      protected java.util.Set<java.lang.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 Details

    • XWork2ScopeValidator

      protected XWork2ScopeValidator​(java.lang.Class<O> type, java.lang.String context, java.util.Set<java.lang.String> fieldNames, com.opensymphony.xwork2.util.ValueStack vs)
  • Method Details

    • getType

      public java.lang.Class<O> getType()
    • getContext

      public java.lang.String getContext()
    • getFieldNames

      public java.util.Set<java.lang.String> getFieldNames()
    • getValidator

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

      public boolean containsField​(java.lang.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 java.util.Map<java.lang.String,​java.util.List<java.lang.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 java.lang.String toString()
      Overrides:
      toString in class java.lang.Object