public abstract class ActorHandler extends Object implements SampXmlRpcHandler
execute requests.  This insulates the implementation object
 from having to worry about any XML-RPC specifics.| Constructor and Description | 
|---|
| ActorHandler(String prefix,
            Class actorType,
            Object actor)Constructor. | 
| Modifier and Type | Method and Description | 
|---|---|
| boolean | canHandleCall(String fqName)Returns true if this handler should be able to process 
 given XML-RPC method. | 
| Object | getActor()Returns the implementation object for this handler. | 
| Object | handleCall(String fqName,
          List params,
          Object reqInfo)Processes an XML-RPC call. | 
| protected abstract Object | invokeMethod(Method method,
            Object obj,
            Object[] args)Invokes a method reflectively on an object. | 
public ActorHandler(String prefix, Class actorType, Object actor)
prefix - string prepended to every method name in the
         actorType interface to form the XML-RPC
         methodName elementactorType - interface defining the XML-RPC methodsactor - object implementing actorTypepublic boolean canHandleCall(String fqName)
SampXmlRpcHandlercanHandleCall in interface SampXmlRpcHandlerfqName - method namepublic Object handleCall(String fqName, List params, Object reqInfo) throws Exception
SampXmlRpcHandlercanHandleCall(method) returns true.
 The params list and the return value must be 
 SAMP-compatible, that is only Strings, Lists and String-keyed Maps
 are allowed in the data structures.
 The reqInfo parameter may be used to provide additional
 information about the XML-RPC request, for instance the originating
 host; this is implementation specific, and may be null.handleCall in interface SampXmlRpcHandlerfqName - XML-RPC method nameparams - XML-RPC parameter list (SAMP-compatible)reqInfo - optional additional request information; may be nullExceptionpublic Object getActor()
protected abstract Object invokeMethod(Method method, Object obj, Object[] args) throws IllegalAccessException, InvocationTargetException
return method.invoke(obj,params).
 If the implementation is effectively prescribed, why is this
 abstract method here?  It's tricky.
 The reason is so that reflective method invocation from this class
 is done by code within the actor implementation class itself
 rather than by code in the superclass, ActorHandler.
 That in turn means that the actorType class specified
 in the constructor does not need to be visible from 
 ActorHandler's package, only from the package where
 the implementation class lives.
method - method to invokeobj - object to invoke the method onargs - arguments for the method callIllegalAccessExceptionInvocationTargetExceptionMethod.invoke(java.lang.Object, java.lang.Object...)Copyright © 2008–2024. All rights reserved.