Class ValidationResult

java.lang.Object
se.idsec.signservice.integration.core.validation.ValidationResult

public class ValidationResult extends Object
Class holding validation results (errors).
Author:
Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
  • Constructor Details

    • ValidationResult

      public ValidationResult(String objectName)
      Constructor.
      Parameters:
      objectName - the name for the object that is validated (null for no name)
  • Method Details

    • getObjectName

      public String getObjectName()
      Gets the name for the object that was validated.
      Returns:
      the name for the object that was validated (null if the object isn't given a name)
    • hasErrors

      public boolean hasErrors()
      Predicate telling if this object holds any errors.
      Returns:
      true if this object holds errors and false otherwise
    • getGlobalError

      public String getGlobalError()
      Returns the global error message for this object (if any)
      Returns:
      the global error message or null
    • getFieldErrors

      public Map<String,String> getFieldErrors()
      Returns the "field" errors of this object.
      Returns:
      a map (possibly empty) with field names and their error messages
    • reject

      public void reject(String msg)
      Register an error for the entire object.
      Parameters:
      msg - the error message
    • rejectValue

      public void rejectValue(String field, String msg)
      Register an error for a specific field.
      Parameters:
      field - the field name
      msg - the error message
    • setFieldErrors

      public void setFieldErrors(ValidationResult result)
      If an underlying object (to this object) has been verified, its result should be installed.
      Parameters:
      result - the result from the underlying object
    • toString

      public String toString()
      Overrides:
      toString in class Object