クラス BusinessError
java.lang.Object
org.thinkit.framework.envali.result.BusinessError
- すべての実装されたインタフェース:
Serializable
public final class BusinessError extends Object implements Serializable
The class that represents a business error.
BusinessError handles both recoverable error and unrecoverable error,
and can be instantiated by calling the dedicated static constructor for each.
Provides hasNestedError() as a feature to test if a nested error of
ValidationResult exists, and hasError() to test if a
business error exists.
No error:
BusinessError businessError = BusinessError.none();
Recoverable error:
BusinessError businessError = BusinessError.recoverable("any error message");
Unrecoverable error:
BusinessError businessError = BusinessError.unrecoverable("any error message");
Nested error:
BusinessError businessError = BusinessError.nestedError(validationResult);
businessError.hasNestedError(); // It returns true
- 導入されたバージョン:
- 1.0.1
- 関連項目:
- 直列化された形式
-
メソッドの概要
修飾子とタイプ メソッド 説明 booleanequals(Object o)StringgetMessage()The messageValidationResultgetNestedError()The nested errorbooleanhasError()Tests for the presence of business error.inthashCode()booleanhasNestedError()Tests for the presence of nested error.booleanisRecoverable()Tests if a business error is a recoverable error.booleanisUnrecoverable()Tests if a business error is an unrecoverable error.static BusinessErrornestedError(@NonNull ValidationResult nestedError)Returns the new instance ofBusinessErrorwith the nested error ofValidationResult.static BusinessErrornone()Returns the new instance ofBusinessErrorwith the error typeInternalErrorType.NONE.static BusinessErrorrecoverable(@NonNull String message)Returns the new instance ofBusinessErrorwith the error typeInternalErrorType.RECOVERABLE.StringtoString()static BusinessErrorunrecoverable(@NonNull String message)Returns the new instance ofBusinessErrorwith the error typeInternalErrorType.UNRECOVERABLE.
-
メソッドの詳細
-
none
Returns the new instance ofBusinessErrorwith the error typeInternalErrorType.NONE. The instance ofBusinessErrorcreated bynone()indicates that there is no error.- 戻り値:
- The new instance of
BusinessErrorwith the error typeInternalErrorType.NONE
-
recoverable
Returns the new instance ofBusinessErrorwith the error typeInternalErrorType.RECOVERABLE. The instance ofBusinessErrorcreated byrecoverable(String)indicates a recoverable error.Use
unrecoverable(String)if you want to get an instance that indicates an unrecoverable error.- パラメータ:
message- The error message- 戻り値:
- The new instance of
BusinessErrorwith the error typeInternalErrorType.RECOVERABLE - 例外:
NullPointerException- Ifnullis passed as an argument
-
unrecoverable
Returns the new instance ofBusinessErrorwith the error typeInternalErrorType.UNRECOVERABLE. The instance ofBusinessErrorcreated byunrecoverable(String)indicates a unrecoverable error.Use
recoverable(String)if you want to get an instance that indicates an recoverable error.- パラメータ:
message- The error message- 戻り値:
- The new instance of
BusinessErrorwith the error typeInternalErrorType.UNRECOVERABLE - 例外:
NullPointerException- Ifnullis passed as an argument
-
nestedError
Returns the new instance ofBusinessErrorwith the nested error ofValidationResult.- パラメータ:
nestedError- The nested error ofValidationResult- 戻り値:
- The new instance of
BusinessErrorwith the nested error ofValidationResult - 例外:
NullPointerException- Ifnullis passed as an argument
-
hasError
public boolean hasError()Tests for the presence of business error.- 戻り値:
trueif there is a business error, otherwisefalse
-
hasNestedError
public boolean hasNestedError()Tests for the presence of nested error.- 戻り値:
trueif there is a nested error, otherwisefalse
-
isRecoverable
public boolean isRecoverable()Tests if a business error is a recoverable error.- 戻り値:
trueif a business error is a recoverable error, otherwisefalse
-
isUnrecoverable
public boolean isUnrecoverable()Tests if a business error is an unrecoverable error.- 戻り値:
trueif a business error is an unrecoverable error, otherwisefalse
-
toString
-
equals
-
hashCode
public int hashCode() -
getMessage
The message -
getNestedError
The nested error
-