Package liquibase.exception
Class ValidationErrors
- java.lang.Object
-
- liquibase.exception.ValidationErrors
-
public class ValidationErrors extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected Stringchangeprotected List<String>errorMessagesprotected List<String>warningMessages
-
Constructor Summary
Constructors Constructor Description ValidationErrors()ValidationErrors(String change)ValidationErrors(Change change)ValidationErrors(Precondition precondition)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ValidationErrorsaddAll(ValidationErrors validationErrors)voidaddAll(ValidationErrors validationErrors, ChangeSet changeSet)ValidationErrorsaddError(String message)ValidationErrorsaddError(String message, ChangeSet changeSet)ValidationErrorsaddWarning(String message)voidcheckDisallowedField(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).ValidationErrorscheckRequiredField(String requiredFieldName, Object value)Convenience method forcheckRequiredField(String, Object, String, boolean)with allowEmptyValue=falseValidationErrorscheckRequiredField(String requiredFieldName, Object value, boolean allowEmptyValue)Convenience method forcheckRequiredField(String, Object, String, boolean)with a null postfixValidationErrorscheckRequiredField(String requiredFieldName, Object value, String postfix)Convenience method forcheckRequiredField(String, Object, String, boolean)with allowEmptyValue=falseValidationErrorscheckRequiredField(String requiredFieldName, Object value, String postfix, boolean allowEmptyValue)Checks that the given value is set.booleanequals(Object obj)StringgetChangeName()List<String>getErrorMessages()List<String>getRequiredErrorMessages()List<String>getUnsupportedErrorMessages()List<String>getWarningMessages()booleanhasErrors()inthashCode()StringtoString()
-
-
-
Constructor Detail
-
ValidationErrors
public ValidationErrors()
-
ValidationErrors
public ValidationErrors(String change)
-
ValidationErrors
public ValidationErrors(Change change)
-
ValidationErrors
public ValidationErrors(Precondition precondition)
-
-
Method Detail
-
hasErrors
public boolean hasErrors()
-
getChangeName
public String getChangeName()
-
checkRequiredField
public ValidationErrors checkRequiredField(String requiredFieldName, Object value)
Convenience method forcheckRequiredField(String, Object, String, boolean)with allowEmptyValue=false
-
checkRequiredField
public ValidationErrors checkRequiredField(String requiredFieldName, Object value, boolean allowEmptyValue)
Convenience method forcheckRequiredField(String, Object, String, boolean)with a null postfix
-
checkRequiredField
public ValidationErrors checkRequiredField(String requiredFieldName, Object value, String postfix)
Convenience method forcheckRequiredField(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 checkedvalue- value that might be disalloweddatabase- database the object/value combination is checked againstdisallowedDatabases- 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)
-
addWarning
public ValidationErrors addWarning(String message)
-
addAll
public ValidationErrors addAll(ValidationErrors validationErrors)
-
addAll
public void addAll(ValidationErrors validationErrors, ChangeSet changeSet)
-
-