Kuba Petržílka
08/10/2022, 4:17 PMKuba Petržílka
08/10/2022, 4:18 PM@FunctionalInterface
public interface ApplicationListener<E extends ApplicationEvent> extends EventListener {
void onApplicationEvent(E event);
static <T> ApplicationListener<PayloadApplicationEvent<T>> forPayload(Consumer<T> consumer) {
return event -> consumer.accept(event.getPayload());
}
}
Kuba Petržílka
08/10/2022, 4:20 PMApplicationEvent?
as the type parameter for E
doesn't make much sense because it is a super type of ApplicationEvent
not a subtype.. but it is possible because of the java interoperability and it compiles, it is really just IDEA complaining and just for this original Spring interface, I m not able to reproduce it with handcrafted interface O.o