vertx-rx
vertx-rx copied to clipboard
Extension methods
Support extension methods in a similar fashion than Groovy or Kotlin provide.
package foo.bar;
@VertxGen
public interface Foo {
// Some methods
}
If on the classpath we have:
public interface FooHelper /* Convention */ {
public static String bar(Foo foo, String s) {
return foo.toString + s;
}
}
Then the generated Foo rx wrapper can be augmented with this method:
public class Foo {
private foo.bar.Foo delegate;
public String bar(String s) {
return FooHelper.bar(delegate, s);
}
}
@vietj you piqued my curiosity :) Can you elaborate on a concrete use case you had in mind?
retrofit some existing helper method, for instance:
public static Scheduler scheduler(io.vertx.core.Vertx vertx) {
return new ContextScheduler(vertx, false);
}
we get then a scheduler() method on io.vertx.reactivex.core.Vertx, etc...
so the goal is to provide a more oo-ish experience when using vertx-rx
Thanks for the details. Indeed, great idea :)