Package org.incendo.cloud.component
Interface DefaultValue<C,T>
- Type Parameters:
C- command sender typeT- type of the owning argument
- All Known Implementing Classes:
DefaultValue.ConstantDefaultValue,DefaultValue.DynamicDefaultValue,DefaultValue.ParsedDefaultValue
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Default value used when an optional argument is omitted by the command sender.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classstatic interfacestatic final classstatic final class -
Method Summary
Modifier and TypeMethodDescriptionstatic <C,T> @NonNull DefaultValue <C, T> Returns a constant default value.static <C,T> @NonNull DefaultValue <C, T> dynamic(@NonNull DefaultValue.DefaultValueProvider<C, T> expression) Returns a default value that will be evaluated when the command is evaluated.evaluateDefault(@NonNull CommandContext<C> context) Evaluates the default value for the givencontext.static <C,T> @NonNull DefaultValue <C, T> failableDynamic(@NonNull DefaultValue<C, T> expression) Returns a default value that will be evaluated when the command is evaluated.static <C,T> @NonNull DefaultValue <C, T> Returns a default value that will be parsed together with the command.
-
Method Details
-
constant
Returns a constant default value. The argument parser will be bypassed when using a constant default value.- Type Parameters:
C- the command sender typeT- the argument type- Parameters:
value- the default value- Returns:
- the default value instance
-
dynamic
static <C,T> @NonNull DefaultValue<C,T> dynamic(@NonNull DefaultValue.DefaultValueProvider<C, T> expression) Returns a default value that will be evaluated when the command is evaluated. The argument parser will be bypassed when using a dynamic default value.- Type Parameters:
C- the command sender typeT- the argument type- Parameters:
expression- the expression producing the default value- Returns:
- the default value instance
-
failableDynamic
Returns a default value that will be evaluated when the command is evaluated. The argument parser will be bypassed when using a dynamic default value.- Type Parameters:
C- the command sender typeT- the argument type- Parameters:
expression- the expression producing the default value- Returns:
- the default value instance
-
parsed
Returns a default value that will be parsed together with the command.- Type Parameters:
C- the command sender typeT- the argument type- Parameters:
value- value that gets parsed by the argument parser when the command is being evaluated- Returns:
- the default value instance
-
evaluateDefault
Evaluates the default value for the givencontext.- Parameters:
context- the context- Returns:
- the default value
-