public class Events
extends java.lang.Object
Events.Subscribe
annotation, callbacks are methods
marked with either Events.Status
, Events.Result
or Events.Failure
annotations.Events.Background
and Events.Cache
annotations which control subscription
execution flow.register
and unregister
subscribers and
callbacks use corresponding methods.
To post events into event bus use either post(String)
or create(String)
methods.Modifier and Type | Class and Description |
---|---|
static interface |
Events.Background
Method marked with this annotation will receive events on background thread.
|
static interface |
Events.Cache
Method marked with this annotation will use new instance of given
CacheProvider
class to handle results caching. |
static interface |
Events.Failure
Method marked with this annotation will receive failure callbacks for events
with specified key on main thread.
|
static interface |
Events.Result
Method marked with this annotation will receive results for events
with specified key on main thread.
Result can be accessed either directly as method's parameter or through EventResult object. |
static interface |
Events.Status
Method marked with this annotation will receive status updates for events
with specified key on main thread.
EventStatus.STARTED status will be sent before any subscribed method is executed
(right after event is posted to the bus) and for all newly registered events receivers
if execution of all subscribed methods is no yet finished.
EventStatus.FINISHED status will be sent after all subscribed methods
(including background) are executed.
|
static interface |
Events.Subscribe
Method marked with this annotation will receive events with specified key on main thread.
|
Modifier and Type | Method and Description |
---|---|
static Event.Builder |
create(java.lang.String eventKey)
Creates event builder for provided event key.
|
static void |
init(android.content.Context context)
Deprecated.
This method does nothing, do not use it.
|
static Event |
post(java.lang.String eventKey)
Creates and post event with provided event key.
|
static void |
register(java.lang.Object target)
Registers target within event bus.
|
static void |
setDebug(boolean isDebug) |
static void |
unregister(java.lang.Object target)
Unregisters target from event bus.
|
@Deprecated public static void init(android.content.Context context)
public static void setDebug(boolean isDebug)
public static void register(java.lang.Object target)
target
- Either class instance (for non-static methods registration)
or class type (for static methods registration).public static void unregister(java.lang.Object target)
target
- Previously registered target.public static Event.Builder create(java.lang.String eventKey)
public static Event post(java.lang.String eventKey)