001/**
002 * Get more info at : www.jrebirth.org .
003 * Copyright JRebirth.org © 2011-2016
004 * Contact : sebastien.bordes@jrebirth.org
005 *
006 * Licensed under the Apache License, Version 2.0 (the "License");
007 * you may not use this file except in compliance with the License.
008 * You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.jrebirth.af.api.command;
019
020import org.jrebirth.af.api.component.behavior.BehavioredComponent;
021import org.jrebirth.af.api.wave.Wave;
022import org.jrebirth.af.api.wave.WaveBean;
023
024/**
025 * The interface <strong>Command</strong> is used to run atomic and reusable action.
026 *
027 * @author Sébastien Bordes
028 */
029public interface Command extends BehavioredComponent<Command> {
030
031    /**
032     * Run the command.
033     *
034     * @return the wave created to launch the command, it allows to track its internal process
035     */
036    Wave run();
037
038    /**
039     * Run the command into the configured thread.
040     *
041     * @param wave the wave that have triggered this command
042     *
043     * @return the wave created to launch the command, it allows to track its internal process
044     */
045    Wave run(final Wave wave);
046
047    // /**
048    // * Link a parent command.
049    // *
050    // * @param parentCommand the parent command
051    // */
052    // void setParentCommand(final Command parentCommand);
053
054    /**
055     * Get the wave bean and cast it.
056     *
057     * @param wave the wave that hold the bean
058     *
059     * @return the casted wave bean
060     */
061    WaveBean waveBean(final Wave wave);
062
063}