/*
 * Copyright 2017, TeamDev Ltd. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package org.spine3.server.command;

import org.spine3.Internal;
import org.spine3.base.CommandClass;
import org.spine3.base.CommandEnvelope;

import java.util.Set;

/**
 * A common interface for objects which need to dispatch the
 * {@linkplain org.spine3.base.Command commands}, but are unable to implement
 * the {@link org.spine3.server.command.CommandDispatcher CommandDispatcher} directly.
 *
 * @author Alex Tymchenko
 * @see DelegatingCommandDispatcher
 */
@Internal
public interface CommandDispatcherDelegate {

    Set<CommandClass> getCommandClasses();

    void dispatchCommand(CommandEnvelope envelope);
}

@@ -1330,16 +1330,21 @@
 e %7B@link
+plain
  org.spi
@@ -1402,17 +1402,1365 @@
 her%7D
- directly
+.%0A *%0A * %3Cp%3EA typical example of a %7B@code CommandDispatcherDelegate%7D usage is a routine, which%0A * simultaneously dispatches different types of %7B@linkplain com.google.protobuf.Message messages%7D%0A * in addition to %7B@code Command%7Ds.%0A *%0A * %3Cp%3EIn this case such a class would have to implement several%0A * %7B@linkplain org.spine3.server.bus.MessageDispatcher MessageDispatcher%7D child interfaces%0A * (such as %7B@linkplain org.spine3.server.command.CommandDispatcher CommandDispatcher%7D or%0A * %7B@linkplain org.spine3.server.event.EventDispatcher EventDispatcher%7D). However, it is impossible%0A * to implement the same %7B@link org.spine3.server.bus.MessageDispatcher#getMessageClasses()%0A * getMessageClasses()%7D method several times with the different types of %7B@code MessageClass%7Des%0A * returned.%0A *%0A * %3Cp%3EThe same interference takes place in attempt to implement%0A * %7B@link org.spine3.server.bus.MessageDispatcher#dispatch(org.spine3.base.MessageEnvelope)%0A * MessageDispatcher#dispatch(MessageEnvelope)%7D method with the different types of%0A * %7B@code MessageEnvelope%7Ds dispatches simultaneously.%0A *%0A * %3Cp%3EThat's why unlike %7B@linkplain org.spine3.server.bus.MessageDispatcher MessageDispatcher%7D,%0A * this interface defines its own contract for declaring the dispatched%0A * %7B@linkplain CommandClass command classes%7D, which does not interfere with the%0A * %7B@code MessageDispatcher%7D API
 .%0A *

Clarify the purpose of `CommandDispatcherDelegate`.