java - Implementing rxJava in a library with interfaces which return values -


so have android library has several interfaces callbacks various things. i'm working on extension module wrap library in rxjava. i've got of callbacks covered, ran issue in couple of spots.

so there couple of interfaces used filters essentially. callback gets called, , returns value library know next.

a simple example

public interface myfilter {     reaction oncallback(someevent event); }  public void someinternalmethod() {     // event happens here need let library user know     reaction reaction = filter.oncallback(event);     if (reaction.dothing1()) {         ...     }     else if (reaction.dothing2() {         ...     } 

so library user implement interface tell library how proceed when "someevent" happens. library user observing someevent, library needs return value know how proceed on said event.

as onnext method returns void, i'm not sure best way implement this.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -