/** * Build {@link OutboundEvent}. * <p> * There are two valid configurations: * <ul> * <li>if a {@link Builder#comment(String) comment} is set, all other parameters are optional. * If event {@link Builder#data(Class, Object) data} and {@link Builder#mediaType(MediaType) media type} is set, * event data will be serialized after the comment.</li> * <li>if a {@link Builder#comment(String) comment} is not set, at least the event * {@link Builder#data(Class, Object) data} must be set. All other parameters are optional.</li> * </ul> * </p> * * @return new {@link OutboundEvent} instance. * @throws IllegalStateException when called with invalid configuration (neither a comment nor event data are set). */ public OutboundEvent build() { if (comment == null && data == null && type == null) { throw new IllegalStateException(LocalizationMessages.OUT_EVENT_NOT_BUILDABLE()); } return new OutboundEvent(name, id, reconnectDelay, type, mediaType, data, comment); } }
/** * Build {@link OutboundEvent}. * <p> * There are two valid configurations: * <ul> * <li>if a {@link Builder#comment(String) comment} is set, all other parameters are optional. * If event {@link Builder#data(Class, Object) data} and {@link Builder#mediaType(MediaType) media type} is set, * event data will be serialized after the comment.</li> * <li>if a {@link Builder#comment(String) comment} is not set, at least the event * {@link Builder#data(Class, Object) data} must be set. All other parameters are optional.</li> * </ul> * </p> * * @return new {@link OutboundEvent} instance. * @throws IllegalStateException when called with invalid configuration (neither a comment nor event data are set). */ public OutboundEvent build() { if (comment == null && data == null && type == null) { throw new IllegalStateException(LocalizationMessages.OUT_EVENT_NOT_BUILDABLE()); } return new OutboundEvent(name, id, reconnectDelay, type, mediaType, data, comment); } }
/** * Build {@link OutboundEvent}. * <p> * There are two valid configurations: * <ul> * <li>if a {@link Builder#comment(String) comment} is set, all other parameters are optional. * If event {@link Builder#data(Class, Object) data} and {@link Builder#mediaType(MediaType) media type} is set, * event data will be serialized after the comment.</li> * <li>if a {@link Builder#comment(String) comment} is not set, at least the event * {@link Builder#data(Class, Object) data} must be set. All other parameters are optional.</li> * </ul> * </p> * * @return new {@link OutboundEvent} instance. * @throws IllegalStateException when called with invalid configuration (neither a comment nor event data are set). */ public OutboundEvent build() { if (comment == null && data == null && type == null) { throw new IllegalStateException(LocalizationMessages.OUT_EVENT_NOT_BUILDABLE()); } return new OutboundEvent(name, id, reconnectDelay, type, mediaType, data, comment); } }
/** * Build {@link OutboundEvent}. * <p> * There are two valid configurations: * <ul> * <li>if a {@link Builder#comment(String) comment} is set, all other parameters are optional. * If event {@link Builder#data(Class, Object) data} and {@link Builder#mediaType(MediaType) media type} is set, * event data will be serialized after the comment.</li> * <li>if a {@link Builder#comment(String) comment} is not set, at least the event * {@link Builder#data(Class, Object) data} must be set. All other parameters are optional.</li> * </ul> * </p> * * @return new {@link OutboundEvent} instance. * @throws IllegalStateException when called with invalid configuration (neither a comment nor event data are set). */ public OutboundEvent build() { if (comment == null && data == null && type == null) { throw new IllegalStateException(LocalizationMessages.OUT_EVENT_NOT_BUILDABLE()); } return new OutboundEvent(name, id, reconnectDelay, type, mediaType, data, comment); } }