Package com.google.gson

Examples of com.google.gson.JsonObject


      }
      List<DriveInfo> drivesList = (List<DriveInfo>) payload;
      JsonArray drivesJsonArray = new JsonArray();

      for (DriveInfo drive : drivesList) {
         JsonObject driveObject = createDriveRequestJson.apply(drive);
         drivesJsonArray.add(driveObject);
      }

      JsonObject json = new JsonObject();
      json.add("objects", drivesJsonArray);

      request.setPayload(json.toString());
      request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
      return request;
   }
View Full Code Here


   @Override
   public <R extends HttpRequest> R bindToRequest(R request, Object input) {
      checkArgument(input instanceof Tag, "this binder is only valid for Tag!");
      Tag create = Tag.class.cast(input);

      JsonObject serverInfoJson = createTagRequestToJson.apply(create);
      request.setPayload(serverInfoJson.toString());
      request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
      return request;
   }
View Full Code Here

   @Override
   public <R extends HttpRequest> R bindToRequest(R request, Object input) {
      checkArgument(input instanceof LibraryDrive, "this binder is only valid for LibraryDrive!");
      LibraryDrive create = LibraryDrive.class.cast(input);
      JsonObject profileInfoJsonObject = createDriveJsonObjectFunction.apply(create);
      request.setPayload(profileInfoJsonObject.toString());
      request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
      return request;
   }
View Full Code Here

   @Override
   public <R extends HttpRequest> R bindToRequest(R request, Object input) {
      checkArgument(input instanceof FirewallPolicy, "this binder is only valid for FirewallPolicy!");
      FirewallPolicy create = FirewallPolicy.class.cast(input);
      JsonObject firewallJsonObject = policyJsonObjectFunction.apply(create);

      request.setPayload(firewallJsonObject.toString());
      request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
      return request;
   }
View Full Code Here

   @Override
   public <R extends HttpRequest> R bindToRequest(R request, Object input) {
      checkArgument(input instanceof ServerInfo, "this binder is only valid for ServerInfo!");
      ServerInfo create = ServerInfo.class.cast(input);

      JsonObject serverInfoJson = createServerInfoRequestToJson.apply(create);
      request.setPayload(serverInfoJson.toString());
      request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
      return request;
   }
View Full Code Here

      }
      Iterable<ServerInfo> serverInfoList = (Iterable<ServerInfo>) payload;
      JsonArray serversJsonArray = new JsonArray();

      for (ServerInfo serverInfo : serverInfoList) {
         JsonObject driveObject = createServerInfoRequestToJson.apply(serverInfo);
         serversJsonArray.add(driveObject);
      }

      JsonObject json = new JsonObject();
      json.add("objects", serversJsonArray);

      request.setPayload(json.toString());
      request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
      return request;
   }
View Full Code Here

      }
      Iterable<Tag> tags = (Iterable<Tag>) payload;
      JsonArray tagJsonArray = new JsonArray();

      for (Tag tag : tags) {
         JsonObject driveObject = tagJsonObjectFunction.apply(tag);
         tagJsonArray.add(driveObject);
      }

      JsonObject json = new JsonObject();
      json.add("objects", tagJsonArray);

      request.setPayload(json.toString());
      request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
      return request;
   }
View Full Code Here

   @Override
   public <R extends HttpRequest> R bindToRequest(R request, Object input) {
      checkArgument(input instanceof CreateSubscriptionRequest,
            "this binder is only valid for CreateSubscriptionRequest!");
      CreateSubscriptionRequest create = CreateSubscriptionRequest.class.cast(input);
      JsonObject subscriptionObject = subscriptionRequestJsonObjectFunction.apply(create);

      request.setPayload(subscriptionObject.toString());
      request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
      return request;
   }
View Full Code Here

   @Override
   public <R extends HttpRequest> R bindToRequest(R request, Object input) {
      checkArgument(input instanceof ProfileInfo, "this binder is only valid for ProfileInfo!");
      ProfileInfo create = ProfileInfo.class.cast(input);
      JsonObject profileInfoJsonObject = createProfileRequestToJson.apply(create);
      request.setPayload(profileInfoJsonObject.toString());
      request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
      return request;
   }
View Full Code Here

   @Override
   public <R extends HttpRequest> R bindToRequest(R request, Object input) {
      checkArgument(input instanceof VLANInfo, "this binder is only valid for VLANInfo!");
      VLANInfo create = VLANInfo.class.cast(input);
      JsonObject vlanJsonObject = vlanInfoJsonObjectFunction.apply(create);

      request.setPayload(vlanJsonObject.toString());
      request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
      return request;
   }
View Full Code Here

TOP

Related Classes of com.google.gson.JsonObject

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.