com.flat502.rox.marshal.xmlrpc
Class XmlRpcMethodUnmarshaller

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

public abstract class XmlRpcMethodUnmarshaller
extends java.lang.Object
implements MethodUnmarshaller, XmlRpcConstants


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
XmlRpcMethodUnmarshaller()
           
XmlRpcMethodUnmarshaller(FieldNameCodec fieldNameCodec)
           
 
Method Summary
protected  java.lang.String decodeFieldName(java.lang.String name)
          Determine an Object field name from the name of an XML-RPC struct member.
protected  java.text.DateFormat getDateFormat()
           
 FieldNameCodec getDefaultFieldNameCodec()
          This method is invoked when no specific FieldNameCodec exists.
protected  FieldNameCodec getFieldNameCodec()
           
protected  java.lang.Class getStructMemberType(java.lang.Object structObject, java.lang.String name)
           
protected  java.text.DateFormat newDateFormat()
           
protected  java.lang.Object newStructObject(java.lang.Class structClass)
           
protected  java.lang.Object parseBase64(java.lang.String value)
           
protected  java.lang.Object parseBoolean(java.lang.String value)
           
protected  java.lang.Object parseDate(java.lang.String value)
           
protected  java.lang.Object parseDouble(java.lang.String value)
           
protected  java.lang.Object parseEnum(java.lang.String value, java.lang.Class structClass)
           
protected  java.lang.Object parseInt(java.lang.String value)
           
protected  java.lang.Object parseString(java.lang.String value)
           
protected  java.lang.Object parseString(java.lang.String value, java.lang.Class structClass)
           
protected  void setObjectMember(java.lang.Object structObject, java.lang.String name, java.lang.Object value, UnmarshallerAid aid)
          Called when unmarshalling an XML-RPC struct as an instance of something other than Map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlRpcMethodUnmarshaller

public XmlRpcMethodUnmarshaller()

XmlRpcMethodUnmarshaller

public XmlRpcMethodUnmarshaller(FieldNameCodec fieldNameCodec)
Method Detail

getFieldNameCodec

protected FieldNameCodec getFieldNameCodec()

getDefaultFieldNameCodec

public FieldNameCodec getDefaultFieldNameCodec()
Description copied from interface: MethodUnmarshaller
This method is invoked when no specific FieldNameCodec exists.

For client implementations this typically means no codec has been set on the client.

For server implementations this typically means UnmarshallerAid.getFieldNameCodec(String) has returned null.

Specified by:
getDefaultFieldNameCodec in interface MethodUnmarshaller
Returns:
the default codec associated with this unmarshaller.

getDateFormat

protected java.text.DateFormat getDateFormat()

newDateFormat

protected java.text.DateFormat newDateFormat()

parseInt

protected java.lang.Object parseInt(java.lang.String value)
                             throws MarshallingException
Throws:
MarshallingException

parseBoolean

protected java.lang.Object parseBoolean(java.lang.String value)
                                 throws MarshallingException
Throws:
MarshallingException

parseString

protected java.lang.Object parseString(java.lang.String value,
                                       java.lang.Class structClass)
                                throws MarshallingException
Throws:
MarshallingException

parseString

protected java.lang.Object parseString(java.lang.String value)

parseDouble

protected java.lang.Object parseDouble(java.lang.String value)
                                throws MarshallingException
Throws:
MarshallingException

parseDate

protected java.lang.Object parseDate(java.lang.String value)
                              throws MarshallingException
Throws:
MarshallingException

parseBase64

protected java.lang.Object parseBase64(java.lang.String value)

parseEnum

protected java.lang.Object parseEnum(java.lang.String value,
                                     java.lang.Class structClass)
                              throws MarshallingException
Throws:
MarshallingException

newStructObject

protected java.lang.Object newStructObject(java.lang.Class structClass)
                                    throws MarshallingException
Throws:
MarshallingException

decodeFieldName

protected java.lang.String decodeFieldName(java.lang.String name)
Determine an Object field name from the name of an XML-RPC struct member.

The default implementation defers to the FieldNameEncoder this instance was initialized with.

Parameters:
name - The XML-RPC struct member name.
Returns:
The name of the field the associated value should be assigned to.

getStructMemberType

protected java.lang.Class getStructMemberType(java.lang.Object structObject,
                                              java.lang.String name)
                                       throws MarshallingException
Throws:
MarshallingException

setObjectMember

protected void setObjectMember(java.lang.Object structObject,
                               java.lang.String name,
                               java.lang.Object value,
                               UnmarshallerAid aid)
                        throws MarshallingException
Called when unmarshalling an XML-RPC struct as an instance of something other than Map.

This method begins by attempting to locate a public field with a name that is determined by passing the XML-RPC struct member name to decodeFieldName(String).

If a field is found it's value is set. Mappings are as defined under this class's description. The following limited conversions are performed if required:

All other coercion is as per Field.set(java.lang.Object, java.lang.Object).

If an appropriate field is not found, an attempt is made to locate a public setter method with a name that is determined using JavaBean introspection (see Introspector).

If a setter method is found it is invoked with the value. Mapping and coercion is as for direct field initialization.

Parameters:
structObject - The object the XML-RPC struct is being unmarshalled as.
name - The name of the XML-RPC member.
value - The value of the XML-RPC member.
Throws:
MarshallingException