## org.apache.axis.encoding
Interface SerializationContext

All Superinterfaces:
  SerializationContext

All Known Implementing Classes:
  SerializationContextImpl

public interface SerializationContext
extends SerializationContext

This interface describes the AXIS SerializationContext.

Method Summary
`java.lang.String` `attributeQName2String(QName qName)` Convert attribute QName to a string of the form <prefix>:<localpart> There are some special rules for attributes
`void` `endElement()` Writes the end element tag for the open element.
`Message` `getCurrentMessage()` Get the current message.
`QName` `getCurrentXMLType()` Get the currently prefered xmlType `* @return QName of xmlType or null
`boolean` `getDoMultiRefs()` Are we doing multirefs?
`MessageContext` `getMessageContext()` Get the MessageContext we're operating with
`java.lang.String` `getPrefixForURI(java.lang.String uri)` Get a prefix for a namespace URI.
`java.lang.String` `getPrefixForURI(java.lang.String uri, java.lang.String defaultPrefix)` Get a prefix for a namespace URI.
`boolean` `getPretty()` Get whether the serialization should be pretty printed.
`QName` `getQNameForClass(java.lang.Class cls)` Get the QName associated with the specified class.
`Serializer` `getSerializerForJavaType(java.lang.Class javaType)` Convenience method to get the Serializer for a specific java type
`TypeMapping` `getTypeMapping()` Get the TypeMapping we're using.
`TypeMappingRegistry` `getTypeMappingRegistry()` Get the TypeMappingRegistry we're using.
`java.lang.String` `getValueAsString(java.lang.Object value, QName xmlType)`
`boolean` `isPrimitive(java.lang.Object value)` Indicates whether the object should be interpretted as a primitive for the purposes of multi-ref processing.
`void` `outputMultiRefs()` The serialize method uses hrefs to reference all non-primitive values.
`java.lang.String` `qName2String(QName qName)` Convert QName to a string of the form <prefix>:<localpart>
`void` `registerPrefixForURI(java.lang.String prefix, java.lang.String uri)` Register prefix for the indicated uri
`void` `serialize(QName elemQName, org.xml.sax.Attributes attributes, java.lang.Object value)` Serialize the indicated value as an element with the name indicated by elemQName.
`void` `serialize(QName elemQName, org.xml.sax.Attributes attributes, java.lang.Object value, QName xmlType, boolean sendNull, java.lang.Boolean sendType)` Serialize the indicated value as an element with the name indicated by elemQName.
`void` `setDoMultiRefs(boolean shouldDo)` Set whether we are doing multirefs.
`void` `setPretty(boolean pretty)` Indicate whether the serialization should be pretty printed.
`void` `setSendDecl(boolean sendDecl)` Set whether or not we should write XML declarations.
`org.xml.sax.Attributes` `setTypeAttribute(org.xml.sax.Attributes attributes, QName type)` Obtains the type attribute that should be serialized and returns the new list of Attributes
`boolean` `shouldSendXSIType()` Get whether or not to write xsi:type attributes.
`void` `startElement(QName qName, org.xml.sax.Attributes attributes)` Writes (using the Writer) the start tag for element QName along with the indicated attributes and namespace mappings.
`void` `writeChars(char[] p1, int p2, int p3)` Convenience operation to write out (to Writer) the characters in p1 starting at index p2 for length p3.
`void` `writeDOMElement(org.w3c.dom.Element el)` Output a DOM representation to a SerializationContext
`void` `writeSafeString(java.lang.String string)` Convenience operation to write out (to Writer) the String properly encoded with xml entities (like &)
`void` `writeString(java.lang.String string)` Convenience operation to write out (to Writer) the String

Method Detail

### serialize

    public void serialize(QName elemQName,
                          org.xml.sax.Attributes attributes,
                          java.lang.Object value)
                   throws java.io.IOException

  Serialize the indicated value as an element with the name indicated by elemQName. The attributes are additional attribute to be serialized on the element. The value is the object being serialized. (It may be serialized directly or serialized as an mult-ref'd item) The value is an Object, which may be a wrapped primitive, the javaType is the actual unwrapped object type. The xmlType (if specified) is the QName of the type that is used to set xsi:type. If not specified, xsi:type is set by using the javaType to find an appopriate xmlType from the TypeMappingRegistry. The sendNull flag indicates whether null values should be sent over the wire (default is to send such values with xsi:nil="true"). The sendType flag indicates whether the xsi:type flag should be sent (default is true).

  Parameters:
    `elemQName` - is the QName of the element
    `attributes` - are additional attributes
    `value` - is the object to serialize
    `java.io.IOException`

### serialize

    public void serialize(QName elemQName,
                          org.xml.sax.Attributes attributes,
                          java.lang.Object value,
                          QName xmlType,
                          boolean sendNull,
                          java.lang.Boolean sendType)
                   throws java.io.IOException

  Serialize the indicated value as an element with the name indicated by elemQName. The attributes are additional attribute to be serialized on the element. The value is the object being serialized. (It may be serialized directly or serialized as an mult-ref'd item) The xmlType (if specified) is the QName of the type that is used to set xsi:type. The sendNull flag indicates whether null values should be sent over the wire (default is to send such values with xsi:nil="true"). The sendType flag indicates whether the xsi:type flag should be sent (default is true).

  Parameters:
    `elemQName` - is the QName of the element
    `attributes` - are additional attributes
    `value` - is the object to serialize
    `xmlType` - is the qname of the type or null. (default is null)
    `sendNull` - determines whether to send null values. (default is true)
    `sendType` - determines whether to set xsi:type attribute. (default is true)
    `java.io.IOException`

### setTypeAttribute

    public org.xml.sax.Attributes setTypeAttribute(org.xml.sax.Attributes attributes,
                                                   QName type)

  Obtains the type attribute that should be serialized and returns the new list of Attributes

  Parameters:
    `attributes` - of the qname
    `type` - is the qname of the type
  Returns:
    new list of Attributes

### getSerializerForJavaType

    public Serializer getSerializerForJavaType(java.lang.Class javaType)

  Convenience method to get the Serializer for a specific java type

  Parameters:
    `javaType` - is Class for a type to serialize
  Returns:
    Serializer

### getPretty

    public boolean getPretty()

  Get whether the serialization should be pretty printed.

  Returns:
    true/false

### setPretty

    public void setPretty(boolean pretty)

  Indicate whether the serialization should be pretty printed.

  Parameters:
    `pretty` - true/false

### getDoMultiRefs

    public boolean getDoMultiRefs()

  Are we doing multirefs?

  Returns:
    true or false

### setDoMultiRefs

    public void setDoMultiRefs(boolean shouldDo)

  Set whether we are doing multirefs.

  Parameters:
    `shouldDo` - true/false

### setSendDecl

    public void setSendDecl(boolean sendDecl)

  Set whether or not we should write XML declarations.

  Parameters:
    `sendDecl` - true/false

### shouldSendXSIType

    public boolean shouldSendXSIType()

  Get whether or not to write xsi:type attributes.

  Returns:
    true/false

### getTypeMapping

    public TypeMapping getTypeMapping()

  Get the TypeMapping we're using.

  Returns:
    TypeMapping or null

### getTypeMappingRegistry

    public TypeMappingRegistry getTypeMappingRegistry()

  Get the TypeMappingRegistry we're using.

  Returns:
    TypeMapping or null

### getPrefixForURI

    public java.lang.String getPrefixForURI(java.lang.String uri)

  Get a prefix for a namespace URI. This method will ALWAYS return a valid prefix - if the given URI is already mapped in this serialization, we return the previous prefix. If it is not mapped, we will add a new mapping and return a generated prefix of the form "ns<num>".

  Parameters:
    `uri` - is the namespace uri
  Returns:
    prefix

### getPrefixForURI

    public java.lang.String getPrefixForURI(java.lang.String uri,
                                            java.lang.String defaultPrefix)

  Get a prefix for a namespace URI. This method will ALWAYS return a valid prefix - if the given URI is already mapped in this serialization, we return the previous prefix. If it is not mapped, we will add a new mapping and return a generated prefix of the form "ns<num>".

  Parameters:
    `uri` - is the namespace uri
    `defaultPrefix` - optional parameter which is the default prefix
  Returns:
    prefix

### registerPrefixForURI

    public void registerPrefixForURI(java.lang.String prefix,
                                     java.lang.String uri)

  Register prefix for the indicated uri

  Parameters:
    `prefix` -
    `uri` - is the namespace uri

### getCurrentMessage

    public Message getCurrentMessage()

  Get the current message.

  Returns:
    Message

### getMessageContext

    public MessageContext getMessageContext()

  Get the MessageContext we're operating with

### qName2String

    public java.lang.String qName2String(QName qName)

  Convert QName to a string of the form <prefix>:<localpart>

  Parameters:
    `qName` -
  Returns:
    prefixed qname representation for serialization.

### attributeQName2String

    public java.lang.String attributeQName2String(QName qName)

  Convert attribute QName to a string of the form <prefix>:<localpart> There are some special rules for attributes

  Parameters:
    `qName` -
  Returns:
    prefixed qname representation for serialization.

### getQNameForClass

    public QName getQNameForClass(java.lang.Class cls)

  Get the QName associated with the specified class.

  Parameters:
    `cls` - Class of an object requiring serialization.
  Returns:
    appropriate QName associated with the class.

### isPrimitive

    public boolean isPrimitive(java.lang.Object value)

  Indicates whether the object should be interpretted as a primitive for the purposes of multi-ref processing. A primitive value is serialized directly instead of using id/href pairs. Thus primitive serialization/deserialization is slightly faster.

  Parameters:
    `value` - to be serialized
  Returns:
    true/false

### outputMultiRefs

    public void outputMultiRefs()
                         throws java.io.IOException

  The serialize method uses hrefs to reference all non-primitive values. These values are stored and serialized by calling outputMultiRefs after the serialize method completes.

    `java.io.IOException`

### startElement

    public void startElement(QName qName,
                             org.xml.sax.Attributes attributes)
                      throws java.io.IOException

  Writes (using the Writer) the start tag for element QName along with the indicated attributes and namespace mappings.

  Parameters:
    `qName` - is the name of the element
    `attributes` - are the attributes to write
    `java.io.IOException`

### endElement

    public void endElement()
                    throws java.io.IOException

  Writes the end element tag for the open element.

    `java.io.IOException`

### writeChars

    public void writeChars(char[] p1,
                           int p2,
                           int p3)
                    throws java.io.IOException

  Convenience operation to write out (to Writer) the characters in p1 starting at index p2 for length p3.

  Parameters:
    `p1` - character array to write
    `p2` - starting index in array
    `p3` - length to write
    `java.io.IOException`

### writeString

    public void writeString(java.lang.String string)
                     throws java.io.IOException

  Convenience operation to write out (to Writer) the String

  Parameters:
    `string` - is the String to write.
    `java.io.IOException`

### writeSafeString

    public void writeSafeString(java.lang.String string)
                         throws java.io.IOException

  Convenience operation to write out (to Writer) the String properly encoded with xml entities (like &)

  Parameters:
    `string` - is the String to write.
    `java.io.IOException`

### writeDOMElement

    public void writeDOMElement(org.w3c.dom.Element el)
                         throws java.io.IOException

  Output a DOM representation to a SerializationContext

  Parameters:
    `el` - is a DOM Element
    `java.io.IOException`

### getValueAsString

    public java.lang.String getValueAsString(java.lang.Object value,
                                             QName xmlType)
                                      throws java.io.IOException

    `java.io.IOException`

### getCurrentXMLType

    public QName getCurrentXMLType()

  Get the currently prefered xmlType `* @return QName of xmlType or null

Copyright © 2003 Apache Web Services Project. All Rights Reserved.