Description
At the moment you can use a delegate like this
interface CollectionAdders {
boolean add(Object e);
boolean addAll(Collection<? extends Object> c);
}
class A {
@Delegate{types=CollectionAdders.class)
Set<Object> objects;
}
This is nice and all, but if you have 2 Sets in class A, then you can't use it for both.
That is why I propose adding a suffix parameter to the @Delegate annotation (and optionally add a @Plural annotation for cases where this suffix needs to be pluralized).
This would generate the A.addCat(...), A.addDog(...), A.addAllCats(...) and A.addAllDogs(...)
Describe the target audience
While I am using a Set as an example, this could be widely applicable for delegating methods from more than one field. The example of a Set was purely used to also explain the @Plural concept.
Additional context
To implement the @Plural functionality, it might be possible to reuse parts of the code that is used for creating a singular form for the @Signular annotation.
This suffix feature has been mentioned by me before in #1905, but I felt that this feature was more generally applicable and deserved a feature request of its own.
Description At the moment you can use a delegate like this
This is nice and all, but if you have 2
Set
s in class A, then you can't use it for both.That is why I propose adding a suffix parameter to the
@Delegate
annotation (and optionally add a@Plural
annotation for cases where this suffix needs to be pluralized).Or (without
@Plural
):This would generate the
A.addCat(...)
,A.addDog(...)
,A.addAllCats(...)
andA.addAllDogs(...)
Describe the target audience While I am using a Set as an example, this could be widely applicable for delegating methods from more than one field. The example of a
Set
was purely used to also explain the@Plural
concept.Additional context To implement the
@Plural
functionality, it might be possible to reuse parts of the code that is used for creating a singular form for the@Signular
annotation.This suffix feature has been mentioned by me before in #1905, but I felt that this feature was more generally applicable and deserved a feature request of its own.