站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 3.2.7 jaxrpc API Documentation 英文版文档

SimpleDeserializer (JAXRPC API) - JBoss 3.2.7 jaxrpc API Documentation 英文版文档


org.apache.axis.encoding.ser
Class SimpleDeserializer

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended byorg.apache.axis.message.SOAPHandler
          extended byorg.apache.axis.encoding.DeserializerImpl
              extended byorg.apache.axis.encoding.ser.SimpleDeserializer
All Implemented Interfaces:
Callback, ContentHandler, javax.xml.rpc.encoding.Deserializer, Deserializer, DTDHandler, EntityResolver, ErrorHandler, Serializable
Direct Known Subclasses:
CalendarDeserializer, DateDeserializer, EnumDeserializer, QNameDeserializer

public class SimpleDeserializer
extends DeserializerImpl

A deserializer for any simple type with a (String) constructor. Note: this class is designed so that subclasses need only override the makeValue method in order to construct objects of their own type.

Author:
Glen Daniels (gdaniels@macromedia.com), Sam Ruby (rubys@us.ibm.com) Modified for JAX-RPC @author Rich Scheuerle (scheu@us.ibm.com)
See Also:
Serialized Form

Field Summary
protected  SimpleDeserializer cacheStringDSer
           
protected  javax.xml.namespace.QName cacheXMLType
           
 Class javaType
           
 javax.xml.namespace.QName xmlType
           
 
Fields inherited from class org.apache.axis.encoding.DeserializerImpl
defaultType, id, isEnded, isHref, isNil, targets, value
 
Fields inherited from class org.apache.axis.message.SOAPHandler
myElement
 
Constructor Summary
SimpleDeserializer(Class javaType, javax.xml.namespace.QName xmlType)
          The Deserializer is constructed with the xmlType and javaType (which could be a java primitive like int.class)
SimpleDeserializer(Class javaType, javax.xml.namespace.QName xmlType, TypeDesc typeDesc)
           
 
Method Summary
 void characters(char[] chars, int start, int end)
          Append any characters received to the value.
 Object makeValue(String source)
          Convert the string that has been accumulated into an Object.
 void onEndElement(String namespace, String localName, DeserializationContext context)
          Append any characters to the value.
 SOAPHandler onStartChild(String namespace, String localName, String prefix, Attributes attributes, DeserializationContext context)
          There should not be nested elements, so thow and exception if this occurs.
 void onStartElement(String namespace, String localName, String prefix, Attributes attributes, DeserializationContext context)
          Set the bean properties that correspond to element attributes.
 void removeValueTargets()
          Remove the Value Targets of the Deserializer.
 void reset()
          Reset deserializer for re-use
 void setConstructor(Constructor c)
          The Factory calls setConstructor.
 
Methods inherited from class org.apache.axis.encoding.DeserializerImpl
addChildDeserializer, componentsReady, endElement, getDefaultType, getMechanismType, getValue, getValue, getValueTargets, moveValueTargets, registerValueTarget, setChildValue, setDefaultType, setValue, setValue, startElement, valueComplete
 
Methods inherited from class org.apache.axis.message.SOAPHandler
makeNewElement, onEndChild
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xmlType

public javax.xml.namespace.QName xmlType

javaType

public Class javaType

cacheStringDSer

protected SimpleDeserializer cacheStringDSer

cacheXMLType

protected javax.xml.namespace.QName cacheXMLType
Constructor Detail

SimpleDeserializer

public SimpleDeserializer(Class javaType,
                          javax.xml.namespace.QName xmlType)
The Deserializer is constructed with the xmlType and javaType (which could be a java primitive like int.class)


SimpleDeserializer

public SimpleDeserializer(Class javaType,
                          javax.xml.namespace.QName xmlType,
                          TypeDesc typeDesc)
Method Detail

reset

public void reset()
Reset deserializer for re-use


removeValueTargets

public void removeValueTargets()
Remove the Value Targets of the Deserializer. Simple deserializers may be re-used, so don't nullify the vector.

Specified by:
removeValueTargets in interface Deserializer
Overrides:
removeValueTargets in class DeserializerImpl

setConstructor

public void setConstructor(Constructor c)
The Factory calls setConstructor.


onStartChild

public SOAPHandler onStartChild(String namespace,
                                String localName,
                                String prefix,
                                Attributes attributes,
                                DeserializationContext context)
                         throws SAXException
There should not be nested elements, so thow and exception if this occurs.

Specified by:
onStartChild in interface Deserializer
Overrides:
onStartChild in class DeserializerImpl
Parameters:
namespace - is the namespace of the child element
localName - is the local name of the child element
prefix - is the prefix used on the name of the child element
attributes - are the attributes of the child element
context - is the deserialization context.
Returns:
is a Deserializer to use to deserialize a child (must be a derived class of SOAPHandler) or null if no deserialization should be performed.
Throws:
SAXException

characters

public void characters(char[] chars,
                       int start,
                       int end)
                throws SAXException
Append any characters received to the value. This method is defined by Deserializer.

Throws:
SAXException

onEndElement

public void onEndElement(String namespace,
                         String localName,
                         DeserializationContext context)
                  throws SAXException
Append any characters to the value. This method is defined by Deserializer.

Specified by:
onEndElement in interface Deserializer
Overrides:
onEndElement in class DeserializerImpl
Parameters:
namespace - is the namespace of the child element
localName - is the local name of the child element
context - is the deserialization context
Throws:
SAXException

makeValue

public Object makeValue(String source)
                 throws Exception
Convert the string that has been accumulated into an Object. Subclasses may override this. Note that if the javaType is a primitive, the returned object is a wrapper class.

Parameters:
source - the serialized value to be deserialized
Throws:
Exception - any exception thrown by this method will be wrapped

onStartElement

public void onStartElement(String namespace,
                           String localName,
                           String prefix,
                           Attributes attributes,
                           DeserializationContext context)
                    throws SAXException
Set the bean properties that correspond to element attributes.

This method is invoked after startElement when the element requires deserialization (i.e. the element is not an href and the value is not nil.)

Specified by:
onStartElement in interface Deserializer
Overrides:
onStartElement in class DeserializerImpl
Parameters:
namespace - is the namespace of the element
localName - is the name of the element
prefix - is the prefix of the element
attributes - are the attributes on the element...used to get the type
context - is the DeserializationContext
Throws:
SAXException


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.