クラス 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 implements ValidatableEntity .
 
 ValidationResult validationResult = Envali.validate(concreteValidatableEntity);
 * // Returns true if there is a error on any ValidatableEntity , otherwise false
 validationResult.hasError();
 
 
 Get a business error of a specified entity that implements ValidatableEntity .
 
 ValidationResult validationResult = Envali.validate(concreteValidatableEntity);

 * // Returns List<BusinessError>
 List<BusinessError> businessErrors = validationResult.getError(ConcreteValidatableEntity.class);
 
 
導入されたバージョン:
1.0.1
関連項目:
直列化された形式
  • メソッドの詳細

    • none

      public static ValidationResult none()
      Returns the new instance of empty ValidationResult .
      戻り値:
      The new instance of empty ValidationResult .
    • of

      public static ValidationResult of​(@NonNull @NonNull Map<Class<? extends ValidatableEntity>,​List<BusinessError>> validationResult)
      Returns the new instance of ValidationResult based on validationResult passed as an argument.
      パラメータ:
      validationResult - The validation result
      戻り値:
      The new instance of ValidationResult
      例外:
      NullPointerException - If null is passed as an argument
    • getError

      public List<BusinessError> getError​(@NonNull @NonNull Class<? extends ValidatableEntity> validatableEntity)
      Returns the error list associated with the validatableEntity passed as an argument.

      This method returns immutable empty List created by List.of() if there is no error data associated with validatableEntity .

      This method recursively searches the error data associated with the validatableEntity object passed as argument.

      パラメータ:
      validatableEntity - The validatable entity
      戻り値:
      The error list associated with the validatableEntity passed as an argument if there is an error, otherwise immutable empty List created by List.of() .
      例外:
      NullPointerException - If null is passed as an argument
    • hasError

      public boolean hasError()
      Tests for the presence of any business error in the validation result.
      戻り値:
      true if there is any business error, otherwise false
    • toString

      public String toString()
      オーバーライド:
      toString クラス内 Object
    • equals

      public boolean equals​(Object o)
      オーバーライド:
      equals クラス内 Object
    • hashCode

      public int hashCode()
      オーバーライド:
      hashCode クラス内 Object