ralscha / sse-eventbus

EventBus library for sending events from a Spring appliction to the web browser with SSE
Apache License 2.0
79 stars 26 forks source link

SseEvent.Builder::build returns ImmutableSseEvent instead of SseEvent #12

Closed buckett closed 4 years ago

buckett commented 4 years ago

When building an event I use

SseEvent.builder().data(data)....build();

and this returns a ImmutableSseEvent which is package private, so not accessible in the calling code. Would it not be better to have the build() call return a SseEvent? I hit this issue because autocomplete in Intellij when I ask it to assign the result of the statement to a variable attempts to create a variable of type ImmutableSseEvent.

ralscha commented 4 years ago

I agree. This class should not be visible to the user of the library.

Looks like there is a solution according to the immutables documentation:
http://immutables.github.io/immutable.html#hide-implementation-class