// Path: src/main/java/com/optimaize/command4j/Command.java
// public interface Command<A, R> {
// 
//     /**
//      * Runs the remote command.
//      *
//      * <p>This method always blocks until either the command finishes successfully, aborts by throwing an
//      * exception, or is cancelled early. (The {@link CommandExecutorService} allows you to execute
//      * commands in a non-blocking way.)</p>
//      *
//      * @param arg The {@link Optional} argument. If you need more than 1 argument then you may create a
//      *            request class as container, or maybe it's enough to just use {@link Tuples tuples}.
//      * @param ec
//      * @return Commands may return null, since null values are handled by the framework in that they're wrapped
//      *         into an {@link Optional}.
//      * @throws Exception
//      *
//      * TODO Eike: The return value is nullable and the framework makes an Optional out of it.
//      *            Why not the same for the argument? We could make the interface more consistent.
//      *            Is there a reason against that?
//      */
//     @Nullable
//     R call(@NotNull Optional<A> arg, @NotNull ExecutionContext ec) throws Exception;
// 
//     /**
//      * Like Java's Thread, a Command has a name.
//      *
//      * <p>Because toString() can become long with all the interceptors wrapping a base command, this
//      * keeps it simple to what it actually does.</p>
//      *
//      * <p>Certain kinds of combined commands, like a ComposedCommand or a ConditionCommand, don't have a single
//      * name, they show the names of the contained commands.</p>
//      *
//      * @return an identifier, not unique but usually distinguishable
//      */
//     String getName();
// }


import com.optimaize.command4j.Command;
import org.jetbrains.annotations.NotNull;
package com.optimaize.command4j.commands;


/**
 * Base class for interceptors.
 *
 * @author aa
 */
public abstract class BaseCommandInterceptor<A, R> extends BaseCommand<A, R> {

    @NotNull
    protected final Command<A, R> delegate;

// Path: src/main/java/com/optimaize/command4j/Command.java
// public interface Command<A, R> {
// 
//     /**
//      * Runs the remote command.
//      *
//      * <p>This method always blocks until either the command finishes successfully, aborts by throwing an
//      * exception, or is cancelled early. (The {@link CommandExecutorService} allows you to execute
//      * commands in a non-blocking way.)</p>
//      *
//      * @param arg The {@link Optional} argument. If you need more than 1 argument then you may create a
//      *            request class as container, or maybe it's enough to just use {@link Tuples tuples}.
//      * @param ec
//      * @return Commands may return null, since null values are handled by the framework in that they're wrapped
//      *         into an {@link Optional}.
//      * @throws Exception
//      *
//      * TODO Eike: The return value is nullable and the framework makes an Optional out of it.
//      *            Why not the same for the argument? We could make the interface more consistent.
//      *            Is there a reason against that?
//      */
//     @Nullable
//     R call(@NotNull Optional<A> arg, @NotNull ExecutionContext ec) throws Exception;
// 
//     /**
//      * Like Java's Thread, a Command has a name.
//      *
//      * <p>Because toString() can become long with all the interceptors wrapping a base command, this
//      * keeps it simple to what it actually does.</p>
//      *
//      * <p>Certain kinds of combined commands, like a ComposedCommand or a ConditionCommand, don't have a single
//      * name, they show the names of the contained commands.</p>
//      *
//      * @return an identifier, not unique but usually distinguishable
//      */
//     String getName();
// }


// Path: src/main/java/com/optimaize/command4j/commands/BaseCommandInterceptor.java
import com.optimaize.command4j.Command;
import org.jetbrains.annotations.NotNull;

package com.optimaize.command4j.commands;


/**
 * Base class for interceptors.
 *
 * @author aa
 */
public abstract class BaseCommandInterceptor<A, R> extends BaseCommand<A, R> {

    @NotNull
    protected final Command<A, R> delegate;

    protected BaseCommandInterceptor(@NotNull Command<A, R> delegate) {