summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/cli/GenericCommand.java
diff options
context:
space:
mode:
authorbjculkin <bjculkin@mix.wvu.edu>2017-03-17 08:52:13 -0400
committerbjculkin <bjculkin@mix.wvu.edu>2017-03-17 08:52:13 -0400
commit7f59d0b9de4536705b3122cb5a85d9c9f85846a3 (patch)
tree8aeed52ab4a18385f63dae2f51c792b88da669bb /BJC-Utils2/src/main/java/bjc/utils/cli/GenericCommand.java
parent9d89261fedf23c11b684eb66cefdd86a9378ad20 (diff)
Add toString/equals/hashCode/compareTo part 1
Adds utility methods to classes that need them. This covers the cli & component packages.
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.java33
1 files changed, 27 insertions, 6 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 a365135..ea10108 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/cli/GenericCommand.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/cli/GenericCommand.java
@@ -8,12 +8,12 @@ package bjc.utils.cli;
*/
public class GenericCommand implements ICommand {
/*
- * The behavior for invoking the command.
+ * The behavior for invoking the command.
*/
private ICommandHandler handler;
/*
- * The help for the command.
+ * The help for the command.
*/
private ICommandHelp help;
@@ -23,11 +23,12 @@ public class GenericCommand implements ICommand {
* @param handler
* The handler to use for the command.
* @param description
- * The description of the command. May be null, in which case a default is
- * provided.
+ * The description of the command. May be null, in which
+ * case a default is provided.
* @param help
- * The detailed help message for the command. May be null, in which case the
- * description is repeated for the detailed help.
+ * The detailed help message for the command. May be
+ * null, in which case the description is repeated for
+ * the detailed help.
*/
public GenericCommand(ICommandHandler handler, String description, String help) {
if(handler == null) throw new NullPointerException("Command handler must not be null");
@@ -60,4 +61,24 @@ public class GenericCommand implements ICommand {
public boolean isAlias() {
return false;
}
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("GenericCommand [");
+
+ if(help != null) {
+ builder.append("help=");
+ builder.append(help);
+ }
+
+ builder.append("]");
+
+ return builder.toString();
+ }
}