クラス ValidationResult
java.lang.Object
org.thinkit.framework.envali.result.ValidationResult
- すべての実装されたインタフェース:
Serializable
public final class ValidationResult extends Object implements Serializable
A data class that manages the results of validation by
Envali .
Manages ErrorType.RECOVERABLE and ErrorType.UNRECOVERABLE
business errors as a result of validation. Detected business errors are
managed on a per-entity basis implementing the ValidatableEntity
interface.
It provides the following features to operate comfortably with detected business errors.
Test for the presence of business errors on any entity that implementsValidatableEntity.ValidationResult validationResult = Envali.validate(concreteValidatableEntity); * // Returns true if there is a error on anyValidatableEntity, otherwise false validationResult.hasError();
Get a business error of a specified entity that implementsValidatableEntity.ValidationResult validationResult = Envali.validate(concreteValidatableEntity); * // Returns List<BusinessError> List<BusinessError> businessErrors = validationResult.getError(ConcreteValidatableEntity.class);
- 導入されたバージョン:
- 1.0.1
- 関連項目:
- 直列化された形式
-
メソッドの概要
修飾子とタイプ メソッド 説明 booleanequals(Object o)List<BusinessError>getError(@NonNull Class<? extends ValidatableEntity> validatableEntity)Returns the error list associated with thevalidatableEntitypassed as an argument.booleanhasError()Tests for the presence of any business error in the validation result.inthashCode()static ValidationResultnone()Returns the new instance of emptyValidationResult.static ValidationResultof(@NonNull Map<Class<? extends ValidatableEntity>,List<BusinessError>> validationResult)Returns the new instance ofValidationResultbased onvalidationResultpassed as an argument.StringtoString()
-
メソッドの詳細
-
none
Returns the new instance of emptyValidationResult.- 戻り値:
- The new instance of empty
ValidationResult.
-
of
public static ValidationResult of(@NonNull @NonNull Map<Class<? extends ValidatableEntity>,List<BusinessError>> validationResult)Returns the new instance ofValidationResultbased onvalidationResultpassed as an argument.- パラメータ:
validationResult- The validation result- 戻り値:
- The new instance of
ValidationResult - 例外:
NullPointerException- Ifnullis passed as an argument
-
getError
public List<BusinessError> getError(@NonNull @NonNull Class<? extends ValidatableEntity> validatableEntity)Returns the error list associated with thevalidatableEntitypassed as an argument.This method returns immutable empty List created by
List.of()if there is no error data associated withvalidatableEntity.This method recursively searches the error data associated with the
validatableEntityobject passed as argument.- パラメータ:
validatableEntity- The validatable entity- 戻り値:
- The error list associated with the
validatableEntitypassed as an argument if there is an error, otherwise immutable empty List created byList.of(). - 例外:
NullPointerException- Ifnullis passed as an argument
-
hasError
public boolean hasError()Tests for the presence of any business error in the validation result.- 戻り値:
trueif there is any business error, otherwisefalse
-
toString
-
equals
-
hashCode
public int hashCode()
-