diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-04-13 15:41:42 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-04-13 15:41:42 -0400 |
| commit | 9fdf37e3032defc8ea11fd59722b487163381422 (patch) | |
| tree | d3014f1bec5f0d476e0a77ff537ee26853ca148f /BJC-Utils2/src/main/java/bjc/utils/cli/GenericCommand.java | |
| parent | 70cea4b406f1cd592c59c4103c1b9b301d3b5907 (diff) | |
Implemented stream-based commands
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 | 43 |
1 files changed, 43 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 index 522dfbd..658a299 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/cli/GenericCommand.java +++ b/BJC-Utils2/src/main/java/bjc/utils/cli/GenericCommand.java @@ -7,6 +7,34 @@ package bjc.utils.cli; * */ public class GenericCommand implements ICommand { + private static class DelegatingCommand implements ICommand { + private ICommand delegate; + + public DelegatingCommand(ICommand delegate) { + this.delegate = delegate; + } + + @Override + public ICommandHandler getHandler() { + return delegate.getHandler(); + } + + @Override + public ICommandHelp getHelp() { + return delegate.getHelp(); + } + + @Override + public ICommand createAlias() { + return new DelegatingCommand(delegate); + } + + @Override + public boolean isAlias() { + return true; + } + } + private ICommandHandler handler; private ICommandHelp help; @@ -35,4 +63,19 @@ public class GenericCommand implements ICommand { public ICommandHelp getHelp() { return help; } + + @Override + public boolean isAlias() { + return false; + } + + /** + * Create a command that is an alias to this one + * + * @return A command that is an alias to this one + */ + @Override + public ICommand createAlias() { + return new DelegatingCommand(this); + } } |
