Class ComponentValidators


  • public class ComponentValidators
    extends Object

    This class is responsible for adding default validators and/or validators that wrap multiple EditableValueHolder instances within the view.

    • Constructor Detail

      • ComponentValidators

        public ComponentValidators()
    • Method Detail

      • getValidators

        public static ComponentValidators getValidators​(FacesContext context,
                                                        boolean createIfNull)
        Parameters:
        context - the FacesContext for the current request
        createIfNull - flag indicating whether or not a ComponentValidators instance should be created or not
        Returns:
        a ComponentValidators instance for processing a view request. If createIfNull is false and no ComponentValidators has been created, this method will return null
      • addDefaultValidatorsToComponent

        public static void addDefaultValidatorsToComponent​(FacesContext ctx,
                                                           EditableValueHolder editableValueHolder)

        Creates and installs default validators, if any, into the argument EditableValueHolder. This method is merely a utility method to be called when there is no ComponentValidators available, or there are no ValidatorInfo instances on the stack.

        Parameters:
        ctx - the FacesContext for the current request
        editableValueHolder - the component receiving the Validators
      • addValidators

        public void addValidators​(FacesContext ctx,
                                  EditableValueHolder editableValueHolder)

        Based on the ValidatorInfo instances present on the stack, configure the argument EditableValueHolder with Validators created from the available info.

        Parameters:
        ctx - the FacesContext for the current request
        editableValueHolder - the component receiving the Validators
      • pushValidatorInfo

        public void pushValidatorInfo​(ComponentValidators.ValidatorInfo info)

        Pushes the provided ValidatorInfo onto the stack.

        Parameters:
        info - validator info
      • popValidatorInfo

        public void popValidatorInfo()

        Pops the last ValidatorInfo instance from the stack.