public ClientParameters parseCommandLineArguments(String[] args) throws IllegalArgumentException {
        try {
            CommandLineParser clp = new DefaultParser();
            CommandLine cl = clp.parse(options, args);

            boolean printIdsOnly = cl.hasOption(PRINTIDS_OPTION);
            String fieldSet = cl.getOptionValue(FIELDSET_OPTION, "");
            String cluster = cl.getOptionValue(CLUSTER_OPTION, "");
            String route = cl.getOptionValue(ROUTE_OPTION, "");
            String configId = cl.getOptionValue(CONFIGID_OPTION, "");
            boolean help = cl.hasOption(HELP_OPTION);
            boolean noRetry = cl.hasOption(NORETRY_OPTION);
            boolean showDocSize = cl.hasOption(SHOWDOCSIZE_OPTION);
            boolean jsonOutput = cl.hasOption(JSONOUTPUT_OPTION);
            boolean xmlOutput = cl.hasOption(XMLOUTPUT_OPTION);
            boolean shortTensors = cl.hasOption(SHORTTENSORS_OPTION);
            boolean directTensors = cl.hasOption(DIRECTTENSORS_OPTION);
            int trace = getTrace(cl);
            DocumentProtocol.Priority priority = getPriority(cl);
            double timeout = getTimeout(cl);
            Iterator<String> documentIds = getDocumentIds(cl);

            if (jsonOutput && xmlOutput) {
                throw new IllegalArgumentException("Cannot combine both xml and json output");
            }

            if (printIdsOnly && !fieldSet.isEmpty()) {
                throw new IllegalArgumentException("Field set option can not be used in combination with print ids option.");
            }

            if (printIdsOnly) {
                fieldSet = DocIdOnly.NAME;
            } else if (fieldSet.isEmpty()) { 
                fieldSet = DocumentOnly.NAME;
            }

            if (!cluster.isEmpty() && !route.isEmpty()) {
                throw new IllegalArgumentException("Cluster and route options are mutually exclusive.");
            }

            if (route.isEmpty() && cluster.isEmpty()) {
                route = "default-get";
            }

            if (trace < 0 || trace > 9) {
                throw new IllegalArgumentException("Invalid tracelevel: " + trace);
            }

            if (configId.isEmpty()) {
                configId = "client";
            }

            ClientParameters.Builder paramsBuilder = new ClientParameters.Builder();
            return paramsBuilder
                    .setDocumentIds(documentIds)
                    .setConfigId(configId)
                    .setFieldSet(fieldSet)
                    .setHelp(help)
                    .setPrintIdsOnly(printIdsOnly)
                    .setNoRetry(noRetry)
                    .setCluster(cluster)
                    .setRoute(route)
                    .setShowDocSize(showDocSize)
                    .setTraceLevel(trace)
                    .setPriority(priority)
                    .setTimeout(timeout)
                    .setJsonOutput(!xmlOutput)
                    .setTensorShortForm(shortTensors)
                    .setTensorDirectValues(directTensors)
                    .build();
        } catch (ParseException pe) {
            throw new IllegalArgumentException(pe.getMessage());
        }
    }
This class is responsible for parsing the command line arguments and print the help page.

@author bjorncs
vespaclient-java/src/main/java/com/yahoo/vespaget/CommandLineOptions.java