Awesome
<img align="left" src="durian-rx.png"> DurianRx: Reactive getters, powered by RxJava and ListenableFuture
<!---freshmark shields output = [ link(shield('Maven central', 'mavencentral', 'com.diffplug.durian:durian-rx', 'blue'), 'https://search.maven.org/artifact/com.diffplug.durian/durian-rx'), link(shield('Apache 2.0', 'license', 'apache-2.0', 'blue'), 'https://tldrlegal.com/license/apache-license-2.0-(apache-2.0)'), '', link(shield('Changelog', 'changelog', versionLast, 'brightgreen'), 'CHANGES.md'), link(shield('Javadoc', 'javadoc', 'yes', 'brightgreen'), 'https://javadoc.io/doc/com.diffplug.durian/durian-rx/{{versionLast}}/'), link(shield('Live chat', 'gitter', 'chat', 'brightgreen'), 'https://gitter.im/diffplug/durian'), link(image('JitCI', 'https://jitci.com/gh/diffplug/durian-rx/svg'), 'https://jitci.com/gh/diffplug/durian-rx') ].join('\n'); --> <!---freshmark /shields --> <!---freshmark javadoc output = prefixDelimiterReplace(input, 'https://javadoc.io/static/com.diffplug.durian/durian-rx/', '/', versionLast); -->DurianRx unifies RxJava's Observable with Guava's ListenableFuture. If you happen to be using SWT as a widget toolkit, then you'll want to look at DurianSwt as well.
Observable<SomeType> observable = someObservable();
ListenableFuture<SomeType> future = someFuture();
Rx.subscribe(observable, val -> doSomething(val));
Rx.subscribe(future, val -> doSomething(val));
It also provides reactive getters, a simple abstraction for piping data which allows access via T get()
or Observable<T> asObservable()
.
RxBox<Point> mousePos = RxBox.of(new Point(0, 0));
this.addMouseListener(e -> mousePos.set(new Point(e.x, e.y)));
Rectangle hotSpot = new Rectangle(0, 0, 10, 10)
RxGetter<Boolean> isMouseOver = mousePos.map(hotSpot::contains);
Debugging an error which involves lots of callbacks can be difficult. To make this easier, DurianRx includes a tracing capability, which makes this task easier.
// anytime an error is thrown in an Rx callback, the stack trace of the error
// will be wrapped by the stack trace of the original subscription
DurianPlugins.register(RxTracingPolicy.class, new LogSubscriptionTrace()).
DurianRx's only requirements are durian-base, durian-collect, durian-concurrent, and RxJava.
<!---freshmark /javadoc -->