Interface CommandContext.Builder

    • Method Detail

      • addFlagInvocation

        void addFlagInvocation​(Flag flag)
        Adds a flag invocation to the context.
        Parameters:
        flag - The flag to add the invocation for.
      • putEntry

        default <T> void putEntry​(Parameter.Value<? super T> parameter,
                                  T value)
        Adds a parsed object into the context, for use by commands.
        Type Parameters:
        T - The type of parameter key
        Parameters:
        parameter - The key to store the entry under.
        value - The collection of objects to store.
      • putEntries

        default <T> void putEntries​(Parameter.Value<? super T> parameter,
                                    java.util.Collection<T> value)
        Adds a collection of parsed objects into the context, for use by commands.
        Type Parameters:
        T - The type of parameter key
        Parameters:
        parameter - The key to store the entry under.
        value - The collection of objects to store.
      • putEntries

        default <T> void putEntries​(Parameter.Key<? super T> parameter,
                                    java.util.Collection<T> value)
        Adds a collection of parsed objects into the context, for use by commands.
        Type Parameters:
        T - The type of parameter key
        Parameters:
        parameter - The key to store the entry under.
        value - The collection of objects to store.
      • putEntry

        <T> void putEntry​(Parameter.Key<T> key,
                          T object)
        Adds a parsed object into the context, for use by commands.
        Type Parameters:
        T - The type of parameter key
        Parameters:
        key - The key to store the entry under.
        object - The object to store.
      • startTransaction

        CommandContext.Builder.Transaction startTransaction()
        Starts a CommandContext.Builder.Transaction which allows for this builder to be returned to a previous state if necessary.

        Multiple transactions can be started on the same builder, however, they must be either committed or rolledback in reverse order (that is, the last transaction must be committed first)

        Transactions must not be held on to for longer than necessary.

        Returns:
        The state.
      • commit

        void commit​(CommandContext.Builder.Transaction transaction)
             throws java.lang.IllegalArgumentException
        Commits the specified CommandContext.Builder.Transaction if it was the most recently created transaction.
        Parameters:
        transaction - The transaction to commit.
        Throws:
        java.lang.IllegalArgumentException - Thrown if there are newer transactions to commit first, if this transaction is not active, or if this transaction is not part of this builder.
      • rollback

        void rollback​(CommandContext.Builder.Transaction transaction)
               throws java.lang.IllegalArgumentException
        Cancels the specified CommandContext.Builder.Transaction if it was the most recently created transaction.
        Parameters:
        transaction - The transaction to rollback.
        Throws:
        java.lang.IllegalArgumentException - Thrown if there are newer transactions to commit first, if this transaction is not active, or if this transaction is not part of this builder.