@Test public void jsonApplicationToObjectTest() { String applicationJSON = "{" + "\"href\": \"/applications/101\"," + "\"id\": 101," + "\"name\": \"SaaS Application\"," + "\"deployments\": {" + "\"deployment\": [ {" + "\"href\": \"/applications/101/deployments/1\"," + "\"id\": 1," + "\"status\": \"DELETED\"," + "\"price\": \"222\"" + "} ]" + "}," + "\"link\": [ {" + "\"rel\": \"self\"," + "\"href\": \"/applications/101\"," + "\"type\": \"application/xml\"" + "}, {" + "\"rel\": \"parent\","+ "\"href\": \"/applications\"," + "\"type\": \"application/xml\"" + "} ]" + "}"; Application application = ModelConverter.jsonApplicationToObject(applicationJSON); assertEquals("/applications/101", application.getHref()); assertEquals(101, application.getId()); assertEquals("SaaS Application", application.getName()); assertEquals(1, application.getDeployments().size()); assertEquals("/applications/101/deployments/1", application.getDeployments().get(0).getHref()); assertEquals(1, application.getDeployments().get(0).getId()); assertEquals(2, application.getLinks().size()); assertEquals("parent", application.getLinks().get(1).getRel()); assertEquals("/applications", application.getLinks().get(1).getHref()); assertEquals("application/xml", application.getLinks().get(1).getType()); assertEquals("self", application.getLinks().get(0).getRel()); assertEquals("/applications/101", application.getLinks().get(0).getHref()); assertEquals("application/xml", application.getLinks().get(0).getType()); }
public static Application jsonApplicationToObject(String jsonString) { return fromJSONToObject(Application.class, jsonString); }
ModelConverter { public static Application jsonApplicationToObject(String jsonString) { return fromJSONToObject(Application.class, jsonString); } }
ModelConverter { public static Application jsonApplicationToObject(String jsonString) { return fromJSONToObject(Application.class, jsonString); }  }
ModelConverter { public static Application jsonApplicationToObject(String jsonString) { return fromJSONToObject(Application.class, jsonString); }  static String objectCollectionToXML(Collection collection); static String objectCollectionToJSON(Collection collection); static Collection xmlCollectionToObject(String xml); static Collection jsonCollectionToObject(String xml); static String objectSLAApplicationTermToXML(SLAApplicationTerms slaAppTerms); static String objectSLAApplicationTermToJSON(SLAApplicationTerms slaAppTerms); static SLAApplicationTerms xmlSLAApplicationTermsToObject(String xml); static SLAApplicationTerms jsonSLAApplicationTermsToObject(String jsonString); static String objectApplicationToXML(Application application); static String objectApplicationToJSON(Application application); static Application xmlApplicationToObject(String xml); static Application jsonApplicationToObject(String jsonString); static String slaLitmitsToXML(SLALimits slaLimits); static SLALimits xmlSLALimitsToObject(String xml); static String objectRootToXML(Root root); static String applicationManagerMessageToJSON(ApplicationManagerMessage amMessage); static ApplicationManagerMessage jsonToApplicationManagerMessage(String json); static Deployment xmlDeploymentToObject(String xml); static Deployment jsonDeploymentToObject(String json); static String objectDeploymentToJSON(Deployment deployment); static String objectDeploymentToXML(Deployment deployment); static VM xmlVMToObject(String xml); static String objectVMToXML(VM vm); static Agreement xmlAgreementToObject(String xml); static String objectAgreementToXML(Agreement agreement); static String objectEnergyMeasurementToXML(EnergyMeasurement energyMeasurement); static String objectEnergyMeasurementToJSON(EnergyMeasurement energyMeasurement); static EnergyMeasurement xmlEnergyMeasurementToObject(String xml); static String objectPowerMeasurementToXML(PowerMeasurement powerMeasurement); static String objectPowerMeasurementToJSON(PowerMeasurement powerMeasurement); static PowerMeasurement xmlPowerMeasurementToObject(String xml); static String objectCostToXML(Cost cost); static String objectCostToJSON(Cost cost); static Cost xmlCostToObject(String xml); }
ModelConverter { public static Application jsonApplicationToObject(String jsonString) { return fromJSONToObject(Application.class, jsonString); }  static String objectCollectionToXML(Collection collection); static String objectCollectionToJSON(Collection collection); static Collection xmlCollectionToObject(String xml); static Collection jsonCollectionToObject(String xml); static String objectSLAApplicationTermToXML(SLAApplicationTerms slaAppTerms); static String objectSLAApplicationTermToJSON(SLAApplicationTerms slaAppTerms); static SLAApplicationTerms xmlSLAApplicationTermsToObject(String xml); static SLAApplicationTerms jsonSLAApplicationTermsToObject(String jsonString); static String objectApplicationToXML(Application application); static String objectApplicationToJSON(Application application); static Application xmlApplicationToObject(String xml); static Application jsonApplicationToObject(String jsonString); static String slaLitmitsToXML(SLALimits slaLimits); static SLALimits xmlSLALimitsToObject(String xml); static String objectRootToXML(Root root); static String applicationManagerMessageToJSON(ApplicationManagerMessage amMessage); static ApplicationManagerMessage jsonToApplicationManagerMessage(String json); static Deployment xmlDeploymentToObject(String xml); static Deployment jsonDeploymentToObject(String json); static String objectDeploymentToJSON(Deployment deployment); static String objectDeploymentToXML(Deployment deployment); static VM xmlVMToObject(String xml); static String objectVMToXML(VM vm); static Agreement xmlAgreementToObject(String xml); static String objectAgreementToXML(Agreement agreement); static String objectEnergyMeasurementToXML(EnergyMeasurement energyMeasurement); static String objectEnergyMeasurementToJSON(EnergyMeasurement energyMeasurement); static EnergyMeasurement xmlEnergyMeasurementToObject(String xml); static String objectPowerMeasurementToXML(PowerMeasurement powerMeasurement); static String objectPowerMeasurementToJSON(PowerMeasurement powerMeasurement); static PowerMeasurement xmlPowerMeasurementToObject(String xml); static String objectCostToXML(Cost cost); static String objectCostToJSON(Cost cost); static Cost xmlCostToObject(String xml);  }