diff --git a/README.md b/README.md index a079461..9cc6536 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,8 @@ The performance win of this design is illustrated in here Read this documentation to get an overview of MBassadors features. There is also some documentation in the Wiki - although admittedly -not enough to make a developer happy (work is in progress). Additionally, you can browse the [javadoc](http://bennidi.github.io/mbassador/) +not enough to make a developer happy (work is in progress). +Additionally, you can browse the [javadoc](http://bennidi.github.io/mbassador/) The current version is 1.1.9 and it is available from the Maven Central Repository. See the release notes for more details. diff --git a/pom.xml b/pom.xml index 6533b1a..9c33db9 100644 --- a/pom.xml +++ b/pom.xml @@ -212,7 +212,7 @@ mbassador, ${project.version} - http://static.springsource.org/spring/docs/3.0.x/javadoc-api/ + @@ -226,7 +226,7 @@ ${project.reporting.outputDirectory}/apidocs true scm:git:git@github.com:bennidi/mbassador.git - gh-pages + gh-pages diff --git a/src/main/java/net/engio/mbassy/listener/IMessageFilter.java b/src/main/java/net/engio/mbassy/listener/IMessageFilter.java index e2b99ba..12efcfa 100644 --- a/src/main/java/net/engio/mbassy/listener/IMessageFilter.java +++ b/src/main/java/net/engio/mbassy/listener/IMessageFilter.java @@ -1,21 +1,40 @@ package net.engio.mbassy.listener; /** - * Message filters can be used to prevent certain messages to be delivered to a specific listener. - * If a filter is used the message will only be delivered if it passes the filter(s) - *

- * NOTE: A message filter must provide either a no-arg constructor. + * Message filters can be used to control what messages are delivered to a specific message handler. + * Filters are attached to message handler using the @Listener annotation. + * If a message handler specifies filters, the filters accepts(...) method will be checked before the actual handler is invoked. + * The handler will be invoked only if each filter accepted the message. + * + * Example: + * + * @Lister + * @Filters(Urlfilter.class) + * public void someHandler(String message){...} + * + * class Urlfilter implements IMessageFilter{ + * public boolean accepts(String message, MessageHandler metadata){ + * return message.startsWith("http"); + * } + * } + * + * bus.post("http://www.infoq.com"); // will be delivered + * bus.post("www.stackoverflow.com"); // will not be delivered + * + * NOTE: A message filter must provide a no-arg constructor!!! * * @author bennidi * Date: 2/8/12 */ -public interface IMessageFilter { +public interface IMessageFilter { /** - * Evaluate the message to ensure that it matches the handler configuration + * Check the message for whatever criteria * - * @param message the message to be delivered - * @return + * @param message the message to be handled by the handler + * @param metadata the metadata object which describes the message handler + * @return true: if the message matches the criteria and should be delivered to the handler + * false: otherwise */ - boolean accepts(Object message, MessageHandler metadata); + boolean accepts(M message, MessageHandler metadata); }