public JobFlowInstancesDetail Unmarshall(JsonUnmarshallerContext context)
        {
            JobFlowInstancesDetail jobFlowInstancesDetail = new JobFlowInstancesDetail();

            jobFlowInstancesDetail.InstanceGroups = 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("MasterInstanceType", targetDepth))
                    {
                        jobFlowInstancesDetail.MasterInstanceType = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("MasterPublicDnsName", targetDepth))
                    {
                        jobFlowInstancesDetail.MasterPublicDnsName = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("MasterInstanceId", targetDepth))
                    {
                        jobFlowInstancesDetail.MasterInstanceId = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("SlaveInstanceType", targetDepth))
                    {
                        jobFlowInstancesDetail.SlaveInstanceType = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("InstanceCount", targetDepth))
                    {
                        jobFlowInstancesDetail.InstanceCount = IntUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("InstanceGroups", targetDepth))
                    {
                        jobFlowInstancesDetail.InstanceGroups = new List <InstanceGroupDetail>();
                        InstanceGroupDetailUnmarshaller unmarshaller = InstanceGroupDetailUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                jobFlowInstancesDetail.InstanceGroups.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("NormalizedInstanceHours", targetDepth))
                    {
                        jobFlowInstancesDetail.NormalizedInstanceHours = IntUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("Ec2KeyName", targetDepth))
                    {
                        jobFlowInstancesDetail.Ec2KeyName = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("Ec2SubnetId", targetDepth))
                    {
                        jobFlowInstancesDetail.Ec2SubnetId = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("Placement", targetDepth))
                    {
                        jobFlowInstancesDetail.Placement = PlacementTypeUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("KeepJobFlowAliveWhenNoSteps", targetDepth))
                    {
                        jobFlowInstancesDetail.KeepJobFlowAliveWhenNoSteps = BoolUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("TerminationProtected", targetDepth))
                    {
                        jobFlowInstancesDetail.TerminationProtected = BoolUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("HadoopVersion", targetDepth))
                    {
                        jobFlowInstancesDetail.HadoopVersion = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(jobFlowInstancesDetail);
                }
            }


            return(jobFlowInstancesDetail);
        }
        public JobFlowInstancesDetail Unmarshall(XmlUnmarshallerContext context)
        {
            JobFlowInstancesDetail jobFlowInstancesDetail = new JobFlowInstancesDetail();
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("MasterInstanceType", targetDepth))
                    {
                        jobFlowInstancesDetail.MasterInstanceType = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("MasterPublicDnsName", targetDepth))
                    {
                        jobFlowInstancesDetail.MasterPublicDnsName = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("MasterInstanceId", targetDepth))
                    {
                        jobFlowInstancesDetail.MasterInstanceId = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("SlaveInstanceType", targetDepth))
                    {
                        jobFlowInstancesDetail.SlaveInstanceType = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("InstanceCount", targetDepth))
                    {
                        jobFlowInstancesDetail.InstanceCount = IntUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("InstanceGroups/member", targetDepth))
                    {
                        jobFlowInstancesDetail.InstanceGroups.Add(InstanceGroupDetailUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("NormalizedInstanceHours", targetDepth))
                    {
                        jobFlowInstancesDetail.NormalizedInstanceHours = IntUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("Ec2KeyName", targetDepth))
                    {
                        jobFlowInstancesDetail.Ec2KeyName = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("Ec2SubnetId", targetDepth))
                    {
                        jobFlowInstancesDetail.Ec2SubnetId = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("Placement", targetDepth))
                    {
                        jobFlowInstancesDetail.Placement = PlacementTypeUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("KeepJobFlowAliveWhenNoSteps", targetDepth))
                    {
                        jobFlowInstancesDetail.KeepJobFlowAliveWhenNoSteps = BoolUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("TerminationProtected", targetDepth))
                    {
                        jobFlowInstancesDetail.TerminationProtected = BoolUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("HadoopVersion", targetDepth))
                    {
                        jobFlowInstancesDetail.HadoopVersion = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return(jobFlowInstancesDetail);
                }
            }



            return(jobFlowInstancesDetail);
        }
Ejemplo n.º 3
0
        public JobFlowInstancesDetail Unmarshall(JsonUnmarshallerContext context)
        {
            context.Read();
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }
            JobFlowInstancesDetail jobFlowInstancesDetail = new JobFlowInstancesDetail();


            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("MasterInstanceType", targetDepth))
                {
                    jobFlowInstancesDetail.MasterInstanceType = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("MasterPublicDnsName", targetDepth))
                {
                    jobFlowInstancesDetail.MasterPublicDnsName = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("MasterInstanceId", targetDepth))
                {
                    jobFlowInstancesDetail.MasterInstanceId = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("SlaveInstanceType", targetDepth))
                {
                    jobFlowInstancesDetail.SlaveInstanceType = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("InstanceCount", targetDepth))
                {
                    jobFlowInstancesDetail.InstanceCount = IntUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("InstanceGroups", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <InstanceGroupDetail, InstanceGroupDetailUnmarshaller>(
                        InstanceGroupDetailUnmarshaller.GetInstance());
                    jobFlowInstancesDetail.InstanceGroups = unmarshaller.Unmarshall(context);

                    continue;
                }

                if (context.TestExpression("NormalizedInstanceHours", targetDepth))
                {
                    jobFlowInstancesDetail.NormalizedInstanceHours = IntUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("Ec2KeyName", targetDepth))
                {
                    jobFlowInstancesDetail.Ec2KeyName = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("Ec2SubnetId", targetDepth))
                {
                    jobFlowInstancesDetail.Ec2SubnetId = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("Placement", targetDepth))
                {
                    jobFlowInstancesDetail.Placement = PlacementTypeUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("KeepJobFlowAliveWhenNoSteps", targetDepth))
                {
                    jobFlowInstancesDetail.KeepJobFlowAliveWhenNoSteps = BoolUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("TerminationProtected", targetDepth))
                {
                    jobFlowInstancesDetail.TerminationProtected = BoolUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("HadoopVersion", targetDepth))
                {
                    jobFlowInstancesDetail.HadoopVersion = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }
            }

            return(jobFlowInstancesDetail);
        }