Package uk.num.validators
Class ValidationResult
- java.lang.Object
-
- uk.num.validators.ValidationResult
-
public class ValidationResult extends java.lang.ObjectThe results of a validator
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classValidationResult.ErrorCodePossible errorsstatic classValidationResult.ResultError result POJO
-
Field Summary
Fields Modifier and Type Field Description static ValidationResultVALID_NO_ERRORSOnly one of these really needed.
-
Constructor Summary
Constructors Constructor Description ValidationResult()Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMessage(@NonNull ValidationResult.ErrorCode code, java.lang.String offendingPart)Add an error messagebooleanisValid()The result of the validation.voidmerge(@NonNull ValidationResult other)Merge errors from another validator
-
-
-
Field Detail
-
VALID_NO_ERRORS
public static final ValidationResult VALID_NO_ERRORS
Only one of these really needed.
-
-
Method Detail
-
addMessage
public void addMessage(@NonNull @NonNull ValidationResult.ErrorCode code, java.lang.String offendingPart)Add an error message- Parameters:
code- an ErrorCodeoffendingPart- something to indicate what contains the error. Can be null.
-
isValid
public boolean isValid()
The result of the validation.- Returns:
- false if there are any error messages
-
merge
public void merge(@NonNull @NonNull ValidationResult other)Merge errors from another validator- Parameters:
other- a ValidationResult
-
-