public static ConnectionCostUnmarshaller GetInstance() { if (instance == null) { instance = new ConnectionCostUnmarshaller(); } return(instance); }
public DescribeConnectionDetailResult Unmarshall(JsonUnmarshallerContext context) { DescribeConnectionDetailResult describeConnectionDetailResult = new DescribeConnectionDetailResult(); describeConnectionDetailResult.ConnectionCosts = null; describeConnectionDetailResult.OrderSteps = 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("ConnectionId", targetDepth)) { describeConnectionDetailResult.ConnectionId = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ConnectionName", targetDepth)) { describeConnectionDetailResult.ConnectionName = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ConnectionState", targetDepth)) { describeConnectionDetailResult.ConnectionState = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Region", targetDepth)) { describeConnectionDetailResult.Region = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Location", targetDepth)) { describeConnectionDetailResult.Location = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Bandwidth", targetDepth)) { describeConnectionDetailResult.Bandwidth = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ConnectionCosts", targetDepth)) { describeConnectionDetailResult.ConnectionCosts = new List <ConnectionCost>(); ConnectionCostUnmarshaller unmarshaller = ConnectionCostUnmarshaller.GetInstance(); while (context.Read()) { if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth)) { describeConnectionDetailResult.ConnectionCosts.Add(unmarshaller.Unmarshall(context)); } else if (context.IsEndArray) { break; } } continue; } if (context.TestExpression("OrderSteps", targetDepth)) { describeConnectionDetailResult.OrderSteps = new List <ConnectionOrderStep>(); ConnectionOrderStepUnmarshaller unmarshaller = ConnectionOrderStepUnmarshaller.GetInstance(); while (context.Read()) { if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth)) { describeConnectionDetailResult.OrderSteps.Add(unmarshaller.Unmarshall(context)); } else if (context.IsEndArray) { break; } } continue; } } else if (context.IsEndElement && context.CurrentDepth <= originalDepth) { return(describeConnectionDetailResult); } } return(describeConnectionDetailResult); }
public Offering Unmarshall(JsonUnmarshallerContext context) { Offering offering = new Offering(); offering.ConnectionCosts = 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("OfferingId", targetDepth)) { offering.OfferingId = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Region", targetDepth)) { offering.Region = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Location", targetDepth)) { offering.Location = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("OfferingName", targetDepth)) { offering.OfferingName = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Description", targetDepth)) { offering.Description = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Bandwidth", targetDepth)) { offering.Bandwidth = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ConnectionCosts", targetDepth)) { offering.ConnectionCosts = new List <ConnectionCost>(); ConnectionCostUnmarshaller unmarshaller = ConnectionCostUnmarshaller.GetInstance(); while (context.Read()) { if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth)) { offering.ConnectionCosts.Add(unmarshaller.Unmarshall(context)); } else if (context.IsEndArray) { break; } } continue; } } else if (context.IsEndElement && context.CurrentDepth <= originalDepth) { return(offering); } } return(offering); }