Option option = p.annotation(Option.class); if (option!=null) { parser.addOption(setter,option);
public void parse(CmdLineParser parser, Object bean) throws ClassNotFoundException { for(Class c=bean.getClass(); c!=null; c=c.getSuperclass()) { System.out.println("Class: " + c); for( Field f : c.getDeclaredFields() ) { Option o = new OptionImpl(createConfigElement(f)); parser.addOption(Setters.create(f, bean), o ); } } }
public void parse(CmdLineParser parser, Object bean) throws ClassNotFoundException { for(Class c=bean.getClass(); c!=null; c=c.getSuperclass()) { System.out.println("Class: " + c); for( Field f : c.getDeclaredFields() ) { Option o = new OptionImpl(createConfigElement(f)); parser.addOption(Setters.create(f, bean), o ); } } }
public void parse(Object bean, CmdLineParser parser) { // recursively process all the methods/fields. for( Class c=bean.getClass(); c!=null; c=c.getSuperclass()) { for( Method m : c.getDeclaredMethods() ) { Option o = m.getAnnotation(Option.class); if(o!=null) { parser.addOption(new MethodSetter(parser,bean,m), o); } Argument a = m.getAnnotation(Argument.class); if(a!=null) { parser.addArgument(new MethodSetter(parser,bean,m), a); } } for( Field f : c.getDeclaredFields() ) { Option o = f.getAnnotation(Option.class); if(o!=null) { parser.addOption(Setters.create(f,bean),o); } Argument a = f.getAnnotation(Argument.class); if(a!=null) { parser.addArgument(Setters.create(f,bean), a); } } } } }
public void parse(Object bean, CmdLineParser parser) { // recursively process all the methods/fields. for( Class c=bean.getClass(); c!=null; c=c.getSuperclass()) { for( Method m : c.getDeclaredMethods() ) { Option o = m.getAnnotation(Option.class); if(o!=null) { parser.addOption(new MethodSetter(parser,bean,m), o); } Argument a = m.getAnnotation(Argument.class); if(a!=null) { parser.addArgument(new MethodSetter(parser,bean,m), a); } } for( Field f : c.getDeclaredFields() ) { Option o = f.getAnnotation(Option.class); if(o!=null) { parser.addOption(Setters.create(f,bean),o); } Argument a = f.getAnnotation(Argument.class); if(a!=null) { parser.addArgument(Setters.create(f,bean), a); } } } } }
public void parse(InputSource xml, CmdLineParser parser, Object bean) { try { Config config = Config.parse(xml); for(ConfigElement ce : config.options) { Option option = new OptionImpl(ce); parser.addOption(Setters.create(parser, findMethodOrField(bean, ce.field, ce.method),bean), option); } for (ConfigElement ce : config.arguments) { Argument argument = new ArgumentImpl(ce); parser.addArgument(Setters.create(parser, findMethodOrField(bean, ce.field, ce.method),bean), argument); } } catch (Exception e) { throw new RuntimeException(Messages.METADATA_ERROR.format(), e); } }
public void parse(InputSource xml, CmdLineParser parser, Object bean) { try { Config config = Config.parse(xml); for(ConfigElement ce : config.options) { Option option = new OptionImpl(ce); parser.addOption(Setters.create(parser, findMethodOrField(bean, ce.field, ce.method),bean), option); } for (ConfigElement ce : config.arguments) { Argument argument = new ArgumentImpl(ce); parser.addArgument(Setters.create(parser, findMethodOrField(bean, ce.field, ce.method),bean), argument); } } catch (Exception e) { throw new RuntimeException(Messages.METADATA_ERROR.format(), e); } }
public void parse(CmdLineParser parser, Object bean) throws ClassNotFoundException { for(Class c=bean.getClass(); c!=null; c=c.getSuperclass()) { System.out.println("Class: " + c); for( Field f : c.getDeclaredFields() ) { Option o = new OptionImpl(createConfigElement(f)); parser.addOption(Setters.create(f, bean), o ); } } }
public void parse(Object bean, CmdLineParser parser) { // recursively process all the methods/fields. for( Class c=bean.getClass(); c!=null; c=c.getSuperclass()) { for( Method m : c.getDeclaredMethods() ) { Option o = m.getAnnotation(Option.class); if(o!=null) { parser.addOption(new MethodSetter(parser,bean,m), o); } Argument a = m.getAnnotation(Argument.class); if(a!=null) { parser.addArgument(new MethodSetter(parser,bean,m), a); } } for( Field f : c.getDeclaredFields() ) { Option o = f.getAnnotation(Option.class); if(o!=null) { parser.addOption(Setters.create(f,bean),o); } Argument a = f.getAnnotation(Argument.class); if(a!=null) { parser.addArgument(Setters.create(f,bean), a); } } } } }
public void parse(Object bean, CmdLineParser parser) { // recursively process all the methods/fields. for( Class c=bean.getClass(); c!=null; c=c.getSuperclass()) { for( Method m : c.getDeclaredMethods() ) { Option o = m.getAnnotation(Option.class); if(o!=null) { parser.addOption(new MethodSetter(parser,bean,m), o); } Argument a = m.getAnnotation(Argument.class); if(a!=null) { parser.addArgument(new MethodSetter(parser,bean,m), a); } } for( Field f : c.getDeclaredFields() ) { Option o = f.getAnnotation(Option.class); if(o!=null) { parser.addOption(Setters.create(f,bean),o); } Argument a = f.getAnnotation(Argument.class); if(a!=null) { parser.addArgument(Setters.create(f,bean), a); } } } } }
commandLineOptions.forEach(option -> cmdLineParser.addOption(new Args4jSetter(option, setAction, false), new Args4jOption(option, this, option.type().targetType())));
private void addOptions(Object bean, CmdLineParser parser) { // recursively process all the methods/fields. for (Class<?> c=bean.getClass(); c!=null; c=c.getSuperclass()) { for (Method m : c.getDeclaredMethods()) { Option o = m.getAnnotation(Option.class); if(o!=null) { parser.addOption(new SetterWrapper(new MethodSetter(parser,bean,m)), o); } Argument a = m.getAnnotation(Argument.class); if(a!=null) { parser.addArgument(new SetterWrapper(new MethodSetter(parser,bean,m)), a); } } for( Field f : c.getDeclaredFields() ) { Option o = f.getAnnotation(Option.class); if(o!=null) { parser.addOption(new SetterWrapper(Setters.create(f,bean)),o); } Argument a = f.getAnnotation(Argument.class); if(a!=null) { parser.addArgument(new SetterWrapper(Setters.create(f,bean)), a); } } } }
private void addOptions(Object bean, CmdLineParser parser) { // recursively process all the methods/fields. for (Class<?> c=bean.getClass(); c!=null; c=c.getSuperclass()) { for (Method m : c.getDeclaredMethods()) { Option o = m.getAnnotation(Option.class); if(o!=null) { parser.addOption(new SetterWrapper(new MethodSetter(parser,bean,m)), o); } Argument a = m.getAnnotation(Argument.class); if(a!=null) { parser.addArgument(new SetterWrapper(new MethodSetter(parser,bean,m)), a); } } for( Field f : c.getDeclaredFields() ) { Option o = f.getAnnotation(Option.class); if(o!=null) { parser.addOption(new SetterWrapper(Setters.create(f,bean)),o); } Argument a = f.getAnnotation(Argument.class); if(a!=null) { parser.addArgument(new SetterWrapper(Setters.create(f,bean)), a); } } } }
public void parse(InputSource xml, CmdLineParser parser, Object bean) { try { Config config = Config.parse(xml); for(ConfigElement ce : config.options) { Option option = new OptionImpl(ce); parser.addOption(Setters.create(parser, findMethodOrField(bean, ce.field, ce.method),bean), option); } for (ConfigElement ce : config.arguments) { Argument argument = new ArgumentImpl(ce); parser.addArgument(Setters.create(parser, findMethodOrField(bean, ce.field, ce.method),bean), argument); } } catch (Exception e) { throw new RuntimeException(Messages.METADATA_ERROR.format(), e); } }
Option option = p.annotation(Option.class); if (option!=null) { parser.addOption(setter,option);
Option option = p.annotation(Option.class); if (option!=null) { parser.addOption(setter,option);
Option option = p.annotation(Option.class); if (option!=null) { parser.addOption(setter,option);
Option option = p.annotation(Option.class); if (option != null) { parser.addOption(setter, option);
Option option = p.annotation(Option.class); if (option!=null) { parser.addOption(setter,option);