Package kboyle.oktane.core
Enum Class CommandUtils
- All Implemented Interfaces:
Serializable
,Comparable<CommandUtils>
,Constable
Utilities for commands.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Method Summary
Modifier and TypeMethodDescriptionstatic Stream<CommandModule>
flattenModule(CommandModule module)
Gets aCommandModule
and all its children.static reactor.core.publisher.Mono<PreconditionResult>
runParameterPreconditions(CommandContext context, Command command)
Runs thePrecondition
s for the parameters of the givenCommand
.static reactor.core.publisher.Mono<PreconditionResult>
runPreconditions(CommandContext context, Command command, com.google.common.collect.ImmutableList<Precondition> preconditions)
Runs the givenPrecondition
s.static CommandUtils
Returns the enum constant of this class with the specified name.static CommandUtils[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
runPreconditions
public static reactor.core.publisher.Mono<PreconditionResult> runPreconditions(CommandContext context, Command command, com.google.common.collect.ImmutableList<Precondition> preconditions)Runs the givenPrecondition
s.- Parameters:
context
- The context to pass toPrecondition.run(CommandContext, Command)
.command
- The command to pass toPrecondition.run(CommandContext, Command)
.preconditions
- ThePrecondition
to run.- Returns:
- The result of running all of the preconditions.
-
runParameterPreconditions
public static reactor.core.publisher.Mono<PreconditionResult> runParameterPreconditions(CommandContext context, Command command)Runs thePrecondition
s for the parameters of the givenCommand
.- Parameters:
context
- The context to pass toPrecondition.run(CommandContext, Command)
.command
- The command to pass toPrecondition.run(CommandContext, Command)
.- Returns:
- The result of running all of the preconditions.
-
flattenModule
Gets aCommandModule
and all its children.- Parameters:
module
- TheCommandModule
to get it and all its children from.- Returns:
- The given
CommandModule
and all its children.
-