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

package com.nec.webotx.webservice.sample;

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 Info_SOAPSerializer extends ObjectSerializerBase implements Initializable {
    private static final QName ns1_sample1_QNAME = new QName("", "sample1");
    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_sample2_QNAME = new QName("", "sample2");
    private static final int mySAMPLE1_INDEX = 0;
    private static final int mySAMPLE2_INDEX = 1;
    
    public Info_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.sample.Info instance = new com.nec.webotx.webservice.sample.Info();
        com.nec.webotx.webservice.sample.Info_SOAPBuilder builder = null;
        Object member;
        boolean isComplete = true;
        QName elementName;
        
        reader.nextElementContent();
        elementName = reader.getName();
        if (reader.getState() == XMLReader.START) {
            if (elementName.equals(ns1_sample1_QNAME)) {
                member = ns2_myns2_string__java_lang_String_String_Serializer.deserialize(ns1_sample1_QNAME, reader, context);
                if (member instanceof SOAPDeserializationState) {
                    if (builder == null) {
                        builder = new com.nec.webotx.webservice.sample.Info_SOAPBuilder();
                    }
                    state = registerWithMemberState(instance, state, member, mySAMPLE1_INDEX, builder);
                    isComplete = false;
                } else {
                    instance.setSample1((java.lang.String)member);
                }
                reader.nextElementContent();
            }
        }
        elementName = reader.getName();
        if (reader.getState() == XMLReader.START) {
            if (elementName.equals(ns1_sample2_QNAME)) {
                member = ns2_myns2_string__java_lang_String_String_Serializer.deserialize(ns1_sample2_QNAME, reader, context);
                if (member instanceof SOAPDeserializationState) {
                    if (builder == null) {
                        builder = new com.nec.webotx.webservice.sample.Info_SOAPBuilder();
                    }
                    state = registerWithMemberState(instance, state, member, mySAMPLE2_INDEX, builder);
                    isComplete = false;
                } else {
                    instance.setSample2((java.lang.String)member);
                }
                reader.nextElementContent();
            }
        }
        
        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.sample.Info instance = (com.nec.webotx.webservice.sample.Info)obj;
        
    }
    
    public void doSerializeInstance(Object obj, XMLWriter writer, SOAPSerializationContext context) throws Exception {
        com.nec.webotx.webservice.sample.Info instance = (com.nec.webotx.webservice.sample.Info)obj;
        
        ns2_myns2_string__java_lang_String_String_Serializer.serialize(instance.getSample1(), ns1_sample1_QNAME, null, writer, context);
        ns2_myns2_string__java_lang_String_String_Serializer.serialize(instance.getSample2(), ns1_sample2_QNAME, null, writer, context);
    }
}
