Class ValidatorBaseTag<T extends Validator>

  • Type Parameters:
    T - the type of validator handled by this base class
    All Implemented Interfaces:
    ConditionalTag, PropertiesSupport, PropertySupport, org.apache.commons.jelly.DynaTag, org.apache.commons.jelly.impl.BeanSource, org.apache.commons.jelly.Tag
    Direct Known Subclasses:
    ValidatorsTag, ValidatorTag

    public class ValidatorBaseTag<T extends Validator>
    extends TransformerBaseTag<T>

    A base class for tag handler implementations that create validators for input components.

    There are two kinds of validators supported by the form builder framework:

    • plain (or primitive) validators
    • ChainValidators, which can contain multiple plain validators
    Sub classes of this class will deal with specific validator types. This base class provides common functionality required in all cases.

    Version:
    $Id: ValidatorBaseTag.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    • Constructor Detail

      • ValidatorBaseTag

        public ValidatorBaseTag()
        Creates a new instance of ValidatorTag.
      • ValidatorBaseTag

        public ValidatorBaseTag​(Class<?> defClass)
        Creates a new instance of ValidatorTag and sets the default class.
        Parameters:
        defClass - the default class to be used
    • Method Detail

      • getValidationPhase

        protected ValidationPhase getValidationPhase()
                                              throws org.apache.commons.jelly.JellyTagException
        Returns the validation phase for the current validator.
        Returns:
        the validation phase
        Throws:
        org.apache.commons.jelly.JellyTagException - if the phase is not set or invalid
      • handleInputComponentTag

        protected void handleInputComponentTag​(InputComponentTag tag,
                                               T bean)
                                        throws org.apache.commons.jelly.JellyTagException
        Processes the specified input component tag. The validator will be passed to this tag.
        Specified by:
        handleInputComponentTag in class TransformerBaseTag<T extends Validator>
        Parameters:
        tag - the input component tag
        bean - the validator to pass
        Throws:
        org.apache.commons.jelly.JellyTagException - if an error occurs
      • handleOtherParent

        protected boolean handleOtherParent​(org.apache.commons.jelly.Tag parent,
                                            T bean)
                                     throws org.apache.commons.jelly.JellyTagException
        Processes the parent tag if it is no input component tag. This implementation checks whether the tag is a ValidatorsTag. If this is the case, the child validator will be added to it.
        Overrides:
        handleOtherParent in class TransformerBaseTag<T extends Validator>
        Parameters:
        parent - the parent tag
        bean - the validator bean
        Returns:
        a flag whether the parent tag is supported
        Throws:
        org.apache.commons.jelly.JellyTagException - if an error occurs