public ItemCollectionMetrics unmarshall(JsonUnmarshallerContext context) throws Exception { AwsJsonReader reader = context.getReader(); if (!reader.isContainer()) { reader.skipValue(); return null; } ItemCollectionMetrics itemCollectionMetrics = new ItemCollectionMetrics(); reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); if (name.equals("ItemCollectionKey")) { itemCollectionMetrics.setItemCollectionKey(new MapUnmarshaller<AttributeValue>( AttributeValueJsonUnmarshaller.getInstance() ) .unmarshall(context)); } else if (name.equals("SizeEstimateRangeGB")) { itemCollectionMetrics.setSizeEstimateRangeGB(new ListUnmarshaller<Double>( DoubleJsonUnmarshaller.getInstance() ) .unmarshall(context)); } else { reader.skipValue(); } } reader.endObject(); return itemCollectionMetrics; }
} else if (name.equals("Metrics")) { endpointBatchItem.setMetrics(new MapUnmarshaller<Double>(DoubleJsonUnmarshaller .getInstance()
} else if (name.equals("Metrics")) { publicEndpoint.setMetrics(new MapUnmarshaller<Double>(DoubleJsonUnmarshaller .getInstance()
} else if (name.equals("Metrics")) { endpointResponse.setMetrics(new MapUnmarshaller<Double>(DoubleJsonUnmarshaller .getInstance()
} else if (name.equals("Metrics")) { endpointRequest.setMetrics(new MapUnmarshaller<Double>(DoubleJsonUnmarshaller .getInstance()
.unmarshall(context)); } else if (name.equals("Metrics")) { event.setMetrics(new MapUnmarshaller<Double>(DoubleJsonUnmarshaller.getInstance()
.unmarshall(context)); } else if (name.equals("Latitude")) { endpointLocation.setLatitude(DoubleJsonUnmarshaller.getInstance() .unmarshall(context)); } else if (name.equals("Longitude")) { endpointLocation.setLongitude(DoubleJsonUnmarshaller.getInstance() .unmarshall(context)); } else if (name.equals("PostalCode")) {
event.setMetrics(new MapUnmarshaller<Double>(DoubleJsonUnmarshaller.getInstance()
event.setMetrics(new MapUnmarshaller<Double>(DoubleJsonUnmarshaller.getInstance()
.unmarshall(context)); } else if (name.equals("CapacityUnits")) { consumedCapacity.setCapacityUnits(DoubleJsonUnmarshaller.getInstance() .unmarshall(context)); } else if (name.equals("Table")) {
} else if (name.equals("TargetValue")) { autoScalingTargetTrackingScalingPolicyConfigurationUpdate .setTargetValue(DoubleJsonUnmarshaller.getInstance() .unmarshall(context)); } else {
public AbortCriteria unmarshall(JsonUnmarshallerContext context) throws Exception { AwsJsonReader reader = context.getReader(); if (!reader.isContainer()) { reader.skipValue(); return null; } AbortCriteria abortCriteria = new AbortCriteria(); reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); if (name.equals("failureType")) { abortCriteria.setFailureType(StringJsonUnmarshaller.getInstance() .unmarshall(context)); } else if (name.equals("action")) { abortCriteria.setAction(StringJsonUnmarshaller.getInstance() .unmarshall(context)); } else if (name.equals("thresholdPercentage")) { abortCriteria.setThresholdPercentage(DoubleJsonUnmarshaller.getInstance() .unmarshall(context)); } else if (name.equals("minNumberOfExecutedThings")) { abortCriteria.setMinNumberOfExecutedThings(IntegerJsonUnmarshaller.getInstance() .unmarshall(context)); } else { reader.skipValue(); } } reader.endObject(); return abortCriteria; }
} else if (name.equals("TargetValue")) { autoScalingTargetTrackingScalingPolicyConfigurationDescription .setTargetValue(DoubleJsonUnmarshaller.getInstance() .unmarshall(context)); } else {
public ExponentialRolloutRate unmarshall(JsonUnmarshallerContext context) throws Exception { AwsJsonReader reader = context.getReader(); if (!reader.isContainer()) { reader.skipValue(); return null; } ExponentialRolloutRate exponentialRolloutRate = new ExponentialRolloutRate(); reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); if (name.equals("baseRatePerMinute")) { exponentialRolloutRate.setBaseRatePerMinute(IntegerJsonUnmarshaller.getInstance() .unmarshall(context)); } else if (name.equals("incrementFactor")) { exponentialRolloutRate.setIncrementFactor(DoubleJsonUnmarshaller.getInstance() .unmarshall(context)); } else if (name.equals("rateIncreaseCriteria")) { exponentialRolloutRate.setRateIncreaseCriteria(RateIncreaseCriteriaJsonUnmarshaller .getInstance() .unmarshall(context)); } else { reader.skipValue(); } } reader.endObject(); return exponentialRolloutRate; }
public MetricTransformation unmarshall(JsonUnmarshallerContext context) throws Exception { AwsJsonReader reader = context.getReader(); if (!reader.isContainer()) { reader.skipValue(); return null; } MetricTransformation metricTransformation = new MetricTransformation(); reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); if (name.equals("metricName")) { metricTransformation.setMetricName(StringJsonUnmarshaller.getInstance() .unmarshall(context)); } else if (name.equals("metricNamespace")) { metricTransformation.setMetricNamespace(StringJsonUnmarshaller.getInstance() .unmarshall(context)); } else if (name.equals("metricValue")) { metricTransformation.setMetricValue(StringJsonUnmarshaller.getInstance() .unmarshall(context)); } else if (name.equals("defaultValue")) { metricTransformation.setDefaultValue(DoubleJsonUnmarshaller.getInstance() .unmarshall(context)); } else { reader.skipValue(); } } reader.endObject(); return metricTransformation; }
public MetricDimension unmarshall(JsonUnmarshallerContext context) throws Exception { AwsJsonReader reader = context.getReader(); if (!reader.isContainer()) { reader.skipValue(); return null; } MetricDimension metricDimension = new MetricDimension(); reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); if (name.equals("ComparisonOperator")) { metricDimension.setComparisonOperator(StringJsonUnmarshaller.getInstance() .unmarshall(context)); } else if (name.equals("Value")) { metricDimension.setValue(DoubleJsonUnmarshaller.getInstance() .unmarshall(context)); } else { reader.skipValue(); } } reader.endObject(); return metricDimension; }
public GPSCoordinates unmarshall(JsonUnmarshallerContext context) throws Exception { AwsJsonReader reader = context.getReader(); if (!reader.isContainer()) { reader.skipValue(); return null; } GPSCoordinates gPSCoordinates = new GPSCoordinates(); reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); if (name.equals("Latitude")) { gPSCoordinates.setLatitude(DoubleJsonUnmarshaller.getInstance() .unmarshall(context)); } else if (name.equals("Longitude")) { gPSCoordinates.setLongitude(DoubleJsonUnmarshaller.getInstance() .unmarshall(context)); } else { reader.skipValue(); } } reader.endObject(); return gPSCoordinates; }
public GPSPointDimension unmarshall(JsonUnmarshallerContext context) throws Exception { AwsJsonReader reader = context.getReader(); if (!reader.isContainer()) { reader.skipValue(); return null; } GPSPointDimension gPSPointDimension = new GPSPointDimension(); reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); if (name.equals("Coordinates")) { gPSPointDimension.setCoordinates(GPSCoordinatesJsonUnmarshaller.getInstance() .unmarshall(context)); } else if (name.equals("RangeInKilometers")) { gPSPointDimension.setRangeInKilometers(DoubleJsonUnmarshaller.getInstance() .unmarshall(context)); } else { reader.skipValue(); } } reader.endObject(); return gPSPointDimension; }
public Capacity unmarshall(JsonUnmarshallerContext context) throws Exception { AwsJsonReader reader = context.getReader(); if (!reader.isContainer()) { reader.skipValue(); return null; } Capacity capacity = new Capacity(); reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); if (name.equals("CapacityUnits")) { capacity.setCapacityUnits(DoubleJsonUnmarshaller.getInstance() .unmarshall(context)); } else { reader.skipValue(); } } reader.endObject(); return capacity; }
@Test public void testDoubleJsonUnmarshaller() throws Exception { Double dub = new Double(5.5); StringWriter sw = new StringWriter(); AwsJsonWriter jw = JsonUtils.getJsonWriter(sw); jw.beginObject(); jw.name("dub"); jw.value(dub); jw.endObject(); String json = sw.toString(); StringReader sr = new StringReader(json); AwsJsonReader jr = JsonUtils.getJsonReader(sr); JsonUnmarshallerContext context = new JsonUnmarshallerContext(jr); context.getReader().beginObject(); context.getReader().nextName(); SimpleTypeJsonUnmarshallers.DoubleJsonUnmarshaller dubUnmarshaller = SimpleTypeJsonUnmarshallers.DoubleJsonUnmarshaller .getInstance(); Double unmarshalledDub = dubUnmarshaller.unmarshall(context); assertEquals(unmarshalledDub.doubleValue(), 5.5, .001); }