public static ConnectionOrderStepUnmarshaller GetInstance()
 {
     if (instance == null)
     {
         instance = new ConnectionOrderStepUnmarshaller();
     }
     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);
        }