public NamedOptionDef(Option o) { super(o.usage(),o.metaVar(),o.required(),o.help(),o.hidden(),o.handler(),false); this.name = o.name(); this.aliases = createZeroSizedArrayIfNull(o.aliases()); this.depends = createZeroSizedArrayIfNull(o.depends()); this.forbids = createZeroSizedArrayIfNull(o.forbids()); }
public NamedOptionDef(Option o) { super(o.usage(),o.metaVar(),o.required(),o.help(),o.hidden(),o.handler(),false); this.name = o.name(); this.aliases = createZeroSizedArrayIfNull(o.aliases()); this.depends = createZeroSizedArrayIfNull(o.depends()); this.forbids = createZeroSizedArrayIfNull(o.forbids()); }
private static List<Getter<?>> parse(Object bean) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException { ArrayList<Getter<?>> options = new ArrayList<Getter<?>>(); // recursively process all the methods/fields. for (Class<?> c = bean.getClass(); c != null; c = c.getSuperclass()) { for (Field f : c.getDeclaredFields()) { Option o = f.getAnnotation(Option.class); if (o != null) { options.add(Getters.create(o.name(),f, bean)); if (o.handler() == ProxyOptionHandler.class) { Field opField = c.getDeclaredField(f.getName() + "Op"); Object opBean = null; try{ opBean = opField.get(bean); } catch (Exception e) { opField.setAccessible(true); opBean = opField.get(bean); } options.addAll(parse(opBean)); } } } } return options; } }
private static List<Getter<?>> parse(Object bean) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException { ArrayList<Getter<?>> options = new ArrayList<Getter<?>>(); // recursively process all the methods/fields. for (Class<?> c = bean.getClass(); c != null; c = c.getSuperclass()) { for (Field f : c.getDeclaredFields()) { Option o = f.getAnnotation(Option.class); if (o != null) { options.add(Getters.create(o.name(),f, bean)); if (o.handler() == ProxyOptionHandler.class) { Field opField = c.getDeclaredField(f.getName() + "Op"); Object opBean = null; try{ opBean = opField.get(bean); } catch (Exception e) { opField.setAccessible(true); opBean = opField.get(bean); } options.addAll(parse(opBean)); } } } } return options; } }
public NamedOptionDef(Option o) { super(o.usage(),o.metaVar(),o.required(),o.help(),o.hidden(),o.handler(),false); this.name = o.name(); this.aliases = createZeroSizedArrayIfNull(o.aliases()); this.depends = createZeroSizedArrayIfNull(o.depends()); this.forbids = createZeroSizedArrayIfNull(o.forbids()); }
public NamedOptionDef(Option o) { super(o.usage(),o.metaVar(),o.required(),o.help(),o.hidden(),o.handler(),false); this.name = o.name(); this.aliases = createZeroSizedArrayIfNull(o.aliases()); this.depends = createZeroSizedArrayIfNull(o.depends()); this.forbids = createZeroSizedArrayIfNull(o.forbids()); }