[#699] added support for @Spec and @ParentCommand elements

This commit is contained in:
Remko Popma
2019-05-23 21:51:48 +09:00
parent 4316659bc0
commit 0d8f6f70d9
3 changed files with 12 additions and 0 deletions

View File

@@ -16,6 +16,7 @@
"allDeclaredMethods" : true,
"allPublicMethods" : true,
"fields" : [
{ "name" : "parent" },
{ "name" : "recursive" }
]
}

View File

@@ -5,6 +5,7 @@ import picocli.CommandLine.Command;
import picocli.CommandLine.Mixin;
import picocli.CommandLine.Model.ArgSpec;
import picocli.CommandLine.Model.CommandSpec;
import picocli.CommandLine.Model.IAnnotatedElement;
import picocli.CommandLine.Model.IGetter;
import picocli.CommandLine.Model.IScope;
import picocli.CommandLine.Model.ISetter;
@@ -148,6 +149,7 @@ public class ReflectionConfigGenerator {
int.class.getName(), int[].class.getName(), int[].class.getCanonicalName(),
long.class.getName(), long[].class.getName(), long[].class.getCanonicalName(),
short.class.getName(), short[].class.getName(), short[].class.getCanonicalName(),
CommandSpec.class.getName(),
Method.class.getName(),
Object.class.getName(),
String.class.getName(),
@@ -208,6 +210,14 @@ public class ReflectionConfigGenerator {
visitGetter(binding.getter());
visitSetter(binding.setter());
}
for (IAnnotatedElement specElement : spec.specElements()) {
visitGetter(specElement.getter());
visitSetter(specElement.setter());
}
for (IAnnotatedElement parentCommandElement : spec.parentCommandElements()) {
visitGetter(parentCommandElement.getter());
visitSetter(parentCommandElement.setter());
}
for (OptionSpec option : spec.options()) {
visitArgSpec(option);
}

View File

@@ -45,6 +45,7 @@
{ "name" : "file", "parameterTypes" : [] },
{ "name" : "minimum", "parameterTypes" : [] },
{ "name" : "otherFiles", "parameterTypes" : [] },
{ "name" : "spec", "parameterTypes" : [] },
{ "name" : "timeUnit", "parameterTypes" : [] }
]
}