Class XWork2NuitonValidatorProvider

java.lang.Object
org.nuiton.validator.AbstractNuitonValidatorProvider
org.nuiton.validator.xwork2.XWork2NuitonValidatorProvider
All Implemented Interfaces:
NuitonValidatorProvider

public class XWork2NuitonValidatorProvider
extends AbstractNuitonValidatorProvider
Provider of validator for the xworks nuiton validator.
Since:
2.0
Author:
Tony Chemit - chemit@codelutin.com
  • Field Details

  • Constructor Details

  • Method Details

    • newModel

      public <O> NuitonValidatorModel<O> newModel​(java.lang.Class<O> type, java.lang.String context, NuitonValidatorScope... scopes)
      Description copied from interface: NuitonValidatorProvider
      Instanciate a new validator model for the given parameters.
      Type Parameters:
      O - type of the class to validate
      Parameters:
      type - type of the class to validate
      context - context of validation (null if no context)
      scopes - filtered scope (if nothing given, then use all scopes)
      Returns:
      the new instanciated model of validation
    • newValidator

      public <O> XWork2NuitonValidator<O> newValidator​(NuitonValidatorModel<O> model)
      Description copied from interface: NuitonValidatorProvider
      Obtains a new validator for the given model.
      Type Parameters:
      O - type of class to validate
      Parameters:
      model - the model of validator to use
      Returns:
      the new validator
    • detectValidators

      public java.util.SortedSet<NuitonValidator<?>> detectValidators​(java.io.File sourceRoot, java.util.regex.Pattern contextFilter, NuitonValidatorScope[] scopes, java.lang.Class<?>... types)
      Description copied from interface: NuitonValidatorProvider
      Detects in the given directory validators.
      Parameters:
      sourceRoot - root directory where to seek for validators
      contextFilter - the pattern of context to seek
      scopes - scopes to seek (if none given, will seek for all scopes)
      types - types of class to seek
      Returns:
      the set of validators found
    • getValidator

      protected <O> NuitonValidator<O> getValidator​(java.lang.Class<O> klass, java.lang.String context, NuitonValidatorScope... scopes)
      Pour un context et un type d'entité donné, instancie un validateur et test si ce validateur est utilisable (i.e qu'il admet des champs à valider). Si aucun champ n'est trouvé dans le validateur, alors on retourne null.
      Type Parameters:
      O - le type du bean
      Parameters:
      klass - le type du bean
      context - le context du validateur
      scopes - les scopes a utiliser (si null alors pas de filtre sur les scopes)
      Returns:
      le validateur initialisé, ou null si aucun scope détecté dans le validateur.
    • getClassDir

      protected java.io.File getClassDir​(java.io.File sourceRoot, java.lang.Class<?> clazz)
    • getContexts

      protected java.lang.String[] getContexts​(java.lang.Class<?> clazz, java.io.File dir)
    • getContextsWithoutScopes

      protected java.lang.String[] getContextsWithoutScopes​(java.lang.String[] contexts)
    • getFilterContexts

      protected java.lang.String[] getFilterContexts​(java.util.regex.Pattern contextFilter, java.lang.String[] realContexts)