|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.flat502.rox.marshal.UnmarshallerAid com.flat502.rox.marshal.MethodCallUnmarshallerAid com.flat502.rox.server.RpcMethodProxy
public abstract class RpcMethodProxy
This class dynamically proxies a plain old Java object (POJO) by mapping RPC method calls onto methods onto a target object using reflection.
The ProxyingRequestHandler
class makes use of this to provide a proxying synchronous
request handler.
The mapping is relatively unsophisticated and is based entirely
on the method name. As a result, method overloading is not supported.
Overloading methods results in undefined behaviour, as
Class.getMethods()
makes no guarantees regarding
the order in which methods are returned. You're free to overload
methods (i.e. this implementation will not prevent it)
but you do so at your own risk.
This class also extends
MethodCallUnmarshallerAid
and uses the Method.getParameterTypes()
to determine type mappings dynamically when RPC structs
are involved.
Methods that accept RPC arrays must be defined to
accept List
instances
for those parameters. Type coercion is as per
Method.invoke(java.lang.Object, java.lang.Object[])
.
Constructor Summary | |
---|---|
RpcMethodProxy(java.lang.String namePattern,
java.lang.Object target)
|
Method Summary | |
---|---|
protected java.lang.String |
decodeRpcMethodName(java.lang.String name)
|
protected java.lang.String |
encodeJavaMethodName(java.lang.String name)
|
FieldNameCodec |
getFieldNameCodec(java.lang.String methodName)
Invoked when a method call unmarshaller is required. |
java.lang.Class |
getType(java.lang.String methodName,
int index)
An implementation should return a Class instance representing
the type a complex parameter value (a struct or an array) at the given
index should be unmarshalled as. |
RpcResponse |
invoke(RpcCall call)
Deprecated. Override invoke(RpcCall, RpcCallContext) instead. |
RpcResponse |
invoke(RpcCall call,
RpcCallContext context)
|
abstract RpcFault |
newRpcFault(java.lang.Throwable e)
|
protected abstract RpcResponse |
newRpcResponse(java.lang.Object returnValue)
|
Methods inherited from class com.flat502.rox.marshal.UnmarshallerAid |
---|
ignoreMissingFields |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RpcMethodProxy(java.lang.String namePattern, java.lang.Object target)
Method Detail |
---|
public RpcResponse invoke(RpcCall call) throws java.lang.Exception
invoke(RpcCall, RpcCallContext)
instead.
This method has been retired and has an empty method body.
Overriding implementations will still be delegated to but
direct calls to this method will simply return
null
(unless it is overridden).
call
-
null
java.lang.Exception
public RpcResponse invoke(RpcCall call, RpcCallContext context) throws java.lang.Exception
java.lang.Exception
public java.lang.Class getType(java.lang.String methodName, int index)
MethodCallUnmarshallerAid
Class
instance representing
the type a complex parameter value (a struct or an array) at the given
index should be unmarshalled as.
A null return value will result in the parameter value being unmarshalled
into a Map
instance if, and only if, the parameter value
is an XML-RPC struct and a List
instance if, and only if,
the value is an XML-RPC array.
The returned Class
must be accessible, instantiable, and have an
accessible default constructor.
getType
in class MethodCallUnmarshallerAid
methodName
- The name of the XML-RPC method call being unmarshalled.index
- The index of the parameter value being unmarshalled.
Class
for the type the parameter value should
be unmarshalled as, assuming it is a struct or an array.protected java.lang.String decodeRpcMethodName(java.lang.String name)
protected java.lang.String encodeJavaMethodName(java.lang.String name)
public FieldNameCodec getFieldNameCodec(java.lang.String methodName)
UnmarshallerAid
This method allows request handlers to override the default unmarshaller implementation for a given method (or class of methods) without imposing that unmarshaller on all request handlers.
Implementations may return the same instance for multiple calls to this method as long as the unmarshaller is thread-safe.
Implementations may return null
in which
case a default unmarshalling implementation will be used.
getFieldNameCodec
in class UnmarshallerAid
methodName
- The name of the XML-RPC method call being unmarshalled.
null
.public abstract RpcFault newRpcFault(java.lang.Throwable e)
protected abstract RpcResponse newRpcResponse(java.lang.Object returnValue)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |