public void init(final String[] args) {
        try {
            map = ArgsUtil.parse(args);
            validArguments = new ArrayList<>();

            final BeanInfo beanInfo = Introspector.getBeanInfo(this.getClass());

            for (final PropertyDescriptor field : beanInfo.getPropertyDescriptors()) {
                if (field.getWriteMethod() != null) {
                    if (field.getName().length() > maxPropLength) {
                        maxPropLength = field.getName().length();
                    }
                    if (map.containsKey(field.getName())) {
                        validArguments.add(field.getName());
                        field.getWriteMethod().invoke(this, getAsType(field));
                    }
                }
            }

            checkArgs();
        } catch (final IntrospectionException | IllegalAccessException | InvocationTargetException e) {
            throw new RuntimeException(e.getMessage(), e);
        }
    }
Base class for command line tools that handles setting a load of args on the
program as name value pairs.
stroom-util/src/main/java/stroom/util/AbstractCommandLineTool.java