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:
Serializable
,Deserializer
,Callback
,Deserializer
,ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
- Direct Known Subclasses:
Base64Deserializer
,CalendarDeserializer
,DateDeserializer
,EnumDeserializer
,HexDeserializer
,QNameDeserializer
,SimpleListDeserializer
,TimeDeserializer
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SimpleDeserializer
protected QName
protected DeserializationContext
static final Class[]
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
ConstructorsConstructorDescriptionSimpleDeserializer
(Class javaType, QName xmlType) The Deserializer is constructed with the xmlType and javaType (which could be a java primitive like int.class)SimpleDeserializer
(Class javaType, QName xmlType, TypeDesc typeDesc) -
Method Summary
Modifier and TypeMethodDescriptionvoid
characters
(char[] chars, int start, int end) Append any characters received to the value.Convert the string that has been accumulated into an Object.void
onEndElement
(String namespace, String localName, DeserializationContext context) Append any characters to the value.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
reset()
Reset deserializer for re-usevoid
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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.xml.sax.ContentHandler
declaration
-
Field Details
-
STRING_CLASS
-
xmlType
-
javaType
-
context
-
cacheStringDSer
-
cacheXMLType
-
-
Constructor Details
-
SimpleDeserializer
The Deserializer is constructed with the xmlType and javaType (which could be a java primitive like int.class) -
SimpleDeserializer
-
-
Method Details
-
reset
public void reset()Reset deserializer for re-use -
setConstructor
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 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:
SAXException
-
characters
Append any characters received to the value. This method is defined by Deserializer.- Specified by:
characters
in interfaceContentHandler
- Overrides:
characters
in classSOAPHandler
- 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 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:
SAXException
-
makeValue
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 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:
SAXException
-