Package com.kdubb.retrofitexamples.api

Examples of com.kdubb.retrofitexamples.api.SimpleApi


    RestAdapter restAdapter = new RestAdapter.Builder()
          .setServer(API_URL)
          .build();
 
      // Create an instance of our SimpleApi interface.
    SimpleApi simpleApi = restAdapter.create(SimpleApi.class);
 
    // Call each of the methods and output the results
    System.out.println("simpleApi.simpleGet()=<<" + simpleApi.simpleGet() + ">>");
    System.out.println("simpleApi.simplePost()=<<" + simpleApi.simplePost() + ">>");
    System.out.println("simpleApi.simpleDelete()=<<" + simpleApi.simpleDelete() + ">>");
    System.out.println("simpleApi.simplePut()=<<" + simpleApi.simplePut() + ">>");
    System.out.println("simpleApi.simpleHead()=<<" + simpleApi.simpleHead() + ">>");
    System.out.println("simpleApi.simpleBoolean()=<<" + simpleApi.simpleBoolean() + ">>");
    System.out.println("simpleApi.simpleInteger()=<<" + simpleApi.simpleInteger() + ">>");
    System.out.println("simpleApi.simpleCollection()=<<" + simpleApi.simpleCollection() + ">>");
   
    try {
      ObjectMapper mapper = new ObjectMapper();
     
      // We want to take a peek to see if all the fields are set correctly
      CustomObject custom = simpleApi.simpleCustom();
      System.out.println("simpleApi.simpleCustom()=<<" + custom + ">>");
      System.out.println("simpleApi.simpleCustom() as JSON=<<" + mapper.writeValueAsString(custom) + ">>");
     
      CustomChild child = simpleApi.simpleChild();
      System.out.println("simpleApi.simpleChild()=<<" + child + ">>");
      System.out.println("simpleApi.simpleChild() as JSON=<<" + mapper.writeValueAsString(child) + ">>");
    }
    catch(IOException e) {
      LOG.error("Failed to convert objects to JSON", e);
View Full Code Here

TOP

Related Classes of com.kdubb.retrofitexamples.api.SimpleApi

Copyright © 2018 www.massapicom. 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.