Class HelpQuery.Builder<S extends Source>

java.lang.Object
studio.mevera.imperat.command.tree.help.HelpQuery.Builder<S>
Type Parameters:
S - The type of Source.
Enclosing class:
HelpQuery<S extends Source>

public static class HelpQuery.Builder<S extends Source> extends Object
A builder class for creating instances of HelpQuery.

This class uses a fluent API to allow for easy and readable configuration of a help query with optional parameters.

  • Method Details

    • maxDepth

      public HelpQuery.Builder<S> maxDepth(int depth)
      Sets the maximum depth to traverse the command tree.
      Parameters:
      depth - The maximum depth.
      Returns:
      This builder instance.
    • limit

      public HelpQuery.Builder<S> limit(int limit)
      Sets the maximum number of help entries to return.
      Parameters:
      limit - The limit.
      Returns:
      This builder instance.
    • conditionalRootUsage

      public HelpQuery.Builder<S> conditionalRootUsage(Predicate<CommandUsage<S>> rootUsagePredicate)
      Sets the condition for including the root's MAINcommand usage.
      Parameters:
      rootUsagePredicate - the condition/predicate to include the root.
      Returns:
      This builder instance.
    • filter

      public HelpQuery.Builder<S> filter(@NotNull @NotNull HelpFilter<S> filter)
      Adds a filter to the queue of filters.
      Parameters:
      filter - The filter to add.
      Returns:
      This builder instance.
    • build

      @NotNull public @NotNull HelpQuery<S> build()
      Builds an immutable HelpQuery instance with the configured parameters.
      Returns:
      A new HelpQuery.