public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { PutItemResponse response = new PutItemResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("Attributes", targetDepth)) { var unmarshaller = new DictionaryUnmarshaller <String, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller>( StringUnmarshaller.GetInstance(), AttributeValueUnmarshaller.GetInstance()); response.Attributes = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("ConsumedCapacity", targetDepth)) { response.ConsumedCapacity = ConsumedCapacityUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ItemCollectionMetrics", targetDepth)) { response.ItemCollectionMetrics = ItemCollectionMetricsUnmarshaller.GetInstance().Unmarshall(context); continue; } } return(response); }
public static ItemCollectionMetricsUnmarshaller GetInstance() { if (instance == null) { instance = new ItemCollectionMetricsUnmarshaller(); } return(instance); }
public PutItemResult Unmarshall(JsonUnmarshallerContext context) { PutItemResult putItemResult = new PutItemResult(); putItemResult.Attributes = null; int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if ((context.IsKey) && (context.CurrentDepth == targetDepth)) { context.Read(); context.Read(); if (context.TestExpression("Attributes", targetDepth)) { putItemResult.Attributes = new Dictionary <String, AttributeValue>(); KeyValueUnmarshaller <string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller>(StringUnmarshaller.GetInstance(), AttributeValueUnmarshaller.GetInstance()); while (context.Read()) { if (((context.IsStartArray || context.IsStartElement || context.IsLeafValue) && (context.CurrentDepth == targetDepth)) || ((context.IsKey) && (context.CurrentDepth == targetDepth + 1))) { KeyValuePair <string, AttributeValue> kvp = unmarshaller.Unmarshall(context); putItemResult.Attributes.Add(kvp.Key, kvp.Value); } else if (context.IsEndElement) { break; } } continue; } if (context.TestExpression("ConsumedCapacity", targetDepth)) { putItemResult.ConsumedCapacity = ConsumedCapacityUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ItemCollectionMetrics", targetDepth)) { putItemResult.ItemCollectionMetrics = ItemCollectionMetricsUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth <= originalDepth) { return(putItemResult); } } return(putItemResult); }
private static void UnmarshallResult(JsonUnmarshallerContext context, DeleteItemResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if (context.TestExpression("Attributes", targetDepth)) { context.Read(); response.Attributes = new Dictionary <String, AttributeValue>(); if (context.CurrentTokenType == JsonToken.Null) { continue; } KeyValueUnmarshaller <string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller>(StringUnmarshaller.GetInstance(), AttributeValueUnmarshaller.GetInstance()); while (context.Read()) { JsonToken token = context.CurrentTokenType; if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart) { continue; } if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd) { break; } KeyValuePair <string, AttributeValue> kvp = unmarshaller.Unmarshall(context); response.Attributes.Add(kvp.Key, kvp.Value); } continue; } if (context.TestExpression("ConsumedCapacity", targetDepth)) { context.Read(); response.ConsumedCapacity = ConsumedCapacityUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ItemCollectionMetrics", targetDepth)) { context.Read(); response.ItemCollectionMetrics = ItemCollectionMetricsUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.CurrentDepth <= originalDepth) { return; } } return; }
public BatchWriteItemResult Unmarshall(JsonUnmarshallerContext context) { BatchWriteItemResult batchWriteItemResult = new BatchWriteItemResult(); batchWriteItemResult.UnprocessedItems = null; batchWriteItemResult.ItemCollectionMetrics = null; batchWriteItemResult.ConsumedCapacity = null; int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if ((context.IsKey) && (context.CurrentDepth == targetDepth)) { context.Read(); context.Read(); if (context.TestExpression("UnprocessedItems", targetDepth)) { batchWriteItemResult.UnprocessedItems = new Dictionary <String, List <WriteRequest> >(); KeyValueUnmarshaller <string, List <WriteRequest>, StringUnmarshaller, ListUnmarshaller <WriteRequest, WriteRequestUnmarshaller> > unmarshaller = new KeyValueUnmarshaller <string, List <WriteRequest>, StringUnmarshaller, ListUnmarshaller <WriteRequest, WriteRequestUnmarshaller> >(StringUnmarshaller.GetInstance(), new ListUnmarshaller <WriteRequest, WriteRequestUnmarshaller>(WriteRequestUnmarshaller.GetInstance())); while (context.Read()) { if (((context.IsStartArray || context.IsStartElement || context.IsLeafValue) && (context.CurrentDepth == targetDepth)) || ((context.IsKey) && (context.CurrentDepth == targetDepth + 1))) { KeyValuePair <string, List <WriteRequest> > kvp = unmarshaller.Unmarshall(context); batchWriteItemResult.UnprocessedItems.Add(kvp.Key, kvp.Value); } else if (context.IsEndElement) { break; } } continue; } if (context.TestExpression("ItemCollectionMetrics", targetDepth)) { batchWriteItemResult.ItemCollectionMetrics = new Dictionary <String, List <ItemCollectionMetrics> >(); KeyValueUnmarshaller <string, List <ItemCollectionMetrics>, StringUnmarshaller, ListUnmarshaller <ItemCollectionMetrics, ItemCollectionMetricsUnmarshaller> > unmarshaller = new KeyValueUnmarshaller <string, List <ItemCollectionMetrics>, StringUnmarshaller, ListUnmarshaller <ItemCollectionMetrics, ItemCollectionMetricsUnmarshaller> >(StringUnmarshaller.GetInstance(), new ListUnmarshaller <ItemCollectionMetrics, ItemCollectionMetricsUnmarshaller>(ItemCollectionMetricsUnmarshaller.GetInstance())); while (context.Read()) { if (((context.IsStartArray || context.IsStartElement || context.IsLeafValue) && (context.CurrentDepth == targetDepth)) || ((context.IsKey) && (context.CurrentDepth == targetDepth + 1))) { KeyValuePair <string, List <ItemCollectionMetrics> > kvp = unmarshaller.Unmarshall(context); batchWriteItemResult.ItemCollectionMetrics.Add(kvp.Key, kvp.Value); } else if (context.IsEndElement) { break; } } continue; } if (context.TestExpression("ConsumedCapacity", targetDepth)) { batchWriteItemResult.ConsumedCapacity = new List <ConsumedCapacity>(); ConsumedCapacityUnmarshaller unmarshaller = ConsumedCapacityUnmarshaller.GetInstance(); while (context.Read()) { if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth)) { batchWriteItemResult.ConsumedCapacity.Add(unmarshaller.Unmarshall(context)); } else if (context.IsEndArray) { break; } } continue; } } else if (context.IsEndElement && context.CurrentDepth <= originalDepth) { return(batchWriteItemResult); } } return(batchWriteItemResult); }
private static void UnmarshallResult(JsonUnmarshallerContext context, BatchWriteItemResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if (context.TestExpression("UnprocessedItems", targetDepth)) { context.Read(); response.UnprocessedItems = new Dictionary <String, List <WriteRequest> >(); if (context.CurrentTokenType == JsonToken.Null) { continue; } KeyValueUnmarshaller <string, List <WriteRequest>, StringUnmarshaller, ListUnmarshaller <WriteRequest, WriteRequestUnmarshaller> > unmarshaller = new KeyValueUnmarshaller <string, List <WriteRequest>, StringUnmarshaller, ListUnmarshaller <WriteRequest, WriteRequestUnmarshaller> >(StringUnmarshaller.GetInstance(), new ListUnmarshaller <WriteRequest, WriteRequestUnmarshaller>(WriteRequestUnmarshaller.GetInstance())); while (context.Read()) { JsonToken token = context.CurrentTokenType; if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart) { continue; } if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd) { break; } KeyValuePair <string, List <WriteRequest> > kvp = unmarshaller.Unmarshall(context); response.UnprocessedItems.Add(kvp.Key, kvp.Value); } continue; } if (context.TestExpression("ItemCollectionMetrics", targetDepth)) { context.Read(); response.ItemCollectionMetrics = new Dictionary <String, List <ItemCollectionMetrics> >(); if (context.CurrentTokenType == JsonToken.Null) { continue; } KeyValueUnmarshaller <string, List <ItemCollectionMetrics>, StringUnmarshaller, ListUnmarshaller <ItemCollectionMetrics, ItemCollectionMetricsUnmarshaller> > unmarshaller = new KeyValueUnmarshaller <string, List <ItemCollectionMetrics>, StringUnmarshaller, ListUnmarshaller <ItemCollectionMetrics, ItemCollectionMetricsUnmarshaller> >(StringUnmarshaller.GetInstance(), new ListUnmarshaller <ItemCollectionMetrics, ItemCollectionMetricsUnmarshaller>(ItemCollectionMetricsUnmarshaller.GetInstance())); while (context.Read()) { JsonToken token = context.CurrentTokenType; if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart) { continue; } if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd) { break; } KeyValuePair <string, List <ItemCollectionMetrics> > kvp = unmarshaller.Unmarshall(context); response.ItemCollectionMetrics.Add(kvp.Key, kvp.Value); } continue; } if (context.TestExpression("ConsumedCapacity", targetDepth)) { context.Read(); response.ConsumedCapacity = new List <ConsumedCapacity>(); if (context.CurrentTokenType == JsonToken.Null) { continue; } ConsumedCapacityUnmarshaller unmarshaller = ConsumedCapacityUnmarshaller.GetInstance(); while (context.Read()) { JsonToken token = context.CurrentTokenType; if (token == JsonToken.ArrayStart) { continue; } if (token == JsonToken.ArrayEnd) { break; } response.ConsumedCapacity.Add(unmarshaller.Unmarshall(context)); } continue; } if (context.CurrentDepth <= originalDepth) { return; } } return; }
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { BatchWriteItemResponse response = new BatchWriteItemResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("UnprocessedItems", targetDepth)) { var unmarshaller = new DictionaryUnmarshaller <String, List <WriteRequest>, StringUnmarshaller, ListUnmarshaller <WriteRequest, WriteRequestUnmarshaller> >( StringUnmarshaller.GetInstance(), new ListUnmarshaller <WriteRequest, WriteRequestUnmarshaller>(WriteRequestUnmarshaller.GetInstance())); response.UnprocessedItems = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("ItemCollectionMetrics", targetDepth)) { var unmarshaller = new DictionaryUnmarshaller <String, List <ItemCollectionMetrics>, StringUnmarshaller, ListUnmarshaller <ItemCollectionMetrics, ItemCollectionMetricsUnmarshaller> >( StringUnmarshaller.GetInstance(), new ListUnmarshaller <ItemCollectionMetrics, ItemCollectionMetricsUnmarshaller>(ItemCollectionMetricsUnmarshaller.GetInstance())); response.ItemCollectionMetrics = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("ConsumedCapacity", targetDepth)) { var unmarshaller = new ListUnmarshaller <ConsumedCapacity, ConsumedCapacityUnmarshaller>( ConsumedCapacityUnmarshaller.GetInstance()); response.ConsumedCapacity = unmarshaller.Unmarshall(context); continue; } } return(response); }