Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension methods #152

Open
vietj opened this issue Jul 20, 2018 · 4 comments
Open

Extension methods #152

vietj opened this issue Jul 20, 2018 · 4 comments

Comments

@vietj
Copy link
Contributor

vietj commented Jul 20, 2018

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 vietj added this to the 3.6.0 milestone Jul 20, 2018
@tsegismont
Copy link
Contributor

@vietj you piqued my curiosity :) Can you elaborate on a concrete use case you had in mind?

@vietj
Copy link
Contributor Author

vietj commented Jul 23, 2018

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...

@vietj
Copy link
Contributor Author

vietj commented Jul 23, 2018

so the goal is to provide a more oo-ish experience when using vertx-rx

@tsegismont
Copy link
Contributor

Thanks for the details. Indeed, great idea :)

@vietj vietj modified the milestones: 3.6.0, 4.0.0 Nov 5, 2018
@vietj vietj removed this from the 4.0.0 milestone Oct 5, 2020
@vietj vietj removed the enhancement label Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants