org.apache.axis.encoding
Class BeanSerializer
java.lang.Object
|
+--org.xml.sax.helpers.DefaultHandler
|
+--org.apache.axis.message.SOAPHandler
|
+--org.apache.axis.encoding.Deserializer
|
+--org.apache.axis.encoding.BeanSerializer
- All Implemented Interfaces:
- org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, java.io.Serializable, Serializer
- public class BeanSerializer
- extends Deserializer
- implements Serializer, java.io.Serializable
General purpose serializer/deserializerFactory for an arbitrary java bean.
- Author:
- Sam Ruby
- See Also:
- Serialized Form
Method Summary |
static DeserializerFactory |
getFactory()
|
protected java.beans.PropertyDescriptor[] |
getPd()
|
protected java.beans.PropertyDescriptor[] |
getPd(java.lang.Object val)
|
protected static boolean |
isEnumClass(java.lang.Class cls)
Determine if the class is a JAX-RPC enum class. |
SOAPHandler |
onStartChild(java.lang.String namespace,
java.lang.String localName,
java.lang.String prefix,
org.xml.sax.Attributes attributes,
DeserializationContext context)
Deserializer interface called on each child element encountered in
the XML stream. |
void |
serialize(QName name,
org.xml.sax.Attributes attributes,
java.lang.Object value,
SerializationContext context)
Serialize a bean. |
protected void |
setCls(java.lang.Class cls)
|
protected void |
setPd(java.beans.PropertyDescriptor[] pd)
|
protected static java.beans.PropertyDescriptor[] |
sortPropertyDescriptors(java.beans.PropertyDescriptor[] oldPd,
java.lang.Class cls)
This method attempts to sort the property descriptors to match the
order defined in the class. |
Methods inherited from class org.apache.axis.encoding.Deserializer |
copyValueTargets, endElement, getValue, onEndElement, onStartElement, registerCallback, registerValueTarget, registerValueTarget, setValue, startElement, valueComplete |
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
characters, 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 |
BeanSerializer
public BeanSerializer()
- Default constructor.
BeanSerializer
public BeanSerializer(java.lang.Class cls)
- Constructor that takes a class. Provided only for convenience.
Equivalent to calling setCls(cls) on a new instance.
setCls
protected void setCls(java.lang.Class cls)
getPd
protected java.beans.PropertyDescriptor[] getPd()
sortPropertyDescriptors
protected static java.beans.PropertyDescriptor[] sortPropertyDescriptors(java.beans.PropertyDescriptor[] oldPd,
java.lang.Class cls)
- This method attempts to sort the property descriptors to match the
order defined in the class. This is necessary to support
xsd:sequence processing, which means that the serialized order of
properties must match the xml element order. (This method assumes that the
order of the set methods matches the xml element order...the emitter
will always order the set methods according to the xml order.)
getPd
protected java.beans.PropertyDescriptor[] getPd(java.lang.Object val)
setPd
protected void setPd(java.beans.PropertyDescriptor[] pd)
isEnumClass
protected static boolean isEnumClass(java.lang.Class cls)
- Determine if the class is a JAX-RPC enum class.
An enumeration class is recognized by
a getValue() method, a fromValue(type) method and the lack
of a setValue(type) method
getFactory
public static DeserializerFactory getFactory()
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
- Deserializer interface called on each child element encountered in
the XML stream.
- Overrides:
onStartChild
in class Deserializer
serialize
public void serialize(QName name,
org.xml.sax.Attributes attributes,
java.lang.Object value,
SerializationContext context)
throws java.io.IOException
- Serialize a bean. Done simply by serializing each bean property.
- Specified by:
serialize
in interface Serializer
Copyright © 2001 Apache XML Project. All Rights Reserved.