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

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

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 Hello_say_hello_Hello_ResponseStruct2_SOAPSerializer extends ObjectSerializerBase implements Initializable {
    private static final QName ns1_result_QNAME = new QName("", "result");
    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 myRESULT_INDEX = 0;
    
    public Hello_say_hello_Hello_ResponseStruct2_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.Hello.Hello_say_hello_Hello_ResponseStruct2 instance = new com.nec.webotx.webservice.director.Hello.Hello_say_hello_Hello_ResponseStruct2();
        com.nec.webotx.webservice.director.Hello.Hello_say_hello_Hello_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 = ns2_myns2_string__java_lang_String_String_Serializer.deserialize(ns1_result_QNAME, reader, context);
                if (member instanceof SOAPDeserializationState) {
                    if (builder == null) {
                        builder = new com.nec.webotx.webservice.director.Hello.Hello_say_hello_Hello_ResponseStruct2_SOAPBuilder();
                    }
                    state = registerWithMemberState(instance, state, member, myRESULT_INDEX, builder);
                    isComplete = false;
                } else {
                    instance.setResult((java.lang.String)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.Hello.Hello_say_hello_Hello_ResponseStruct2 instance = (com.nec.webotx.webservice.director.Hello.Hello_say_hello_Hello_ResponseStruct2)obj;
        
    }
    
    public void doSerializeInstance(Object obj, XMLWriter writer, SOAPSerializationContext context) throws Exception {
        com.nec.webotx.webservice.director.Hello.Hello_say_hello_Hello_ResponseStruct2 instance = (com.nec.webotx.webservice.director.Hello.Hello_say_hello_Hello_ResponseStruct2)obj;
        
        ns2_myns2_string__java_lang_String_String_Serializer.serialize(instance.getResult(), ns1_result_QNAME, null, writer, context);
    }
    protected void verifyName(XMLReader reader, QName expectedName) throws Exception {
    }
}
