@Target(TYPE)
@Retention(SOURCE)
public @interface ExtensionMethod
Complete documentation is found at the project lombok features page for @ExtensionMethod.
Before:
@ExtensionMethod(java.util.Arrays.class)
class Example {
private void example() {
long[] values = new long[] { 2, 5, 7, 9 };
values.copyOf(3).sort();
}
}
After:
class Example {
private void example() {
long[] values = new long[] { 2, 5, 7, 9 };
java.util.Arrays.sort(java.util.Arrays.copyOf(values, 3));
}
}
| Modifier and Type | Required Element | Description |
|---|---|---|
java.lang.Class<?>[] |
value |
| Modifier and Type | Optional Element | Description |
|---|---|---|
boolean |
suppressBaseMethods |
If
true, an applicable extension method is used (if found) even if the method call already was compilable (this is the default). |
java.lang.Class<?>[] value
boolean suppressBaseMethods
true, an applicable extension method is used (if found) even if the method call already was compilable (this is the default).
If false, an extension method is only used if the method call is not also defined by the type itself.Copyright © 2009-2018 The Project Lombok Authors, licensed under the MIT licence.