public static String[] setOptions(Object target, String[] args) {
        ArrayList<String> rc = new ArrayList<String>();

        for (int i = 0; i < args.length; i++) {
            if (args[i] == null) {
                continue;
            }

            if (args[i].startsWith("--")) {

                // --options without a specified value are considered boolean
                // flags that are enabled.
                String value = "true";
                String name = args[i].substring(2);

                // if --option=value case
                int p = name.indexOf("=");
                if (p > 0) {
                    value = name.substring(p + 1);
                    name = name.substring(0, p);
                }

                // name not set, then it's an unrecognized option
                if (name.length() == 0) {
                    rc.add(args[i]);
                    continue;
                }

                String propName = convertOptionToPropertyName(name);
                if (!IntrospectionSupport.setProperty(target, propName, value)) {
                    rc.add(args[i]);
                    continue;
                }
            }

        }

        String r[] = new String[rc.size()];
        rc.toArray(r);
        return r;
    }