Class Results
java.lang.Object
dev.sympho.modular_commands.api.command.result.Results
Utilities for generating results from handlers.
- Since:
- 1.0
- Version:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CommandFailureResult indicating the command failed with no further context.static final CommandSuccessResult indicating the command executed successfully with no further context. -
Method Summary
Modifier and TypeMethodDescriptionstatic CommandErrorGenerates a result indicating the command encountered an error.static Mono<CommandResult>Generates a result indicating the command encountered an error.static CommandResultAlias forerror(String)that casts to a plain Result to avoid Generics issues.static CommandErrorExceptionGenerates a result indicating the command encountered an error due to an exception.static Mono<CommandResult>exceptionMono(Throwable cause) Generates a result indicating the command encountered an error due to an exception.static CommandResultexceptionR(Throwable cause) Alias forexception(Throwable)that casts to a plain Result to avoid Generics issues.static CommandFailurefail()Generates a result indicating the command failed with no further context.static Mono<CommandResult>failMono()Generates a result indicating the command failed with no further context.static CommandResultfailR()Alias forfail()that casts to a plain Result to avoid Generics issues.static CommandFailureMessageGenerates a result indicating the command failed with a message to the user.static Mono<CommandResult>failureMono(String message) Generates a result indicating the command failed with a message to the user.static CommandResultAlias forfailure(String)that casts to a plain Result to avoid Generics issues.static CommandSuccessok()Generates a result indicating the command executed successfully with no further context.static Mono<CommandResult>okMono()Generates a result indicating the command executed successfully with no further context.static CommandResultokR()Alias forok()that casts to a plain Result to avoid Generics issues.static CommandSuccessMessageGenerates a result indicating the command executed successfully with a message to the user.static Mono<CommandResult>successMono(String message) Generates a result indicating the command executed successfully with a message to the user.static CommandResultAlias forsuccess(String)that casts to a plain Result to avoid Generics issues.
-
Field Details
-
Method Details
-
ok
Generates a result indicating the command executed successfully with no further context.- Returns:
- The generated result.
-
okR
Alias forok()that casts to a plain Result to avoid Generics issues.- Returns:
- The result.
-
okMono
Generates a result indicating the command executed successfully with no further context.- Returns:
- A Mono that issues the generated result.
- See Also:
-
fail
Generates a result indicating the command failed with no further context.- Returns:
- The generated result.
-
failR
Alias forfail()that casts to a plain Result to avoid Generics issues.- Returns:
- The result.
-
failMono
Generates a result indicating the command failed with no further context.- Returns:
- A Mono that issues the generated result.
- See Also:
-
success
Generates a result indicating the command executed successfully with a message to the user.- Parameters:
message- The message to the user.- Returns:
- The generated result.
-
successR
Alias forsuccess(String)that casts to a plain Result to avoid Generics issues.- Parameters:
message- The message to the user.- Returns:
- The result.
-
successMono
Generates a result indicating the command executed successfully with a message to the user.- Parameters:
message- The message to the user.- Returns:
- A Mono that issues the generated result.
- See Also:
-
failure
Generates a result indicating the command failed with a message to the user.- Parameters:
message- The message to the user.- Returns:
- The generated result.
-
failureR
Alias forfailure(String)that casts to a plain Result to avoid Generics issues.- Parameters:
message- The message to the user.- Returns:
- The result.
-
failureMono
Generates a result indicating the command failed with a message to the user.- Parameters:
message- The message to the user.- Returns:
- A Mono that issues the generated result.
- See Also:
-
error
Generates a result indicating the command encountered an error.- Parameters:
message- The error message.- Returns:
- The generated result.
-
errorR
Alias forerror(String)that casts to a plain Result to avoid Generics issues.- Parameters:
message- The message to the user.- Returns:
- The result.
-
errorMono
Generates a result indicating the command encountered an error.- Parameters:
message- The error message.- Returns:
- A Mono that issues the generated result.
- See Also:
-
exception
Generates a result indicating the command encountered an error due to an exception.- Parameters:
cause- The exception that caused the error.- Returns:
- The generated result.
- API Note:
- Exceptions thrown by a command handler are automatically wrapped into an error result. As such, allowing the exception to propagate up is preferrable to explicitly generating the error.
-
exceptionR
Alias forexception(Throwable)that casts to a plain Result to avoid Generics issues.- Parameters:
cause- The exception that caused the error.- Returns:
- The result.
-
exceptionMono
Generates a result indicating the command encountered an error due to an exception.- Parameters:
cause- The exception that caused the error.- Returns:
- A Mono that issues the generated result.
- See Also:
-