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

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

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 Service1_method1_Sample1_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 int mySTRING_1_INDEX = 0;
    
    public Service1_method1_Sample1_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.service1.Service1_method1_Sample1_RequestStruct2 instance = new com.nec.webotx.webservice.director.service1.Service1_method1_Sample1_RequestStruct2();
        com.nec.webotx.webservice.director.service1.Service1_method1_Sample1_RequestStruct2_SOAPBuilder builder = null;
        Object member;
        boolean isComplete = true;
        QName elementName;
        
        reader.nextElementContent();
        elementName = reader.getName();
        if (reader.getState() == XMLReader.START) {
            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.service1.Service1_method1_Sample1_RequestStruct2_SOAPBuilder();
                    }
                    state = registerWithMemberState(instance, state, member, mySTRING_1_INDEX, builder);
                    isComplete = false;
                } else {
                    instance.setString_1((java.lang.String)member);
                }
                reader.nextElementContent();
            } else {
                throw new DeserializationException("soap.unexpectedElementName", new Object[] {ns1_String_1_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.service1.Service1_method1_Sample1_RequestStruct2 instance = (com.nec.webotx.webservice.director.service1.Service1_method1_Sample1_RequestStruct2)obj;
        
    }
    
    public void doSerializeInstance(Object obj, XMLWriter writer, SOAPSerializationContext context) throws Exception {
        com.nec.webotx.webservice.director.service1.Service1_method1_Sample1_RequestStruct2 instance = (com.nec.webotx.webservice.director.service1.Service1_method1_Sample1_RequestStruct2)obj;
        
        ns2_myns2_string__java_lang_String_String_Serializer.serialize(instance.getString_1(), ns1_String_1_QNAME, null, writer, context);
    }
}
