summaryrefslogtreecommitdiffstats
path: root/gerrit-sshd/src/main/java/com/google/gerrit/sshd/Commands.java
diff options
context:
space:
mode:
Diffstat (limited to 'gerrit-sshd/src/main/java/com/google/gerrit/sshd/Commands.java')
-rw-r--r--gerrit-sshd/src/main/java/com/google/gerrit/sshd/Commands.java27
1 files changed, 26 insertions, 1 deletions
diff --git a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/Commands.java b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/Commands.java
index 5340d6f340..929a895dfc 100644
--- a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/Commands.java
+++ b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/Commands.java
@@ -16,6 +16,7 @@ package com.google.gerrit.sshd;
import com.google.inject.Key;
+import org.apache.commons.lang.StringUtils;
import org.apache.sshd.server.Command;
import java.lang.annotation.Annotation;
@@ -41,6 +42,11 @@ public class Commands {
return Key.get(Command.class, named(parent, name));
}
+ public static Key<Command> key(final CommandName parent,
+ final String name, final String descr) {
+ return Key.get(Command.class, named(parent, name, descr));
+ }
+
/** Create a CommandName annotation for the supplied name. */
public static CommandName named(final String name) {
return new CommandName() {
@@ -78,6 +84,12 @@ public class Commands {
return new NestedCommandNameImpl(parent, name);
}
+ /** Create a CommandName annotation for the supplied name and description. */
+ public static CommandName named(final CommandName parent, final String name,
+ final String descr) {
+ return new NestedCommandNameImpl(parent, name, descr);
+ }
+
/** Return the name of this command, possibly including any parents. */
public static String nameOf(final CommandName name) {
if (name instanceof NestedCommandNameImpl) {
@@ -104,13 +116,22 @@ public class Commands {
return null;
}
- private static final class NestedCommandNameImpl implements CommandName {
+ static final class NestedCommandNameImpl implements CommandName {
private final CommandName parent;
private final String name;
+ private final String descr;
NestedCommandNameImpl(final CommandName parent, final String name) {
this.parent = parent;
this.name = name;
+ this.descr = StringUtils.EMPTY;
+ }
+
+ NestedCommandNameImpl(final CommandName parent, final String name,
+ final String descr) {
+ this.parent = parent;
+ this.name = name;
+ this.descr = descr;
}
@Override
@@ -118,6 +139,10 @@ public class Commands {
return name;
}
+ public String descr() {
+ return descr;
+ }
+
@Override
public Class<? extends Annotation> annotationType() {
return CommandName.class;