This repository has been archived on 2021-12-05. You can view files and clone it, but cannot push or open issues or pull requests.
envoy/client/src/main/java/envoy/client/data/commands/SystemCommand.java

52 lines
1.4 KiB
Java
Raw Normal View History

package envoy.client.data.commands;
import java.util.function.Function;
/**
* This class is the base class of all {@code SystemCommands} and contains an
* action and a command that needs to be inputted to execute the given action.
* No {@code SystemCommand} can return anything.
* <p>
* Project: <strong>envoy-client</strong><br>
* File: <strong>SystemCommand.java</strong><br>
* Created: <strong>16.07.2020</strong><br>
*
* @author Leon Hofmeister
* @param <T> the type of argument needed
* @since Envoy Client v0.1-beta
*/
public abstract class SystemCommand<T> {
/**
* This variable stores the command that should be inputted to execute the given
* action
*/
protected final String command;
protected final Function<T, Void> action;
/**
* Constructs a new {@code NoArgSystemCommand} that takes no arguments.
*
* @param command the string that must be inputted to execute the given action
* @param action the action that should be performed
* @since Envoy Client v0.1-beta
*/
public SystemCommand(String command, Function<T, Void> action) {
this.command = command;
this.action = action;
}
/**
* @return the command that must be inputted to execute the given action
* @since Envoy Client v0.1-beta
*/
public String getCommand() { return command; }
/**
* @return the action that should be performed
* @since Envoy Client v0.1-beta
*/
public Function<T, Void> getAction() { return action; }
}