Examples of addParser()


Examples of com.google.api.client.http.HttpRequest.addParser()

    JsonObjectParser parser = getJsonObjectParser();

    if (parser != null) {
      httpRequest.setParser(parser);
    } else {
      httpRequest.addParser(getJsonHttpParser());
    }
    if (getApplicationName() != null) {
      httpRequest.getHeaders().setUserAgent(getApplicationName());
    }
    if (body != null) {
View Full Code Here

Examples of com.google.api.client.http.HttpTransport.addParser()

  public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    loadMovieData();

    // Set up Json parser and authentication before making Prediction API calls
    HttpTransport transport = GoogleTransport.create();
    transport.addParser(new JsonCParser());
    authenticateWithClientLogin(transport);

    final Float[] predictedRatings = new Float[numMovies];
    for (int i = 0; i < numMovies; i++) {
      /*
 
View Full Code Here

Examples of com.google.api.client.http.HttpTransport.addParser()

        transport.defaultHeaders = headers;
      
        //JsonCParser parser = new JsonCParser();
        JsonHttpParser parser = new JsonHttpParser();
        parser.jsonFactory = new JacksonFactory();
        transport.addParser(parser);

        // build the HTTP POST request and URL
        HttpRequest request = transport.buildPostRequest();
        request.setUrl(GOOGL_URL);
        GenericData data = new GenericData();
View Full Code Here

Examples of com.google.api.client.http.javanet.NetHttpTransport.addParser()

        transport.defaultHeaders = headers;
      
        //JsonCParser parser = new JsonCParser();
        JsonHttpParser parser = new JsonHttpParser();
        parser.jsonFactory = new JacksonFactory();
        transport.addParser(parser);

        // build the HTTP POST request and URL
        HttpRequest request = transport.buildPostRequest();
        request.setUrl(GOOGL_URL);
        GenericData data = new GenericData();
View Full Code Here

Examples of net.sourceforge.argparse4j.inf.Subparsers.addParser()

        ap.addArgument("-f");
        ap.addArgument("--baz").nargs(2);
        ap.addArgument("x");
        ap.addArgument("y").nargs(2);
        Subparsers subparsers = ap.addSubparsers();
        Subparser subparser = subparsers.addParser("add");
        subparser.addArgument("--foo");
        subparser.addArgument("--bar").action(Arguments.storeTrue());

        Namespace res = ap.parseArgs("-f foo @target/test-classes/args.txt --baz alpha @target/test-classes/args2.txt x y1 @target/test-classes/args3.txt add --bar @target/test-classes/args4.txt".split(" "));
        assertEquals("bar", res.getString("f"));
View Full Code Here

Examples of net.sourceforge.argparse4j.inf.Subparsers.addParser()

    @Test
    public void testParseArgsWithSubparsers() throws ArgumentParserException {
        ap.addArgument("-f");
        Subparsers subparsers = ap.addSubparsers();
        Subparser parserA = subparsers.addParser("install");
        parserA.addArgument("pkg1");
        parserA.setDefault("func", "install");
        Subparser parserB = subparsers.addParser("search");
        parserB.addArgument("pkg2");
        parserB.setDefault("func", "search");
View Full Code Here

Examples of net.sourceforge.argparse4j.inf.Subparsers.addParser()

        ap.addArgument("-f");
        Subparsers subparsers = ap.addSubparsers();
        Subparser parserA = subparsers.addParser("install");
        parserA.addArgument("pkg1");
        parserA.setDefault("func", "install");
        Subparser parserB = subparsers.addParser("search");
        parserB.addArgument("pkg2");
        parserB.setDefault("func", "search");
        Namespace res = ap.parseArgs("install aria2".split(" "));
        assertEquals("aria2", res.get("pkg1"));
        assertEquals("install", res.get("func"));
View Full Code Here

Examples of net.sourceforge.argparse4j.inf.Subparsers.addParser()

    }

    @Test
    public void testParseArgsWithSubparsersAlias() throws ArgumentParserException {
        Subparsers subparsers = ap.addSubparsers();
        Subparser checkout = subparsers.addParser("checkout").aliases("co");
        checkout.setDefault("func", "checkout");
        Namespace res = ap.parseArgs("co".split(" "));
        assertEquals("checkout", res.get("func"));
    }
View Full Code Here

Examples of net.sourceforge.argparse4j.inf.Subparsers.addParser()

    @Test
    public void testParseArgsWithSubparsersAmbiguousCommand() throws ArgumentParserException {
        Namespace res;
        Subparsers subparsers = ap.addSubparsers();
        Subparser checkout = subparsers.addParser("clone")
                .setDefault("func", "clone");
        Subparser clean = subparsers.addParser("clean")
                .setDefault("func", "clean");

        res = ap.parseArgs("clo".split(" "));
View Full Code Here

Examples of net.sourceforge.argparse4j.inf.Subparsers.addParser()

    public void testParseArgsWithSubparsersAmbiguousCommand() throws ArgumentParserException {
        Namespace res;
        Subparsers subparsers = ap.addSubparsers();
        Subparser checkout = subparsers.addParser("clone")
                .setDefault("func", "clone");
        Subparser clean = subparsers.addParser("clean")
                .setDefault("func", "clean");

        res = ap.parseArgs("clo".split(" "));
        assertEquals("clone", res.get("func"));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.