Fixed a comment to be more accurate with respect
to handler method argument types. Fixed a small bug in how auto-detect worked. It was too greedy in looking for two-argument methods and would somehow allow methods that took a first argument that was not a connection type.
This commit is contained in:
parent
1145f99d03
commit
8b34e4890a
@ -91,9 +91,8 @@ public abstract class AbstractMessageDelegator<S extends MessageConnection>
|
|||||||
* Returns true if the specified method is valid for the specified
|
* Returns true if the specified method is valid for the specified
|
||||||
* message type. This is used internally during automapping to
|
* message type. This is used internally during automapping to
|
||||||
* provide implementation specific filting of methods.
|
* provide implementation specific filting of methods.
|
||||||
* This implementation checks for methods that take either no
|
* This implementation checks for methods that take either the connection and message
|
||||||
* arguments, the connection and message type arguments (in that order),
|
* type arguments (in that order) or just the message type.
|
||||||
* or just the message type or connection argument.
|
|
||||||
*/
|
*/
|
||||||
protected boolean isValidMethod( Method m, Class messageType ) {
|
protected boolean isValidMethod( Method m, Class messageType ) {
|
||||||
|
|
||||||
@ -107,12 +106,14 @@ public abstract class AbstractMessageDelegator<S extends MessageConnection>
|
|||||||
log.finest("Parameter count is not 1 or 2");
|
log.finest("Parameter count is not 1 or 2");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int connectionIndex = parms.length > 1 ? 0 : -1;
|
int messageIndex = 0;
|
||||||
int messageIndex = parms.length > 1 ? 1 : 0;
|
if( parms.length > 1 ) {
|
||||||
|
if( MessageConnection.class.isAssignableFrom(parms[0]) ) {
|
||||||
if( connectionIndex > 0 && !MessageConnection.class.isAssignableFrom(parms[connectionIndex]) ) {
|
messageIndex++;
|
||||||
log.finest("First paramter is not a MessageConnection or subclass.");
|
} else {
|
||||||
return false;
|
log.finest("First paramter is not a MessageConnection or subclass.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( messageType == null && !Message.class.isAssignableFrom(parms[messageIndex]) ) {
|
if( messageType == null && !Message.class.isAssignableFrom(parms[messageIndex]) ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user