release of 1.0.6.RC, fixed #14 and #11

This commit is contained in:
benni 2012-12-25 17:19:58 +01:00
parent 39ab0d61ef
commit acd19169af
10 changed files with 16 additions and 15 deletions

View File

@ -66,19 +66,20 @@ Listener definition (in any bean):
// do something more expensive here
}
// this handler will receive events of type SubTestEvent
// or any subtabe and that passes the given filter(s)
// this handler will receive messages of type SubTestEvent
// or any of its sub types that passe the given filter(s)
@Listener(priority = 10,
dispatch = Mode.Synchronous,
filters = {@Filter(MessageFilter.None.class),@Filter(MessageFilter.All.class)})
filters = {@Filter(Filters.SpecialEvent.class)})
public void handleFiltered(SubTestEvent event) {
//do something special here
}
@Listener(dispatch = Mode.Synchronous, filters = @Filter(Filters.RejectSubtypes.class))
@Listener(dispatch = Mode.Synchronous, rejectSubtypes = true)
@Enveloped(messages = {TestEvent.class, TestEvent2.class})
public void handleSuperTypeEvents(MessageEnvelope envelope) {
// detect the type of event here and then decide the course of action
// the envelope will contain either an instance of TestEvent or TestEvent2
// if rejectSubtypes were set to 'false' (default) also subtypes of TestEvent or TestEvent2 would be allowed
}

View File

@ -1 +1 @@
a2ddea6754519b5b4c029f48431e0605
dac16b8c129ee38d08e63d4cd487bdc9

View File

@ -1 +1 @@
f2496df5cf69076115670219c0127968e3c7ad63
110fd15551d0a40fafd46cc4e66c590e4d1b2fc7

View File

@ -13,6 +13,6 @@
<version>1.0.5.RC</version>
<version>1.0.6.RC</version>
</versions>
<lastUpdated>20121225153509</lastUpdated>
<lastUpdated>20121225161830</lastUpdated>
</versioning>
</metadata>

View File

@ -1 +1 @@
0cc21fcd52a994d6b22f9fe57f210143
3ad8909f1f842b3c7a9644c8ad1cdb84

View File

@ -1 +1 @@
dc58ab03113b6edefe5f3bfdfc464e5c344b253a
025b0b9e37663a19aeaf95c12a7d6cf8d8e470fc

View File

@ -21,6 +21,6 @@ public @interface Listener {
int priority() default 0;
boolean handlesSubtypes() default true;
boolean rejectSubtypes() default false;
}

View File

@ -33,7 +33,7 @@ public class MessageHandlerMetadata {
this.listenerConfig = listenerConfig;
this.isAsynchronous = listenerConfig.dispatch().equals(Mode.Asynchronous);
this.envelope = handler.getAnnotation(Enveloped.class);
this.acceptsSubtypes = listenerConfig.handlesSubtypes();
this.acceptsSubtypes = !listenerConfig.rejectSubtypes();
if(this.envelope != null){
for(Class messageType : envelope.messages())
handledMessages.add(messageType);

View File

@ -111,7 +111,7 @@ public class MetadataReaderTest extends UnitTest {
// a simple event listener
public class EventListener1 {
@Listener(handlesSubtypes = false)
@Listener(rejectSubtypes = true)
public void handleObject(Object o) {
}
@ -135,7 +135,7 @@ public class MetadataReaderTest extends UnitTest {
public class EventListener3 extends EventListener2 {
// narrow the handler
@Listener(handlesSubtypes = false)
@Listener(rejectSubtypes = true)
public void handleAny(Object o) {
}
@ -150,7 +150,7 @@ public class MetadataReaderTest extends UnitTest {
public class EnvelopedListener{
@Listener(handlesSubtypes = false)
@Listener(rejectSubtypes = true)
@Enveloped(messages = {String.class, Integer.class, Long.class})
public void handleEnveloped(MessageEnvelope o) {