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

[FEATURE] @OverloadedParam to generate overloaded methods with lombok #3285

Open
Charismara opened this issue Oct 25, 2022 · 0 comments
Open

Comments

@Charismara
Copy link

The whole idea is basically to generate overloaded methods based on additional types in the @OverloadedParam annotation of a Parameter.

Single use Example:

private void foo(@OverloadedParam({String.class, long.class}) int bar) {
      //method body
}

generates:

// Source Method
private void foo(int bar) {
      //method body
}
// With String instead of int
private void foo(String bar) {
      //method body
}
// With long instead of int
private void foo(long bar) {
      //method body
}

Multiple use Exmaple:

private void foo(@OverloadedParam({String.class, long.class}) int bar, @OverloadedParam({String.class, double.class}) float barBar) {
      //method body
}

generates

// Source Method
private void foo(int bar, float barBar) {
      //method body
}

private void foo(int bar, double barBar) {
      //method body
}

private void foo(int bar, String barBar) {
      //method body
}

private void foo(long bar, float barBar) {
      //method body
}

private void foo(long bar, double barBar) {
      //method body
}

private void foo(long bar, String barBar) {
      //method body
}

private void foo(String bar, float barBar) {
      //method body
}

private void foo(String bar, double barBar) {
      //method body
}

private void foo(String bar, String barBar) {
      //method body
}

I'm sure this annotation could save many Devs a lot of time. Especially if you apply the annotation to multiple params.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant