diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-04-08 13:28:09 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-04-08 13:28:09 -0400 |
| commit | 275a627719fc2231b16caea41130ff09f0f2b6a1 (patch) | |
| tree | 757e8ca2061ba6ed9b2063f7155edbe954b72bdb /BJC-Utils2/src/main/java/bjc/utils/cli/GenericCommand.java | |
| parent | 79d3a4a47cbc1fcf17c77c6fc12ff826a3077bac (diff) | |
Switch functional data to use interfaces
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/cli/GenericCommand.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/cli/GenericCommand.java | 59 |
1 files changed, 59 insertions, 0 deletions
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; + } +} |
