com.flat502.rox.marshal.xmlrpc
Class DomUnmarshaller

java.lang.Object
  extended by com.flat502.rox.marshal.xmlrpc.XmlRpcMethodUnmarshaller
      extended by com.flat502.rox.marshal.xmlrpc.DomUnmarshaller
All Implemented Interfaces:
MethodUnmarshaller, XmlRpcConstants
Direct Known Subclasses:
DomMethodCallUnmarshaller

public class DomUnmarshaller
extends XmlRpcMethodUnmarshaller

Abstract base class containing common unmarshalling logic for the DOM based unmarshaller.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.flat502.rox.marshal.xmlrpc.XmlRpcConstants
XmlRpcConstants.ContentTypes, XmlRpcConstants.Formats, XmlRpcConstants.Tags, XmlRpcConstants.Types
 
Constructor Summary
protected DomUnmarshaller(FieldNameCodec fieldNameCodec)
          Centralizes common initialization.
 
Method Summary
protected  void expectTag(XmlNode node, java.lang.String expected)
          Assert that the given node is named as expected.
protected  XmlNode parse(java.io.Reader in)
           
protected  java.lang.Object parseArrayData(XmlNode data, java.lang.Class structClass, UnmarshallerAid aid)
           
protected  java.lang.String parseMemberName(XmlNode name)
           
protected  XmlRpcMethodResponse parseMethodResponse(XmlNode node, MethodResponseUnmarshallerAid aid)
           
protected  java.lang.Object parseParam(XmlNode node, java.lang.Class structClass, UnmarshallerAid aid)
           
protected  java.lang.Object parseStruct(XmlNode struct, java.lang.Object structObject, UnmarshallerAid aid)
           
protected  java.lang.Object parseStruct(XmlNode struct, UnmarshallerAid aid)
           
protected  java.lang.Object parseUnknownType(java.lang.String typeName, java.lang.String typeValue)
           
protected  java.lang.Object parseValue(XmlNode value, java.lang.Class structClass, UnmarshallerAid aid)
          Called to parse an XML-RPC <value> tag.
protected  java.lang.Object parseValue(XmlNode value, UnmarshallerAid aid)
           
 
Methods inherited from class com.flat502.rox.marshal.xmlrpc.XmlRpcMethodUnmarshaller
decodeFieldName, getDateFormat, getDefaultFieldNameCodec, getFieldNameCodec, getStructMemberType, newDateFormat, newStructObject, parseBase64, parseBoolean, parseDate, parseDouble, parseEnum, parseInt, parseString, parseString, setObjectMember
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DomUnmarshaller

protected DomUnmarshaller(FieldNameCodec fieldNameCodec)
Centralizes common initialization.

This constructor calls XmlRpcMethodUnmarshaller.newDateFormat() to initialize the underlying date formatter.

Parameters:
fieldNameCodec - An implementation of FieldNameCodec used when struct members are unmarshalled. May be null.
Method Detail

parse

protected XmlNode parse(java.io.Reader in)
                 throws java.lang.Exception
Throws:
java.lang.Exception

expectTag

protected void expectTag(XmlNode node,
                         java.lang.String expected)
                  throws MarshallingException
Assert that the given node is named as expected.

Parameters:
node - The node to check.
expected - The expected name.
Throws:
MarshallingException - If the assertion fails.

parseParam

protected java.lang.Object parseParam(XmlNode node,
                                      java.lang.Class structClass,
                                      UnmarshallerAid aid)
                               throws MarshallingException
Throws:
MarshallingException

parseValue

protected java.lang.Object parseValue(XmlNode value,
                                      UnmarshallerAid aid)
                               throws MarshallingException
Throws:
MarshallingException

parseValue

protected java.lang.Object parseValue(XmlNode value,
                                      java.lang.Class structClass,
                                      UnmarshallerAid aid)
                               throws MarshallingException
Called to parse an XML-RPC <value> tag.

If the current XML-RPC value is a struct and structClass is any concrete implementation of Map, then values are stored using Map.put(Object, Object). If structClass is not a map it is initialized by mapping the struct members onto public fields and accessor methods.

Parameters:
value - The root of the XML-RPC value sub-document.
structClass - The Class to instantiate if this value is a struct.
Returns:
An Object representing the value within the XML sub-document rooted at value.
Throws:
MarshallingException - If the XML document is malformed or an error occurs unmarshalling the current value or a member value (in the case of complex structures).

parseUnknownType

protected java.lang.Object parseUnknownType(java.lang.String typeName,
                                            java.lang.String typeValue)
                                     throws MarshallingException
Throws:
MarshallingException

parseStruct

protected java.lang.Object parseStruct(XmlNode struct,
                                       UnmarshallerAid aid)
                                throws MarshallingException
Throws:
MarshallingException

parseStruct

protected java.lang.Object parseStruct(XmlNode struct,
                                       java.lang.Object structObject,
                                       UnmarshallerAid aid)
                                throws MarshallingException
Throws:
MarshallingException

parseMemberName

protected java.lang.String parseMemberName(XmlNode name)
                                    throws MarshallingException
Throws:
MarshallingException

parseArrayData

protected java.lang.Object parseArrayData(XmlNode data,
                                          java.lang.Class structClass,
                                          UnmarshallerAid aid)
                                   throws MarshallingException
Throws:
MarshallingException

parseMethodResponse

protected XmlRpcMethodResponse parseMethodResponse(XmlNode node,
                                                   MethodResponseUnmarshallerAid aid)
                                            throws MarshallingException
Throws:
MarshallingException