Class ValidationResult

  • All Implemented Interfaces:
    Serializable

    public class ValidationResult
    extends Object
    implements Serializable
    Contains the results of a validation process. There might have general errors or property-specific errors.
    See Also:
    Serialized Form
    • Constructor Detail

      • ValidationResult

        public ValidationResult()
      • ValidationResult

        public ValidationResult​(String error)
        Constructs a ValidationResult with a single general error
      • ValidationResult

        public ValidationResult​(String name,
                                String error)
        Constructs a ValidationResult with a single property error
    • Method Detail

      • addCustomFieldError

        public void addCustomFieldError​(String field,
                                        String error)
        Adds a custom field error
      • addGeneralError

        public void addGeneralError​(String error)
        Adds a general error
      • addPropertyError

        public void addPropertyError​(String property,
                                     String error)
        Adds a property error
      • getAllErrors

        public List<String> getAllErrors()
      • getCustomFieldErrors

        public List<String> getCustomFieldErrors​(String customField)
      • getCustomFields

        public List<String> getCustomFields()
      • getFirstError

        public String getFirstError()
        Returns the first validation error message, if any
      • getGeneralErrors

        public List<String> getGeneralErrors()
      • getProperties

        public List<String> getProperties()
      • getPropertyErrors

        public List<String> getPropertyErrors​(String property)
      • hasCustomFieldErrors

        public boolean hasCustomFieldErrors()
        Checks if there are any custom field errors
      • hasErrors

        public boolean hasErrors()
        Checks if there are any errors, either general or property-specific
      • hasGeneralErrors

        public boolean hasGeneralErrors()
        Checks if there are any general errors
      • hasPropertyErrors

        public boolean hasPropertyErrors()
        Checks if there are any property errors
      • merge

        public void merge​(ValidationResult other,
                          String propertyNamePrefix)
        Merges the given ValidationResult with this, optionally prefixing the other property error names with the given prefix
      • setCustomFieldErrors

        public void setCustomFieldErrors​(Map<String,​List<String>> customFieldErrors)
      • setCustomFields

        public void setCustomFields​(List<String> customFields)
      • setGeneralErrors

        public void setGeneralErrors​(List<String> generalErrors)
      • setProperties

        public void setProperties​(List<String> properties)
      • setPropertyErrors

        public void setPropertyErrors​(Map<String,​List<String>> propertyErrors)
      • toHtmlString

        public String toHtmlString​(String errorTitle)