EventBus Adapter for Java

The EventBus Adapter wraps various EventBus implementations for Java and Android.

Лицензия

Лицензия

Категории

Категории

Java Языки программирования EventBus Библиотеки уровня приложения Messaging
Группа

Группа

com.cookingfox
Идентификатор

Идентификатор

eventbus-adapter-java
Последняя версия

Последняя версия

3.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

EventBus Adapter for Java
The EventBus Adapter wraps various EventBus implementations for Java and Android.
Ссылка на сайт

Ссылка на сайт

https://github.com/cookingfox/eventbus-adapter-java
Организация-разработчик

Организация-разработчик

Cooking Fox
Система контроля версий

Система контроля версий

http://github.com/cookingfox/eventbus-adapter-java

Скачать eventbus-adapter-java

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.cookingfox/eventbus-adapter-java/ -->
<dependency>
    <groupId>com.cookingfox</groupId>
    <artifactId>eventbus-adapter-java</artifactId>
    <version>3.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.cookingfox/eventbus-adapter-java/
implementation 'com.cookingfox:eventbus-adapter-java:3.0.0'
// https://jarcasting.com/artifacts/com.cookingfox/eventbus-adapter-java/
implementation ("com.cookingfox:eventbus-adapter-java:3.0.0")
'com.cookingfox:eventbus-adapter-java:jar:3.0.0'
<dependency org="com.cookingfox" name="eventbus-adapter-java" rev="3.0.0">
  <artifact name="eventbus-adapter-java" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.cookingfox', module='eventbus-adapter-java', version='3.0.0')
)
libraryDependencies += "com.cookingfox" % "eventbus-adapter-java" % "3.0.0"
[com.cookingfox/eventbus-adapter-java "3.0.0"]

Зависимости

provided (3)

Идентификатор библиотеки Тип Версия
de.greenrobot : eventbus jar 2.4.1
org.greenrobot : eventbus jar 3.0.0
com.google.guava : guava jar 19.0

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12

Модули Проекта

Данный проект не имеет модулей.

EventBus Adapter for Java

The EventBus Adapter wraps various EventBus implementations for Java and Android. It uses a uniform interface (com.cookingfox.eventbus.EventBus) to type your classes to, so that it's possible to change the implementation when required.

Build Status

Download

Download Maven Central

The distribution is hosted on Bintray. To include the package in your projects, you can add the jCenter repository.

Gradle

Add jCenter to your repositories block:

repositories {
    jcenter()
}

and add the project to the dependencies block in your build.gradle:

dependencies {
    compile 'com.cookingfox:eventbus-adapter-java:3.0.0'
}

Maven

Add jCenter to your repositories in pom.xml or settings.xml:

<repositories>
    <repository>
        <id>jcenter</id>
        <url>http://jcenter.bintray.com</url>
    </repository>
</repositories>

and add the project declaration to your pom.xml:

<dependency>
    <groupId>com.cookingfox</groupId>
    <artifactId>eventbus-adapter-java</artifactId>
    <version>3.0.0</version>
</dependency>

Features

Currently the library has adapters for:

The main EventBus interface actually inherits from the EventBusPublisher and EventBusSubscriber interfaces. This allows the user to restrict the available functionality of the consuming class.

Usage

Include in your project's dependencies:

  1. This wrapper library. (see "Download")
  2. The library you want to wrap. (see "Features")

Example for the GreenRobot EventBus version 3:

class ExampleEvent {}

class ExampleSubscriber {
    com.cookingfox.eventbus.EventBus eventBus;

    ExampleSubscriber(com.cookingfox.eventbus.EventBus eventBus) {
        this.eventBus = eventBus;
    }

    void onCreate() {
        eventBus.register(this);
    }

    void onEvent(ExampleEvent event) {
        // handle event
    }

    void onDestroy() {
        eventBus.unregister(this);
    }
}

// create real EventBus and adapter
org.greenrobot.eventbus.EventBus realEventBus = new org.greenrobot.eventbus.EventBus();
com.cookingfox.eventbus.EventBus eventBusAdapter = new GreenRobot3Adapter(realEventBus);

// create and register subscriber
ExampleSubscriber subscriber = new ExampleSubscriber(eventBusAdapter);
subscriber.onCreate();

// post an event
eventBusAdapter.post(new ExampleEvent());

// unregister subscriber
subscriber.onDestroy();

Restricting publish / subscribe capabilities

If you want to restrict your consumer classes' EventBus capabilities, use the following interfaces:

  • EventBusPublisher: the class will only be able to use the post method.
  • EventBusSubscriber: the class will only be able to use the register and unregister methods.

F.A.Q.

Is it possible to support EventBus library X?

If you make an issue for it, we'll take a look at it! :)

Copyright and license

Code and documentation copyright 2017 Cooking Fox. Code released under the Apache 2.0 license.

Версии библиотеки

Версия
3.0.0
2.0.0
1.0.0