apps/src/main/java/com/sampullara/cli/PropertiesArgs.java
public static void parse(Object target, Properties arguments) {
        Class clazz;
        if (target instanceof Class) {
            clazz = (Class) target;
        } else {
            clazz = target.getClass();
        }
        for (Field field : clazz.getDeclaredFields()) {
            processField(target, field, arguments);
        }
        try {
            BeanInfo info = Introspector.getBeanInfo(clazz);
            for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
                processProperty(target, pd, arguments);
            }
        } catch (IntrospectionException e) {
            // If its not a JavaBean we ignore it
        }
    }
public static void parse(Object target, Properties arguments) {
        Class clazz;
        if (target instanceof Class) {
            clazz = (Class) target;
        } else {
            clazz = target.getClass();
        }
        for (Field field : clazz.getDeclaredFields()) {
            processField(target, field, arguments);
        }
        try {
            BeanInfo info = Introspector.getBeanInfo(clazz);
            for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
                processProperty(target, pd, arguments);
            }
        } catch (IntrospectionException e) {
            // If its not a JavaBean we ignore it
        }
    }
public static void parse ( Object target , Properties arguments ) { Class clazz ; if ( target instanceof Class ) { clazz = ( Class ) target ; } else { clazz = target . getClass ( ) ; } for ( Field field : clazz . getDeclaredFields ( ) ) { processField ( target , field , arguments ) ; } try { BeanInfo info = Introspector . getBeanInfo ( clazz ) ; for ( PropertyDescriptor pd : info . getPropertyDescriptors ( ) ) { processProperty ( target , pd , arguments ) ; } } catch ( IntrospectionException e ) { // If its not a JavaBean we ignore it } }
Parse properties instead of String arguments.  Any additional arguments need to be passed some other way.
This is often used in a second pass when the property filename is passed on the command line.  Because of
required properties you must be careful to set them all in the property file.

@param target    Either an instance or a class
@param arguments The properties that contain the arguments
Parse properties instead of String arguments . Any additional arguments need to be passed some other way . This is often used in a second pass when the property filename is passed on the command line . Because of required properties you must be careful to set them all in the property file .