Class ValidationErrors

java.lang.Object
liquibase.exception.ValidationErrors

public class ValidationErrors extends Object
  • Field Details

    • errorMessages

      protected List<String> errorMessages
    • warningMessages

      protected List<String> warningMessages
    • change

      protected String change
  • Constructor Details

    • ValidationErrors

      public ValidationErrors()
    • ValidationErrors

      public ValidationErrors(String change)
    • ValidationErrors

      public ValidationErrors(Change change)
    • ValidationErrors

      public ValidationErrors(Precondition precondition)
  • Method Details

    • hasErrors

      public boolean hasErrors()
    • getChangeName

      public String getChangeName()
    • checkRequiredField

      public ValidationErrors checkRequiredField(String requiredFieldName, Object value)
      Convenience method for checkRequiredField(String, Object, String, boolean) with allowEmptyValue=false
    • checkRequiredField

      public ValidationErrors checkRequiredField(String requiredFieldName, Object value, boolean allowEmptyValue)
      Convenience method for checkRequiredField(String, Object, String, boolean) with a null postfix
    • checkRequiredField

      public ValidationErrors checkRequiredField(String requiredFieldName, Object value, String postfix)
      Convenience method for checkRequiredField(String, Object, String, boolean) with allowEmptyValue=false
    • checkRequiredField

      public ValidationErrors checkRequiredField(String requiredFieldName, Object value, String postfix, boolean allowEmptyValue)
      Checks that the given value is set.
      Parameters:
      allowEmptyValue - If true, empty string and empty arrays are allowed. If false, they are not.
    • checkDisallowedField

      @SafeVarargs public final void checkDisallowedField(String disallowedFieldName, Object value, Database database, Class<? extends Database>... disallowedDatabases)

      Checks if a field is forbidden in combination with a given Database (most often because that database does not implement the features required by the field/value combination). If a "forbidden" use is detected, a validation error is added to the current list of ValidationErrors.

      Note:
      • if value==null, the field is ALLOWED for all DBs
      • if the disallowedDatabases list does not at least contain 1 entry, the field is NOT allowed
      Parameters:
      disallowedFieldName - field whose value is checked
      value - value that might be disallowed
      database - database the object/value combination is checked against
      disallowedDatabases - a list of "forbidden" databases that do not allow this field/value combination
    • addError

      public ValidationErrors addError(String message)
    • addError

      public ValidationErrors addError(String message, ChangeSet changeSet)
    • getErrorMessages

      public List<String> getErrorMessages()
    • addWarning

      public ValidationErrors addWarning(String message)
    • getWarningMessages

      public List<String> getWarningMessages()
    • addAll

      public ValidationErrors addAll(ValidationErrors validationErrors)
    • addAll

      public void addAll(ValidationErrors validationErrors, ChangeSet changeSet)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getRequiredErrorMessages

      public List<String> getRequiredErrorMessages()
    • getUnsupportedErrorMessages

      public List<String> getUnsupportedErrorMessages()