クラス 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
- 関連項目:
- 直列化された形式
-
メソッドの概要
修飾子とタイプ メソッド 説明 boolean
equals(Object o)
String
getMessage()
The messageValidationResult
getNestedError()
The nested errorboolean
hasError()
Tests for the presence of business error.int
hashCode()
boolean
hasNestedError()
Tests for the presence of nested error.boolean
isRecoverable()
Tests if a business error is a recoverable error.boolean
isUnrecoverable()
Tests if a business error is an unrecoverable error.static BusinessError
nestedError(@NonNull ValidationResult nestedError)
Returns the new instance ofBusinessError
with the nested error ofValidationResult
.static BusinessError
none()
Returns the new instance ofBusinessError
with the error typeInternalErrorType.NONE
.static BusinessError
recoverable(@NonNull String message)
Returns the new instance ofBusinessError
with the error typeInternalErrorType.RECOVERABLE
.String
toString()
static BusinessError
unrecoverable(@NonNull String message)
Returns the new instance ofBusinessError
with the error typeInternalErrorType.UNRECOVERABLE
.
-
メソッドの詳細
-
none
Returns the new instance ofBusinessError
with the error typeInternalErrorType.NONE
. The instance ofBusinessError
created bynone()
indicates that there is no error.- 戻り値:
- The new instance of
BusinessError
with the error typeInternalErrorType.NONE
-
recoverable
Returns the new instance ofBusinessError
with the error typeInternalErrorType.RECOVERABLE
. The instance ofBusinessError
created 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
BusinessError
with the error typeInternalErrorType.RECOVERABLE
- 例外:
NullPointerException
- Ifnull
is passed as an argument
-
unrecoverable
Returns the new instance ofBusinessError
with the error typeInternalErrorType.UNRECOVERABLE
. The instance ofBusinessError
created 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
BusinessError
with the error typeInternalErrorType.UNRECOVERABLE
- 例外:
NullPointerException
- Ifnull
is passed as an argument
-
nestedError
Returns the new instance ofBusinessError
with the nested error ofValidationResult
.- パラメータ:
nestedError
- The nested error ofValidationResult
- 戻り値:
- The new instance of
BusinessError
with the nested error ofValidationResult
- 例外:
NullPointerException
- Ifnull
is passed as an argument
-
hasError
public boolean hasError()Tests for the presence of business error.- 戻り値:
true
if there is a business error, otherwisefalse
-
hasNestedError
public boolean hasNestedError()Tests for the presence of nested error.- 戻り値:
true
if there is a nested error, otherwisefalse
-
isRecoverable
public boolean isRecoverable()Tests if a business error is a recoverable error.- 戻り値:
true
if a business error is a recoverable error, otherwisefalse
-
isUnrecoverable
public boolean isUnrecoverable()Tests if a business error is an unrecoverable error.- 戻り値:
true
if a business error is an unrecoverable error, otherwisefalse
-
toString
-
equals
-
hashCode
public int hashCode() -
getMessage
The message -
getNestedError
The nested error
-