Class ParameterCompletableFuture<S extends Source,T>

All Implemented Interfaces:
ParameterType<S,CompletableFuture<T>>

public final class ParameterCompletableFuture<S extends Source,T> extends BaseParameterType<S,CompletableFuture<T>>
  • Constructor Details

  • Method Details

    • resolve

      @NotNull public @NotNull CompletableFuture<@Nullable T> resolve(@NotNull @NotNull ExecutionContext<S> context, @NotNull @NotNull CommandInputStream<S> inputStream, @NotNull @NotNull String input) throws ImperatException
      Description copied from interface: ParameterType
      Resolves the parameter value from the given input string, using the provided execution context and input stream.
      Parameters:
      context - the execution context.
      inputStream - the command input stream.
      input - the raw input string.
      Returns:
      the resolved value, or null if resolution fails.
      Throws:
      ImperatException - if resolution fails due to an error.
    • getSuggestionResolver

      public SuggestionResolver<S> getSuggestionResolver()
      Description copied from class: BaseParameterType
      Returns the suggestion resolver associated with this parameter type.
      Specified by:
      getSuggestionResolver in interface ParameterType<S extends Source,T>
      Overrides:
      getSuggestionResolver in class BaseParameterType<S extends Source,CompletableFuture<T>>
      Returns:
      the suggestion resolver for generating suggestions based on the parameter type.
    • matchesInput

      public boolean matchesInput(int rawPosition, Context<S> context, CommandParameter<S> parameter)
      Description copied from class: BaseParameterType
      Determines whether the provided input matches the expected format or criteria for a given command parameter. this is used during CommandTree.contextMatch(Context, ArgumentInput)
      Specified by:
      matchesInput in interface ParameterType<S extends Source,T>
      Overrides:
      matchesInput in class BaseParameterType<S extends Source,CompletableFuture<T>>
      Parameters:
      rawPosition - The raw position of the argument in the input.
      context - The context to be matched, providing necessary information about the command execution environment.
      parameter - The command parameter that provides context for the input handling.
      Returns:
      true if the input matches the expected criteria; false otherwise.
    • supplyDefaultValue

      public OptionalValueSupplier supplyDefaultValue()
      Description copied from interface: ParameterType
      Returns the default value supplier for the given source and command parameter. By default, this returns an empty supplier, indicating no default value.
      Returns:
      an OptionalValueSupplier providing the default value, or empty if none.
    • isGreedy

      public boolean isGreedy(CommandParameter<S> parameter)
      Description copied from interface: ParameterType
      Determines if this parameter type is greedy, meaning it consumes multiple arguments. By default, returns false.
      Parameters:
      parameter - the command parameter.
      Returns:
      true if greedy, false otherwise.