private static Options createOptions() {
        Options options = new Options();

        options.addOption("h", "help", false, "Show this syntax page.");

        options.addOption(Option.builder("s")
                .longOpt("bindtoslobrok")
                .hasArg(true)
                .argName("address")
                .desc("Bind to the given slobrok address.")
                .build());

        options.addOption(Option.builder("t")
                .longOpt("bindtosocket")
                .hasArg(true)
                .argName("port")
                .desc("Bind to the given TCP port")
                .type(Number.class)
                .build());

        options.addOption(Option.builder("p")
                .longOpt("processtime")
                .hasArg(true)
                .argName("msecs")
                .desc("Sleep this amount of millisecs before processing message. (Debug option for pretending to be slow client).")
                .type(Number.class)
                .build());

        options.addOption(Option.builder("c")
                .longOpt("visithandler")
                .hasArg(true)
                .argName("classname")
                .desc("Use the given class as a visit handler (defaults to StdOutVisitorHandler)")
                .build());

        options.addOption(Option.builder("o")
                .longOpt("visitoptions")
                .hasArg(true)
                .argName("args")
                .desc("Option arguments to pass through to the visitor handler instance")
                .build());

        options.addOption("i", "printids", false, "Display only document identifiers.");
        options.addOption("v", "verbose", false, "Indent XML, show progress and info on STDERR.");

        return options;
    }
Example client using visiting

@author Einar M R Rosenvinge
vespaclient-java/src/main/java/com/yahoo/vespavisit/VdsVisitTarget.java