Class JsfValidationResult

  • All Implemented Interfaces:
    Serializable

    public class JsfValidationResult
    extends Object
    implements Serializable
    Represents the result of a JSF validation phase. Contains all generated messages and whether validation failed or was passed. This can be used, for example, to restore error messages and validation results later.
    Since:
    7.0.0
    Author:
    XIMA MEDIA GmbH
    See Also:
    Serialized Form
    • Constructor Detail

      • JsfValidationResult

        public JsfValidationResult​(boolean validationFailed,
                                   Map<String,​List<javax.faces.application.FacesMessage>> messages,
                                   Map<String,​Boolean> validState,
                                   javax.faces.application.FacesMessage.Severity maximumSeverity)
        Creates a new POJO with the given values.
        Parameters:
        validationFailed - The value that will be returned by isValidationFailed().
        messages - The value that will be returned by getMessages().
        validState - The value that will be returned by getValidState().
        maximumSeverity - The value that will be returned by getMaximumSeverity().
    • Method Detail

      • getMaximumSeverity

        @Nullable
        public javax.faces.application.FacesMessage.Severity getMaximumSeverity()
        Returns:
        The maximum FacesMessage.getSeverity() of all getMessages(). Will be null when there are no messages.
      • getMessages

        public com.google.common.collect.ImmutableMap<String,​List<javax.faces.application.FacesMessage>> getMessages()
        Returns:
        A map between the client ID of each UIInput and the FacesMessages that were added to it.
      • getValidState

        public com.google.common.collect.ImmutableMap<String,​Boolean> getValidState()
        Returns:
        A map between the client ID of each UIInput and its EditableValueHolder.isValid() value.
      • isValidationFailed

        public boolean isValidationFailed()
        Returns:
        Whether validation failed, i.e. whether the is at least one EditableValueHolder.isValid() set to false.
      • empty

        public static JsfValidationResult empty()
        Returns:
        A validation result that is valid and has no messages.
      • merge

        public JsfValidationResult merge​(JsfValidationResult other)
        Parameters:
        other - Another result to merge.
        Returns:
        A new result with the given result merged into it. The valid state and the messages of the given result override the valid state and messages of this result. The maximum severity is calculated as the maximum of this result and the given result. The new result has isValidationFailed() marked as true if it is set to true for either result.