From 275a627719fc2231b16caea41130ff09f0f2b6a1 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Fri, 8 Apr 2016 13:28:09 -0400 Subject: Switch functional data to use interfaces --- .../main/java/bjc/utils/cli/GenericCommand.java | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 BJC-Utils2/src/main/java/bjc/utils/cli/GenericCommand.java (limited to 'BJC-Utils2/src/main/java/bjc/utils/cli/GenericCommand.java') diff --git a/BJC-Utils2/src/main/java/bjc/utils/cli/GenericCommand.java b/BJC-Utils2/src/main/java/bjc/utils/cli/GenericCommand.java new file mode 100644 index 0000000..99951cc --- /dev/null +++ b/BJC-Utils2/src/main/java/bjc/utils/cli/GenericCommand.java @@ -0,0 +1,59 @@ +package bjc.utils.cli; + +/** + * Generic command implementation + * + * @author ben + * + */ +public class GenericCommand implements ICommand { + private static class GenericHelp implements ICommandHelp { + private String summary; + private String description; + + public GenericHelp(String summary, String description) { + this.summary = summary; + this.description = description; + } + + @Override + public String getSummary() { + return summary; + } + + @Override + public String getDescription() { + return description; + } + + } + + private ICommandHandler handler; + private ICommandHelp help; + + /** + * Create a new generic command + * + * @param handler + * The handler to use for the command + * @param description + * The description of the command + * @param help + * The detailed help message for the command + */ + public GenericCommand(ICommandHandler handler, String description, + String help) { + this.handler = handler; + this.help = new GenericHelp(description, help); + } + + @Override + public ICommandHandler getHandler() { + return handler; + } + + @Override + public ICommandHelp getHelp() { + return help; + } +} -- cgit v1.2.3