- All Implemented Interfaces:
Serializable,Result<Void>
Result of a request. The type signals if the execution was successful or not. In case the the result is not
ResultType.OK, the
fields code and message should contain unique information to help the user identifying the cause of the problem. A simple result does not
carry any additional data.- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedProtected default constructor for de-serialization.SimpleResult(@NotNull Exception exception) Constructor with exception.SimpleResult(@NotNull ResultType type, String code, String message) Constructor with all data. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanstatic SimpleResultCreate an error result.getData()Returns the result data.final inthashCode()static SimpleResultok()Create a success result.final StringtoString()static SimpleResultCreate a warning result.Methods inherited from class org.fuin.cqrs4j.AbstractResult
getCode, getMessage, getType
-
Constructor Details
-
SimpleResult
protected SimpleResult()Protected default constructor for de-serialization. -
SimpleResult
public SimpleResult(@NotNull @NotNull ResultType type, @Nullable String code, @Nullable String message) Constructor with all data.- Parameters:
type- Type.code- Code.message- Message.
-
SimpleResult
Constructor with exception. An exception of typeExceptionShortIdentifablewill be used to fill thecodefield with the identifier value. If it's not aExceptionShortIdentifablethecodefield will be set using the full qualified class name of the exception.- Parameters:
exception- The message for the result is equal to the exception message or the simple name of the exception class if the exception message isnull.
-
-
Method Details
-
getData
Description copied from interface:ResultReturns the result data.- Returns:
- Optional data.
-
hashCode
public final int hashCode() -
equals
-
toString
-
ok
Create a success result.- Returns:
- Result with type
ResultType.OK.
-
warning
Create a warning result.- Parameters:
code- Code.message- Message.- Returns:
- Result with type
ResultType.WARNING.
-
error
Create an error result.- Parameters:
code- Code.message- Message.- Returns:
- Result with type
ResultType.ERROR.
-