/**
 * 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_ResponseStruct2_SOAPSerializer extends ObjectSerializerBase implements Initializable {
    private static final QName ns1_result_QNAME = new QName("", "result");
    private static final QName ns3_Info_TYPE_QNAME = new QName("http://sample", "Info");
    private CombinedSerializer ns3_myInfo_SOAPSerializer;
    private static final int myRESULT_INDEX = 0;
    
    public Aggregator_sampleAggregation_Aggregation_ResponseStruct2_SOAPSerializer(QName type, boolean encodeType, boolean isNullable, String encodingStyle) {
        super(type, encodeType, isNullable, encodingStyle);
    }
    
    public void initialize(InternalTypeMappingRegistry registry) throws Exception {
        ns3_myInfo_SOAPSerializer = (CombinedSerializer)registry.getSerializer(SOAPConstants.NS_SOAP_ENCODING, com.nec.webotx.webservice.sample.Info.class, ns3_Info_TYPE_QNAME);
    }
    
    public Object doDeserialize(SOAPDeserializationState state, XMLReader reader,
        SOAPDeserializationContext context) throws Exception {
        com.nec.webotx.webservice.director.aggregator.Aggregator_sampleAggregation_Aggregation_ResponseStruct2 instance = new com.nec.webotx.webservice.director.aggregator.Aggregator_sampleAggregation_Aggregation_ResponseStruct2();
        com.nec.webotx.webservice.director.aggregator.Aggregator_sampleAggregation_Aggregation_ResponseStruct2_SOAPBuilder builder = null;
        Object member;
        boolean isComplete = true;
        QName elementName;
        
        reader.nextElementContent();
        elementName = reader.getName();
        if (reader.getState() == XMLReader.START) {
            if (elementName.equals(ns1_result_QNAME)) {
                member = ns3_myInfo_SOAPSerializer.deserialize(ns1_result_QNAME, reader, context);
                if (member instanceof SOAPDeserializationState) {
                    if (builder == null) {
                        builder = new com.nec.webotx.webservice.director.aggregator.Aggregator_sampleAggregation_Aggregation_ResponseStruct2_SOAPBuilder();
                    }
                    state = registerWithMemberState(instance, state, member, myRESULT_INDEX, builder);
                    isComplete = false;
                } else {
                    instance.setResult((com.nec.webotx.webservice.sample.Info)member);
                }
                reader.nextElementContent();
            } else {
                throw new DeserializationException("soap.unexpectedElementName", new Object[] {ns1_result_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_ResponseStruct2 instance = (com.nec.webotx.webservice.director.aggregator.Aggregator_sampleAggregation_Aggregation_ResponseStruct2)obj;
        
    }
    
    public void doSerializeInstance(Object obj, XMLWriter writer, SOAPSerializationContext context) throws Exception {
        com.nec.webotx.webservice.director.aggregator.Aggregator_sampleAggregation_Aggregation_ResponseStruct2 instance = (com.nec.webotx.webservice.director.aggregator.Aggregator_sampleAggregation_Aggregation_ResponseStruct2)obj;
        
        ns3_myInfo_SOAPSerializer.serialize(instance.getResult(), ns1_result_QNAME, null, writer, context);
    }
    protected void verifyName(XMLReader reader, QName expectedName) throws Exception {
    }
}
