Class ContextFactory<S extends Source>

java.lang.Object
studio.mevera.imperat.context.internal.ContextFactory<S>
Type Parameters:
S -

@AvailableSince("1.0.0") public abstract class ContextFactory<S extends Source> extends Object
Represents a way for defining how the context is created
  • Constructor Details

    • ContextFactory

      protected ContextFactory()
  • Method Details

    • defaultFactory

      public static <S extends Source> ContextFactory<S> defaultFactory()
    • createContext

      @NotNull public abstract @NotNull Context<S> createContext(@NotNull @NotNull Imperat<S> imperat, @NotNull S source, Command<S> command, @NotNull @NotNull String label, @NotNull @NotNull ArgumentInput queue)
      Parameters:
      source - the sender/source of this command execution
      command - the command label used
      queue - the args input
      Returns:
      new context from the command and args used by Source
    • createSuggestionContext

      public abstract SuggestionContext<S> createSuggestionContext(@NotNull @NotNull Imperat<S> imperat, @NotNull S source, @NotNull @NotNull Command<S> command, @NotNull @NotNull String label, @NotNull @NotNull ArgumentInput queue)
      Parameters:
      source - the source
      command - the command
      queue - the argument input
      Returns:
      new context for auto completions with CompletionArg
    • createExecutionContext

      public abstract ExecutionContext<S> createExecutionContext(@NotNull @NotNull Context<S> plainContext, @NotNull @NotNull CommandPathSearch<S> dispatch)
      Parameters:
      plainContext - the context plain
      dispatch - the result of a search and dispatch for the proper CommandUsage
      Returns:
      the context after resolving args into values for later on parsing it into the execution