001    /*
002     * Copyright 2013 Erik Kuefler
003     *
004     * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
005     * in compliance with the License. You may obtain a copy of the License at
006     *
007     * http://www.apache.org/licenses/LICENSE-2.0
008     *
009     * Unless required by applicable law or agreed to in writing, software distributed under the License
010     * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
011     * or implied. See the License for the specific language governing permissions and limitations under
012     * the License.
013     */
014    package com.ekuefler.supereventbus;
015    
016    import java.lang.annotation.Documented;
017    import java.lang.annotation.ElementType;
018    import java.lang.annotation.Inherited;
019    import java.lang.annotation.Target;
020    
021    /**
022     * Annotates a method as an event handler. Whenever an event is posted on an event bus, all methods
023     * with this annotation in all objects that have been registered on the event bus will be invoked if
024     * they can handle the type of event being posted. An event handler method can handle a given event
025     * if that event can be assigned to the single argument to that method. It is an error for a method
026     * annotated with {@link Subscribe} to accept zero or more than one arguments.
027     * <p>
028     * By default, all event handlers are registered at priority 0 with no filtering. {@link Subscribe}
029     * can be combined with {@link com.ekuefler.supereventbus.priority.WithPriority} to override
030     * the former and {@link com.ekuefler.supereventbus.filtering.When} to override the latter.
031     *
032     * @author ekuefler@gmail.com (Erik Kuefler)
033     */
034    @Documented
035    @Inherited
036    @Target(value = ElementType.METHOD)
037    public @interface Subscribe {}