/**
 * Do not edit.
 *
 * This file was auto-generated
 * by the Web Service Director Eclipse Plugin Edition.
 */

package com.nec.webotx.webservice.director.aggregator;

import com.nec.webotx.webservice.xml.rpc.encoding.*;
import com.nec.webotx.webservice.xml.rpc.encoding.literal.DetailFragmentDeserializer;
import com.nec.webotx.webservice.xml.rpc.encoding.simpletype.*;
import com.nec.webotx.webservice.xml.rpc.encoding.soap.SOAPConstants;
import com.nec.webotx.webservice.xml.rpc.encoding.soap.SOAP12Constants;
import com.nec.webotx.webservice.xml.rpc.streaming.*;
import com.nec.webotx.webservice.xml.rpc.wsdl.document.schema.SchemaConstants;
import javax.xml.namespace.QName;

public class Aggregator_sampleAggregation_Aggregation_RequestStruct2_SOAPSerializer extends ObjectSerializerBase implements Initializable {
    private static final QName ns1_String_1_QNAME = new QName("", "String_1");
    private static final QName ns2_string_TYPE_QNAME = SchemaConstants.QNAME_TYPE_STRING;
    private CombinedSerializer ns2_myns2_string__java_lang_String_String_Serializer;
    private static final QName ns1_String_2_QNAME = new QName("", "String_2");
    private static final QName ns1_String_3_QNAME = new QName("", "String_3");
    private static final QName ns1_String_4_QNAME = new QName("", "String_4");
    private static final int mySTRING_1_INDEX = 0;
    private static final int mySTRING_2_INDEX = 1;
    private static final int mySTRING_3_INDEX = 2;
    private static final int mySTRING_4_INDEX = 3;
    
    public Aggregator_sampleAggregation_Aggregation_RequestStruct2_SOAPSerializer(QName type, boolean encodeType, boolean isNullable, String encodingStyle) {
        super(type, encodeType, isNullable, encodingStyle);
    }
    
    public void initialize(InternalTypeMappingRegistry registry) throws Exception {
        ns2_myns2_string__java_lang_String_String_Serializer = (CombinedSerializer)registry.getSerializer(SOAPConstants.NS_SOAP_ENCODING, java.lang.String.class, ns2_string_TYPE_QNAME);
    }
    
    public Object doDeserialize(SOAPDeserializationState state, XMLReader reader,
        SOAPDeserializationContext context) throws Exception {
        com.nec.webotx.webservice.director.aggregator.Aggregator_sampleAggregation_Aggregation_RequestStruct2 instance = new com.nec.webotx.webservice.director.aggregator.Aggregator_sampleAggregation_Aggregation_RequestStruct2();
        com.nec.webotx.webservice.director.aggregator.Aggregator_sampleAggregation_Aggregation_RequestStruct2_SOAPBuilder builder = null;
        Object member;
        boolean isComplete = true;
        QName elementName;
        
        reader.nextElementContent();
        for (int i=0; i<4; i++) {
            elementName = reader.getName();
            if (reader.getState() == XMLReader.END) {
                break;
            }
            if (elementName.equals(ns1_String_1_QNAME)) {
                member = ns2_myns2_string__java_lang_String_String_Serializer.deserialize(ns1_String_1_QNAME, reader, context);
                if (member instanceof SOAPDeserializationState) {
                    if (builder == null) {
                        builder = new com.nec.webotx.webservice.director.aggregator.Aggregator_sampleAggregation_Aggregation_RequestStruct2_SOAPBuilder();
                    }
                    state = registerWithMemberState(instance, state, member, mySTRING_1_INDEX, builder);
                    isComplete = false;
                } else {
                    instance.setString_1((java.lang.String)member);
                }
                reader.nextElementContent();
                continue;
            }
            if (elementName.equals(ns1_String_2_QNAME)) {
                member = ns2_myns2_string__java_lang_String_String_Serializer.deserialize(ns1_String_2_QNAME, reader, context);
                if (member instanceof SOAPDeserializationState) {
                    if (builder == null) {
                        builder = new com.nec.webotx.webservice.director.aggregator.Aggregator_sampleAggregation_Aggregation_RequestStruct2_SOAPBuilder();
                    }
                    state = registerWithMemberState(instance, state, member, mySTRING_2_INDEX, builder);
                    isComplete = false;
                } else {
                    instance.setString_2((java.lang.String)member);
                }
                reader.nextElementContent();
                continue;
            }
            if (elementName.equals(ns1_String_3_QNAME)) {
                member = ns2_myns2_string__java_lang_String_String_Serializer.deserialize(ns1_String_3_QNAME, reader, context);
                if (member instanceof SOAPDeserializationState) {
                    if (builder == null) {
                        builder = new com.nec.webotx.webservice.director.aggregator.Aggregator_sampleAggregation_Aggregation_RequestStruct2_SOAPBuilder();
                    }
                    state = registerWithMemberState(instance, state, member, mySTRING_3_INDEX, builder);
                    isComplete = false;
                } else {
                    instance.setString_3((java.lang.String)member);
                }
                reader.nextElementContent();
                continue;
            }
            if (elementName.equals(ns1_String_4_QNAME)) {
                member = ns2_myns2_string__java_lang_String_String_Serializer.deserialize(ns1_String_4_QNAME, reader, context);
                if (member instanceof SOAPDeserializationState) {
                    if (builder == null) {
                        builder = new com.nec.webotx.webservice.director.aggregator.Aggregator_sampleAggregation_Aggregation_RequestStruct2_SOAPBuilder();
                    }
                    state = registerWithMemberState(instance, state, member, mySTRING_4_INDEX, builder);
                    isComplete = false;
                } else {
                    instance.setString_4((java.lang.String)member);
                }
                reader.nextElementContent();
                continue;
            } else {
                throw new DeserializationException("soap.unexpectedElementName", new Object[] {ns1_String_4_QNAME, elementName});
            }
        }
        
        XMLReaderUtil.verifyReaderState(reader, XMLReader.END);
        return (isComplete ? (Object)instance : (Object)state);
    }
    
    public void doSerializeAttributes(Object obj, XMLWriter writer, SOAPSerializationContext context) throws Exception {
        com.nec.webotx.webservice.director.aggregator.Aggregator_sampleAggregation_Aggregation_RequestStruct2 instance = (com.nec.webotx.webservice.director.aggregator.Aggregator_sampleAggregation_Aggregation_RequestStruct2)obj;
        
    }
    
    public void doSerializeInstance(Object obj, XMLWriter writer, SOAPSerializationContext context) throws Exception {
        com.nec.webotx.webservice.director.aggregator.Aggregator_sampleAggregation_Aggregation_RequestStruct2 instance = (com.nec.webotx.webservice.director.aggregator.Aggregator_sampleAggregation_Aggregation_RequestStruct2)obj;
        
        ns2_myns2_string__java_lang_String_String_Serializer.serialize(instance.getString_1(), ns1_String_1_QNAME, null, writer, context);
        ns2_myns2_string__java_lang_String_String_Serializer.serialize(instance.getString_2(), ns1_String_2_QNAME, null, writer, context);
        ns2_myns2_string__java_lang_String_String_Serializer.serialize(instance.getString_3(), ns1_String_3_QNAME, null, writer, context);
        ns2_myns2_string__java_lang_String_String_Serializer.serialize(instance.getString_4(), ns1_String_4_QNAME, null, writer, context);
    }
}
