Class ObjectMessageDelegator<S extends MessageConnection>
java.lang.Object
com.jme3.network.util.AbstractMessageDelegator<S>
com.jme3.network.util.ObjectMessageDelegator<S>
- Type Parameters:
S- the message connection type handled by this delegator
- All Implemented Interfaces:
MessageListener<S>
public class ObjectMessageDelegator<S extends MessageConnection>
extends AbstractMessageDelegator<S>
A MessageListener implementation that will forward messages to methods
of a specified delegate object. These methods can be automapped or manually
specified.
- Author:
- Paul Speed
-
Constructor Summary
ConstructorsConstructorDescriptionObjectMessageDelegator(Object delegate, boolean automap) Creates a MessageListener that will forward mapped message types to methods of the specified object. -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectgetSourceDelegate(MessageConnection source) Implemented by subclasses to provide the actual delegate object against which the mapped message type methods will be called.Methods inherited from class AbstractMessageDelegator
allowName, automap, findDelegate, getMessageType, getMessageTypes, getMethod, isValidMethod, map, map, map, messageReceived
-
Constructor Details
-
ObjectMessageDelegator
Creates a MessageListener that will forward mapped message types to methods of the specified object. If automap is true then all methods with the proper signature will be mapped.Methods of the following signatures are allowed:
- void someName(S conn, SomeMessage msg)
- void someName(Message msg)
- Parameters:
delegate- the object that will receive forwarded callsautomap- true to automatically map compatible methods on the delegate
-
-
Method Details
-
getSourceDelegate
Description copied from class:AbstractMessageDelegatorImplemented by subclasses to provide the actual delegate object against which the mapped message type methods will be called.- Specified by:
getSourceDelegatein classAbstractMessageDelegator<S extends MessageConnection>- Parameters:
source- the source connection associated with the message- Returns:
- the delegate object to invoke, or null to ignore the message
-