public static PricingDetailUnmarshaller GetInstance() 
        {
            if (instance == null) 
               instance = new PricingDetailUnmarshaller();

            return instance;
        }
Ejemplo n.º 2
0
        public ReservedInstancesOffering Unmarshall(XmlUnmarshallerContext context)
        {
            ReservedInstancesOffering reservedInstancesOffering = new ReservedInstancesOffering();
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

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

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

                        continue;
                    }
                    if (context.TestExpression("instanceType", targetDepth))
                    {
                        reservedInstancesOffering.InstanceType = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("availabilityZone", targetDepth))
                    {
                        reservedInstancesOffering.AvailabilityZone = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("duration", targetDepth))
                    {
                        reservedInstancesOffering.Duration = LongUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("usagePrice", targetDepth))
                    {
                        reservedInstancesOffering.UsagePrice = FloatUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("fixedPrice", targetDepth))
                    {
                        reservedInstancesOffering.FixedPrice = FloatUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("productDescription", targetDepth))
                    {
                        reservedInstancesOffering.ProductDescription = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("instanceTenancy", targetDepth))
                    {
                        reservedInstancesOffering.InstanceTenancy = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("currencyCode", targetDepth))
                    {
                        reservedInstancesOffering.CurrencyCode = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("offeringType", targetDepth))
                    {
                        reservedInstancesOffering.OfferingType = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("recurringCharges/item", targetDepth))
                    {
                        reservedInstancesOffering.RecurringCharges.Add(RecurringChargeUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("marketplace", targetDepth))
                    {
                        reservedInstancesOffering.Marketplace = BoolUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("pricingDetailsSet/item", targetDepth))
                    {
                        reservedInstancesOffering.PricingDetails.Add(PricingDetailUnmarshaller.GetInstance().Unmarshall(context));

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



            return(reservedInstancesOffering);
        }