// !DO NOT EDIT THIS FILE!
// This source file is generated by Oracle tools
// Contents may be subject to change
// For reporting problems, use the following
// Version = Oracle WebServices (10.1.3.3.0, build 070610.1800.23513)

package xqueryws.proxy.runtime;

import oracle.j2ee.ws.common.encoding.*;
import oracle.j2ee.ws.common.encoding.literal.*;
import oracle.j2ee.ws.common.encoding.literal.DetailFragmentDeserializer;
import oracle.j2ee.ws.common.encoding.simpletype.*;
import oracle.j2ee.ws.common.soap.SOAPEncodingConstants;
import oracle.j2ee.ws.common.soap.SOAPEnvelopeConstants;
import oracle.j2ee.ws.common.soap.SOAPVersion;
import oracle.j2ee.ws.common.streaming.*;
import oracle.j2ee.ws.common.wsdl.document.schema.SchemaConstants;
import oracle.j2ee.ws.common.util.xml.UUID;
import javax.xml.namespace.QName;
import java.util.List;
import java.util.ArrayList;
import java.util.StringTokenizer;
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.AttachmentPart;

public class Query_LiteralSerializer extends LiteralObjectSerializerBase implements Initializable {
    private static final QName ns2_query_text_QNAME = new QName("http://xmlns.oracle.com/orawsv", "query_text");
    private static final QName ns2_query_text_TYPE_QNAME = new QName("http://xmlns.oracle.com/orawsv", "query_text");
    private CombinedSerializer myns2_query_text__Query_text_LiteralSerializer;
    private static final QName ns2_bind_QNAME = new QName("http://xmlns.oracle.com/orawsv", "bind");
    private static final QName ns2_bind_TYPE_QNAME = new QName("http://xmlns.oracle.com/orawsv", "bind");
    private CombinedSerializer myns2_bind__Bind_LiteralSerializer;
    private static final QName ns2_bindObject_QNAME = new QName("http://xmlns.oracle.com/orawsv", "bindObject");
    private static final QName ns2_bindObject_TYPE_QNAME = new QName("http://xmlns.oracle.com/orawsv", "bindObject");
    private CombinedSerializer ns2_bindObject_TYPE_QNAMEjavax$2e$xml$2e$soap$2e$SOAPElement_Serializer;
    private static final QName ns2_bindXML_QNAME = new QName("http://xmlns.oracle.com/orawsv", "bindXML");
    private static final QName ns2_bindXML_TYPE_QNAME = new QName("http://xmlns.oracle.com/orawsv", "bindXML");
    private CombinedSerializer ns2_bindXML_TYPE_QNAMEjavax$2e$xml$2e$soap$2e$SOAPElement_Serializer;
    private static final QName ns2_null_handling_QNAME = new QName("http://xmlns.oracle.com/orawsv", "null_handling");
    private static final QName ns2_null_handling_TYPE_QNAME = new QName("http://xmlns.oracle.com/orawsv", "null_handling");
    private CombinedSerializer myns2_null_handling__Null_handling_LiteralSerializer;
    private static final QName ns2_max_rows_QNAME = new QName("http://xmlns.oracle.com/orawsv", "max_rows");
    private static final QName ns3_positiveInteger_TYPE_QNAME = SchemaConstants.QNAME_TYPE_POSITIVE_INTEGER;
    private CombinedSerializer myns3_positiveInteger__java_math_BigInteger_PositiveInteger_Serializer;
    private static final QName ns2_skip_rows_QNAME = new QName("http://xmlns.oracle.com/orawsv", "skip_rows");
    private static final QName ns2_pretty_print_QNAME = new QName("http://xmlns.oracle.com/orawsv", "pretty_print");
    private static final QName ns3_boolean_TYPE_QNAME = SchemaConstants.QNAME_TYPE_BOOLEAN;
    private CombinedSerializer myns3__boolean__java_lang_Boolean_Boolean_Serializer;
    private static final QName ns2_indentation_width_QNAME = new QName("http://xmlns.oracle.com/orawsv", "indentation_width");
    private static final QName ns2_rowset_tag_QNAME = new QName("http://xmlns.oracle.com/orawsv", "rowset_tag");
    private static final QName ns3_string_TYPE_QNAME = SchemaConstants.QNAME_TYPE_STRING;
    private CombinedSerializer myns3_string__java_lang_String_String_Serializer;
    private static final QName ns2_row_tag_QNAME = new QName("http://xmlns.oracle.com/orawsv", "row_tag");
    private static final QName ns2_item_tags_for_coll_QNAME = new QName("http://xmlns.oracle.com/orawsv", "item_tags_for_coll");
    
    public Query_LiteralSerializer(QName type) {
        this(type,  false);
    }
    
    public Query_LiteralSerializer(QName type, boolean encodeType) {
        super(type, true, encodeType);
        setSOAPVersion(SOAPVersion.SOAP_11);
    }
    
    public void initialize(InternalTypeMappingRegistry registry) throws Exception {
        myns2_query_text__Query_text_LiteralSerializer = (CombinedSerializer)registry.getSerializer("", xqueryws.proxy.Query_text.class, ns2_query_text_TYPE_QNAME);
        myns2_bind__Bind_LiteralSerializer = (CombinedSerializer)registry.getSerializer("", xqueryws.proxy.Bind.class, ns2_bind_TYPE_QNAME);
        ns2_bindObject_TYPE_QNAMEjavax$2e$xml$2e$soap$2e$SOAPElement_Serializer = (CombinedSerializer)registry.getSerializer("", javax.xml.soap.SOAPElement.class, ns2_bindObject_TYPE_QNAME);
        ns2_bindXML_TYPE_QNAMEjavax$2e$xml$2e$soap$2e$SOAPElement_Serializer = (CombinedSerializer)registry.getSerializer("", javax.xml.soap.SOAPElement.class, ns2_bindXML_TYPE_QNAME);
        myns2_null_handling__Null_handling_LiteralSerializer = (CombinedSerializer)registry.getSerializer("", xqueryws.proxy.Null_handling.class, ns2_null_handling_TYPE_QNAME);
        myns3_positiveInteger__java_math_BigInteger_PositiveInteger_Serializer = (CombinedSerializer)registry.getSerializer("", java.math.BigInteger.class, ns3_positiveInteger_TYPE_QNAME);
        myns3__boolean__java_lang_Boolean_Boolean_Serializer = (CombinedSerializer)registry.getSerializer("", java.lang.Boolean.class, ns3_boolean_TYPE_QNAME);
        myns3_string__java_lang_String_String_Serializer = (CombinedSerializer)registry.getSerializer("", java.lang.String.class, ns3_string_TYPE_QNAME);
    }
    
    public java.lang.Object doDeserialize(XMLReader reader,
        SOAPDeserializationContext context) throws Exception {
        xqueryws.proxy.Query instance = new xqueryws.proxy.Query();
        java.lang.Object member=null;
        QName elementName;
        List values;
        java.lang.Object value;
        
        reader.nextElementContent();
        java.util.HashSet requiredElements = new java.util.HashSet();
        requiredElements.add("query_text");
        for (int memberIndex = 0; memberIndex <12; memberIndex++) {
            elementName = reader.getName();
            if ( matchQName(elementName, ns2_query_text_QNAME) ) {
                myns2_query_text__Query_text_LiteralSerializer.setNullable( false );
                member = myns2_query_text__Query_text_LiteralSerializer.deserialize(ns2_query_text_QNAME, reader, context);
                requiredElements.remove("query_text");
                if (member == null) {
                    throw new DeserializationException("literal.unexpectedNull",DeserializationException.FAULT_CODE_CLIENT);
                }
                instance.setQuery_text((xqueryws.proxy.Query_text)member);
                context.setXmlFragmentWrapperName( null );
                reader.nextElementContent();
            }
            if ( matchQName(elementName, ns2_bind_QNAME) ) {
                myns2_bind__Bind_LiteralSerializer.setNullable( false );
                member = myns2_bind__Bind_LiteralSerializer.deserialize(ns2_bind_QNAME, reader, context);
                requiredElements.remove("bind");
                if (member == null) {
                    throw new DeserializationException("literal.unexpectedNull",DeserializationException.FAULT_CODE_CLIENT);
                }
                instance.setBind((xqueryws.proxy.Bind)member);
                context.setXmlFragmentWrapperName( null );
                reader.nextElementContent();
            }
            if ( matchQName(elementName, ns2_bindObject_QNAME) ) {
                context.setXmlFragmentWrapperName(  ns2_bindObject_QNAME );
                ns2_bindObject_TYPE_QNAMEjavax$2e$xml$2e$soap$2e$SOAPElement_Serializer.setNullable( false );
                member = ns2_bindObject_TYPE_QNAMEjavax$2e$xml$2e$soap$2e$SOAPElement_Serializer.deserialize(ns2_bindObject_QNAME, reader, context);
                requiredElements.remove("bindObject");
                if (member == null) {
                    throw new DeserializationException("literal.unexpectedNull",DeserializationException.FAULT_CODE_CLIENT);
                }
                instance.setBindObject((javax.xml.soap.SOAPElement)member);
                context.setXmlFragmentWrapperName( null );
                reader.nextElementContent();
            }
            if ( matchQName(elementName, ns2_bindXML_QNAME) ) {
                context.setXmlFragmentWrapperName(  ns2_bindXML_QNAME );
                ns2_bindXML_TYPE_QNAMEjavax$2e$xml$2e$soap$2e$SOAPElement_Serializer.setNullable( false );
                member = ns2_bindXML_TYPE_QNAMEjavax$2e$xml$2e$soap$2e$SOAPElement_Serializer.deserialize(ns2_bindXML_QNAME, reader, context);
                requiredElements.remove("bindXML");
                if (member == null) {
                    throw new DeserializationException("literal.unexpectedNull",DeserializationException.FAULT_CODE_CLIENT);
                }
                instance.setBindXML((javax.xml.soap.SOAPElement)member);
                context.setXmlFragmentWrapperName( null );
                reader.nextElementContent();
            }
            if ( matchQName(elementName, ns2_null_handling_QNAME) ) {
                myns2_null_handling__Null_handling_LiteralSerializer.setNullable( false );
                member = myns2_null_handling__Null_handling_LiteralSerializer.deserialize(ns2_null_handling_QNAME, reader, context);
                requiredElements.remove("null_handling");
                if (member == null) {
                    throw new DeserializationException("literal.unexpectedNull",DeserializationException.FAULT_CODE_CLIENT);
                }
                instance.setNull_handling((xqueryws.proxy.Null_handling)member);
                context.setXmlFragmentWrapperName( null );
                reader.nextElementContent();
            }
            if ( matchQName(elementName, ns2_max_rows_QNAME) ) {
                myns3_positiveInteger__java_math_BigInteger_PositiveInteger_Serializer.setNullable( false );
                member = myns3_positiveInteger__java_math_BigInteger_PositiveInteger_Serializer.deserialize(ns2_max_rows_QNAME, reader, context);
                requiredElements.remove("max_rows");
                if (member == null) {
                    throw new DeserializationException("literal.unexpectedNull",DeserializationException.FAULT_CODE_CLIENT);
                }
                instance.setMax_rows((java.math.BigInteger)member);
                context.setXmlFragmentWrapperName( null );
                reader.nextElementContent();
            }
            if ( matchQName(elementName, ns2_skip_rows_QNAME) ) {
                myns3_positiveInteger__java_math_BigInteger_PositiveInteger_Serializer.setNullable( false );
                member = myns3_positiveInteger__java_math_BigInteger_PositiveInteger_Serializer.deserialize(ns2_skip_rows_QNAME, reader, context);
                requiredElements.remove("skip_rows");
                if (member == null) {
                    throw new DeserializationException("literal.unexpectedNull",DeserializationException.FAULT_CODE_CLIENT);
                }
                instance.setSkip_rows((java.math.BigInteger)member);
                context.setXmlFragmentWrapperName( null );
                reader.nextElementContent();
            }
            if ( matchQName(elementName, ns2_pretty_print_QNAME) ) {
                myns3__boolean__java_lang_Boolean_Boolean_Serializer.setNullable( false );
                member = myns3__boolean__java_lang_Boolean_Boolean_Serializer.deserialize(ns2_pretty_print_QNAME, reader, context);
                requiredElements.remove("pretty_print");
                if (member == null) {
                    throw new DeserializationException("literal.unexpectedNull",DeserializationException.FAULT_CODE_CLIENT);
                }
                instance.setPretty_print((java.lang.Boolean)member);
                context.setXmlFragmentWrapperName( null );
                reader.nextElementContent();
            }
            if ( matchQName(elementName, ns2_indentation_width_QNAME) ) {
                myns3_positiveInteger__java_math_BigInteger_PositiveInteger_Serializer.setNullable( false );
                member = myns3_positiveInteger__java_math_BigInteger_PositiveInteger_Serializer.deserialize(ns2_indentation_width_QNAME, reader, context);
                requiredElements.remove("indentation_width");
                if (member == null) {
                    throw new DeserializationException("literal.unexpectedNull",DeserializationException.FAULT_CODE_CLIENT);
                }
                instance.setIndentation_width((java.math.BigInteger)member);
                context.setXmlFragmentWrapperName( null );
                reader.nextElementContent();
            }
            if ( matchQName(elementName, ns2_rowset_tag_QNAME) ) {
                myns3_string__java_lang_String_String_Serializer.setNullable( false );
                member = myns3_string__java_lang_String_String_Serializer.deserialize(ns2_rowset_tag_QNAME, reader, context);
                requiredElements.remove("rowset_tag");
                if (member == null) {
                    throw new DeserializationException("literal.unexpectedNull",DeserializationException.FAULT_CODE_CLIENT);
                }
                instance.setRowset_tag((java.lang.String)member);
                context.setXmlFragmentWrapperName( null );
                reader.nextElementContent();
            }
            if ( matchQName(elementName, ns2_row_tag_QNAME) ) {
                myns3_string__java_lang_String_String_Serializer.setNullable( false );
                member = myns3_string__java_lang_String_String_Serializer.deserialize(ns2_row_tag_QNAME, reader, context);
                requiredElements.remove("row_tag");
                if (member == null) {
                    throw new DeserializationException("literal.unexpectedNull",DeserializationException.FAULT_CODE_CLIENT);
                }
                instance.setRow_tag((java.lang.String)member);
                context.setXmlFragmentWrapperName( null );
                reader.nextElementContent();
            }
            if ( matchQName(elementName, ns2_item_tags_for_coll_QNAME) ) {
                myns3__boolean__java_lang_Boolean_Boolean_Serializer.setNullable( false );
                member = myns3__boolean__java_lang_Boolean_Boolean_Serializer.deserialize(ns2_item_tags_for_coll_QNAME, reader, context);
                requiredElements.remove("item_tags_for_coll");
                if (member == null) {
                    throw new DeserializationException("literal.unexpectedNull",DeserializationException.FAULT_CODE_CLIENT);
                }
                instance.setItem_tags_for_coll((java.lang.Boolean)member);
                context.setXmlFragmentWrapperName( null );
                reader.nextElementContent();
            }
        }
        if (!requiredElements.isEmpty()) {
            throw new DeserializationException( "literal.expectedElementName" , requiredElements.iterator().next().toString(), DeserializationException.FAULT_CODE_CLIENT );
        }
        
        if( reader.getState() != XMLReader.END)
        {
            reader.skipElement();
        }
        XMLReaderUtil.verifyReaderState(reader, XMLReader.END);
        return (java.lang.Object)instance;
    }
    
    public void doSerializeAttributes(java.lang.Object obj, XMLWriter writer, SOAPSerializationContext context) throws Exception {
        xqueryws.proxy.Query instance = (xqueryws.proxy.Query)obj;
        
    }
    public void doSerializeAnyAttributes(java.lang.Object obj, XMLWriter writer, SOAPSerializationContext context) throws Exception {
        xqueryws.proxy.Query instance = (xqueryws.proxy.Query)obj;
        
    }
    public void doSerialize(java.lang.Object obj, XMLWriter writer, SOAPSerializationContext context) throws Exception {
        xqueryws.proxy.Query instance = (xqueryws.proxy.Query)obj;
        
        myns2_query_text__Query_text_LiteralSerializer.setNullable( false );
        myns2_query_text__Query_text_LiteralSerializer.serialize(instance.getQuery_text(), ns2_query_text_QNAME, null, writer, context);
        if (instance.getBind() != null) {
            myns2_bind__Bind_LiteralSerializer.setNullable( false );
            myns2_bind__Bind_LiteralSerializer.serialize(instance.getBind(), ns2_bind_QNAME, null, writer, context);
        }
        context.setXmlFragmentWrapperName( ns2_bindObject_QNAME );
        if (instance.getBindObject() != null) {
            ns2_bindObject_TYPE_QNAMEjavax$2e$xml$2e$soap$2e$SOAPElement_Serializer.setNullable( false );
            ns2_bindObject_TYPE_QNAMEjavax$2e$xml$2e$soap$2e$SOAPElement_Serializer.serialize(instance.getBindObject(), ns2_bindObject_QNAME, null, writer, context);
        }
        context.setXmlFragmentWrapperName( null );
        context.setXmlFragmentWrapperName( ns2_bindXML_QNAME );
        if (instance.getBindXML() != null) {
            ns2_bindXML_TYPE_QNAMEjavax$2e$xml$2e$soap$2e$SOAPElement_Serializer.setNullable( false );
            ns2_bindXML_TYPE_QNAMEjavax$2e$xml$2e$soap$2e$SOAPElement_Serializer.serialize(instance.getBindXML(), ns2_bindXML_QNAME, null, writer, context);
        }
        context.setXmlFragmentWrapperName( null );
        if (instance.getNull_handling() != null) {
            myns2_null_handling__Null_handling_LiteralSerializer.setNullable( false );
            myns2_null_handling__Null_handling_LiteralSerializer.serialize(instance.getNull_handling(), ns2_null_handling_QNAME, null, writer, context);
        }
        if (instance.getMax_rows() != null) {
            myns3_positiveInteger__java_math_BigInteger_PositiveInteger_Serializer.setNullable( false );
            myns3_positiveInteger__java_math_BigInteger_PositiveInteger_Serializer.serialize(instance.getMax_rows(), ns2_max_rows_QNAME, null, writer, context);
        }
        if (instance.getSkip_rows() != null) {
            myns3_positiveInteger__java_math_BigInteger_PositiveInteger_Serializer.setNullable( false );
            myns3_positiveInteger__java_math_BigInteger_PositiveInteger_Serializer.serialize(instance.getSkip_rows(), ns2_skip_rows_QNAME, null, writer, context);
        }
        if (instance.getPretty_print() != null) {
            myns3__boolean__java_lang_Boolean_Boolean_Serializer.setNullable( false );
            myns3__boolean__java_lang_Boolean_Boolean_Serializer.serialize(instance.getPretty_print(), ns2_pretty_print_QNAME, null, writer, context);
        }
        if (instance.getIndentation_width() != null) {
            myns3_positiveInteger__java_math_BigInteger_PositiveInteger_Serializer.setNullable( false );
            myns3_positiveInteger__java_math_BigInteger_PositiveInteger_Serializer.serialize(instance.getIndentation_width(), ns2_indentation_width_QNAME, null, writer, context);
        }
        if (instance.getRowset_tag() != null) {
            myns3_string__java_lang_String_String_Serializer.setNullable( false );
            myns3_string__java_lang_String_String_Serializer.serialize(instance.getRowset_tag(), ns2_rowset_tag_QNAME, null, writer, context);
        }
        if (instance.getRow_tag() != null) {
            myns3_string__java_lang_String_String_Serializer.setNullable( false );
            myns3_string__java_lang_String_String_Serializer.serialize(instance.getRow_tag(), ns2_row_tag_QNAME, null, writer, context);
        }
        if (instance.getItem_tags_for_coll() != null) {
            myns3__boolean__java_lang_Boolean_Boolean_Serializer.setNullable( false );
            myns3__boolean__java_lang_Boolean_Boolean_Serializer.serialize(instance.getItem_tags_for_coll(), ns2_item_tags_for_coll_QNAME, null, writer, context);
        }
    }
}
