All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ksc.network.eip.model.transform.DescribeAddressesResultStaxUnmarshaller Maven / Gradle / Ivy

There is a newer version: 2.1.8
Show newest version
package com.ksc.network.eip.model.transform;

import javax.xml.stream.events.XMLEvent;

import com.ksc.transform.SimpleTypeStaxUnmarshallers.StringStaxUnmarshaller;
import com.ksc.transform.StaxUnmarshallerContext;
import com.ksc.transform.Unmarshaller;
import com.ksyun.api.sdk.kec.model.eip.DescribeAddressesResult;

/**
 * DescribeAddressesResult StAX Unmarshaller
 */
public class DescribeAddressesResultStaxUnmarshaller implements
        Unmarshaller {

    public DescribeAddressesResult unmarshall(StaxUnmarshallerContext context)
            throws Exception {
        DescribeAddressesResult describeAddressesResult = new DescribeAddressesResult();
        int originalDepth = context.getCurrentDepth();
        int targetDepth = originalDepth + 1;

        if (context.isStartOfDocument())
            targetDepth += 1;

        while (true) {
            XMLEvent xmlEvent = context.nextEvent();
            if (xmlEvent.isEndDocument())
                return describeAddressesResult;

            if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {

                if (context.testExpression("AddressesSet/item", targetDepth)) {
                    describeAddressesResult
                            .withAddressesSet(AddressStaxUnmarshaller
                                    .getInstance().unmarshall(context));
                    continue;
                }else if(context.testExpression("RequestId", targetDepth)){
                	describeAddressesResult.setRequestId(StringStaxUnmarshaller.getInstance()
							.unmarshall(context));
					continue;
				}else if(context.testExpression("NextToken", targetDepth)){
					describeAddressesResult.setNextToken(StringStaxUnmarshaller.getInstance()
							.unmarshall(context));
					continue;
				}

            } else if (xmlEvent.isEndElement()) {
                if (context.getCurrentDepth() < originalDepth) {
                    return describeAddressesResult;
                }
            }
        }
    }

    private static DescribeAddressesResultStaxUnmarshaller instance;

    public static DescribeAddressesResultStaxUnmarshaller getInstance() {
        if (instance == null)
            instance = new DescribeAddressesResultStaxUnmarshaller();
        return instance;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy