Annotation Type ListensTo


  • @Retention(RUNTIME)
    @Target(PARAMETER)
    @Documented
    public @interface ListensTo
    This annotation is used to write simpler code which uses a message bus. With the proper support, code that receives messages can be written as simple methods such as:
     private void onMessage (final @ListenTo Message message)
       {
         ...
       }
     
    Note that this annotation doesn't support any further semantics; for instance, message could be null or not, in function of the message bus implementation; nor you can make any assumption on the threading. The exact semantics are defined by further annotations (on the class containing the listener method), or by the build context (e.g. an annotation processor, AspectJ, etc...). Specific support must be used in order to have this annotation working. For instance, an annotation processor, or some facility which scans classes at runtime, or MessageBusHelper.
    Author:
    Fabrizio Giudici