Package org.apache.axis.encoding.ser
Class SimpleDeserializer
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- org.apache.axis.message.SOAPHandler
-
- org.apache.axis.encoding.DeserializerImpl
-
- org.apache.axis.encoding.ser.SimpleDeserializer
-
- All Implemented Interfaces:
java.io.Serializable
,Deserializer
,Callback
,Deserializer
,org.xml.sax.ContentHandler
,org.xml.sax.DTDHandler
,org.xml.sax.EntityResolver
,org.xml.sax.ErrorHandler
- Direct Known Subclasses:
Base64Deserializer
,CalendarDeserializer
,DateDeserializer
,EnumDeserializer
,HexDeserializer
,QNameDeserializer
,SimpleListDeserializer
,TimeDeserializer
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@apache.org), Sam Ruby (rubys@us.ibm.com) Modified for JAX-RPC @author Rich Scheuerle (scheu@us.ibm.com)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected SimpleDeserializer
cacheStringDSer
protected QName
cacheXMLType
protected DeserializationContext
context
java.lang.Class
javaType
static java.lang.Class[]
STRING_CLASS
QName
xmlType
-
Fields inherited from class org.apache.axis.encoding.DeserializerImpl
componentsReadyFlag, defaultType, id, isEnded, isHref, isNil, log, targets, value
-
Fields inherited from class org.apache.axis.message.SOAPHandler
myElement
-
-
Constructor Summary
Constructors Constructor Description SimpleDeserializer(java.lang.Class javaType, QName xmlType)
The Deserializer is constructed with the xmlType and javaType (which could be a java primitive like int.class)SimpleDeserializer(java.lang.Class javaType, QName xmlType, TypeDesc typeDesc)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
characters(char[] chars, int start, int end)
Append any characters received to the value.java.lang.Object
makeValue(java.lang.String source)
Convert the string that has been accumulated into an Object.void
onEndElement(java.lang.String namespace, java.lang.String localName, DeserializationContext context)
Append any characters to the value.SOAPHandler
onStartChild(java.lang.String namespace, java.lang.String localName, java.lang.String prefix, org.xml.sax.Attributes attributes, DeserializationContext context)
There should not be nested elements, so thow and exception if this occurs.void
onStartElement(java.lang.String namespace, java.lang.String localName, java.lang.String prefix, org.xml.sax.Attributes attributes, DeserializationContext context)
Set the bean properties that correspond to element attributes.void
reset()
Reset deserializer for re-usevoid
setConstructor(java.lang.reflect.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, removeValueTargets, 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
-
-
-
-
Field Detail
-
STRING_CLASS
public static final java.lang.Class[] STRING_CLASS
-
xmlType
public QName xmlType
-
javaType
public java.lang.Class javaType
-
context
protected DeserializationContext context
-
cacheStringDSer
protected SimpleDeserializer cacheStringDSer
-
cacheXMLType
protected QName cacheXMLType
-
-
Constructor Detail
-
SimpleDeserializer
public SimpleDeserializer(java.lang.Class javaType, QName xmlType)
The Deserializer is constructed with the xmlType and javaType (which could be a java primitive like int.class)
-
-
Method Detail
-
reset
public void reset()
Reset deserializer for re-use
-
setConstructor
public void setConstructor(java.lang.reflect.Constructor c)
The Factory calls setConstructor.
-
onStartChild
public SOAPHandler onStartChild(java.lang.String namespace, java.lang.String localName, java.lang.String prefix, org.xml.sax.Attributes attributes, DeserializationContext context) throws org.xml.sax.SAXException
There should not be nested elements, so thow and exception if this occurs.- Specified by:
onStartChild
in interfaceDeserializer
- Overrides:
onStartChild
in classDeserializerImpl
- Parameters:
namespace
- is the namespace of the child elementlocalName
- is the local name of the child elementprefix
- is the prefix used on the name of the child elementattributes
- are the attributes of the child elementcontext
- 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:
org.xml.sax.SAXException
-
characters
public void characters(char[] chars, int start, int end) throws org.xml.sax.SAXException
Append any characters received to the value. This method is defined by Deserializer.- Specified by:
characters
in interfaceorg.xml.sax.ContentHandler
- Overrides:
characters
in classSOAPHandler
- Throws:
org.xml.sax.SAXException
-
onEndElement
public void onEndElement(java.lang.String namespace, java.lang.String localName, DeserializationContext context) throws org.xml.sax.SAXException
Append any characters to the value. This method is defined by Deserializer.- Specified by:
onEndElement
in interfaceDeserializer
- Overrides:
onEndElement
in classDeserializerImpl
- Parameters:
namespace
- is the namespace of the child elementlocalName
- is the local name of the child elementcontext
- is the deserialization context- Throws:
org.xml.sax.SAXException
-
makeValue
public java.lang.Object makeValue(java.lang.String source) throws java.lang.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:
java.lang.Exception
- any exception thrown by this method will be wrapped
-
onStartElement
public void onStartElement(java.lang.String namespace, java.lang.String localName, java.lang.String prefix, org.xml.sax.Attributes attributes, DeserializationContext context) throws org.xml.sax.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 interfaceDeserializer
- Overrides:
onStartElement
in classDeserializerImpl
- Parameters:
namespace
- is the namespace of the elementlocalName
- is the name of the elementprefix
- is the prefix of the elementattributes
- are the attributes on the element...used to get the typecontext
- is the DeserializationContext- Throws:
org.xml.sax.SAXException
-
-