org.kohsuke.args4j.spi.FieldSetter Java Examples

The following examples show how to use org.kohsuke.args4j.spi.FieldSetter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CLI.java    From audiveris with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public int parseArguments (org.kohsuke.args4j.spi.Parameters params)
        throws CmdLineException
{
    String className = params.getParameter(0).trim();

    if (!className.isEmpty()) {
        try {
            Class runClass = Class.forName(className);
            FieldSetter fs = setter.asFieldSetter();
            fs.addValue(runClass);
        } catch (ClassNotFoundException ex) {
            throw new CmdLineException(owner, ex);
        }
    }

    return 1;
}
 
Example #2
Source File: AdditionalOptionsCmdLineParser.java    From buck with Apache License 2.0 5 votes vote down vote up
private void parsePluginBasedOption(
    ClassParser classParser, Object bean, Set<Class<?>> visited, Field f) {
  if (f.isAnnotationPresent(PluginBasedSubCommands.class)) {
    PluginBasedSubCommands optionAnnotation = f.getAnnotation(PluginBasedSubCommands.class);
    ImmutableList<Object> commands =
        pluginManager.getExtensions(optionAnnotation.factoryClass()).stream()
            .map(PluginBasedSubCommandFactory::createSubCommand)
            .collect(ImmutableList.toImmutableList());

    new FieldSetter(bean, f).addValue(commands);
    commands.forEach(cmd -> parseAnnotations(classParser, cmd, visited));
  }
}
 
Example #3
Source File: Closure_107_CommandLineRunner_t.java    From coming with MIT License 4 votes vote down vote up
@Override public FieldSetter asFieldSetter() {
  return proxy.asFieldSetter();
}
 
Example #4
Source File: Closure_107_CommandLineRunner_s.java    From coming with MIT License 4 votes vote down vote up
@Override public FieldSetter asFieldSetter() {
  return proxy.asFieldSetter();
}