Package net.sf.eBus.client
Class EMultiPublishFeed.Builder
- java.lang.Object
-
- net.sf.eBus.client.EFeed.Builder<M,T,B>
-
- net.sf.eBus.client.EMultiFeed.Builder<ENotificationMessage,EPublishFeed,EPublisher,EMultiPublishFeed,EMultiPublishFeed.Builder>
-
- net.sf.eBus.client.EMultiPublishFeed.Builder
-
- Enclosing class:
- EMultiPublishFeed
public static final class EMultiPublishFeed.Builder extends EMultiFeed.Builder<ENotificationMessage,EPublishFeed,EPublisher,EMultiPublishFeed,EMultiPublishFeed.Builder>
EMultiPublishFeed.Builder
is the mechanism for creating anEMultiPublishFeed
instance. ABuilder
instance is acquired fromEMultiPublishFeed.builder()
. The following example shows how to create anEMultiPublishFeed
instance using aBuilder
. The code assumes that the target class implementsEPublisher
interfacefeedStatus
method.@Overricde public void startup() { final EMultiPublishFeed feed = (EMultiPublishFeed.builder()).target(this) .messageClass(CatalogUpdate.class) .scope(EFeed.FeedScope.LOCAL_AND_REMOTE) // Call .statusCallback(lambda expression) to replace feedStatus method .build(); ... }
-
-
Field Summary
-
Fields inherited from class net.sf.eBus.client.EMultiFeed.Builder
mFeeds, mMsgClass, mTargetMsgClass
-
Fields inherited from class net.sf.eBus.client.EFeed.Builder
mEClient, mLocation, mScope, mTarget, mTargetClass
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected EMultiPublishFeed
buildImpl()
Returns an eBus feed instance build from the configured properties.protected EPublishFeed
createFeed(EMessageKey key)
Returns a subordinate feed for the given message key.protected EMultiPublishFeed.Builder
self()
Returnsthis
reference.EMultiPublishFeed.Builder
statusCallback(FeedStatusCallback<IEPublishFeed> cb)
Puts the publish status callback in place.protected Validator
validate(Validator problems)
Checks if message class and query (if this is a query-based multi-feed) are set.-
Methods inherited from class net.sf.eBus.client.EMultiFeed.Builder
messageClass, query, subjects
-
Methods inherited from class net.sf.eBus.client.EFeed.Builder
build, isOverridden, scope, target
-
-
-
-
Method Detail
-
validate
protected Validator validate(Validator problems)
Description copied from class:EMultiFeed.Builder
Checks if message class and query (if this is a query-based multi-feed) are set.- Overrides:
validate
in classEMultiFeed.Builder<ENotificationMessage,EPublishFeed,EPublisher,EMultiPublishFeed,EMultiPublishFeed.Builder>
- Parameters:
problems
- report configuration failures to this validator.- Returns:
problems
.
-
createFeed
protected EPublishFeed createFeed(EMessageKey key)
Description copied from class:EMultiFeed.Builder
Returns a subordinate feed for the given message key.Note: this method is called after the builder validation.
- Specified by:
createFeed
in classEMultiFeed.Builder<ENotificationMessage,EPublishFeed,EPublisher,EMultiPublishFeed,EMultiPublishFeed.Builder>
- Parameters:
key
- subordinate feed's message key.- Returns:
- subordinate feed.
-
buildImpl
protected EMultiPublishFeed buildImpl()
Description copied from class:EFeed.Builder
Returns an eBus feed instance build from the configured properties. Note: the builder configuration wasvalidated
prior to calling this method. The message object may now be constructed.- Specified by:
buildImpl
in classEFeed.Builder<EMultiPublishFeed,EPublisher,EMultiPublishFeed.Builder>
- Returns:
- target feed instance.
-
self
protected EMultiPublishFeed.Builder self()
Returnsthis
reference.- Specified by:
self
in classEFeed.Builder<EMultiPublishFeed,EPublisher,EMultiPublishFeed.Builder>
- Returns:
this
reference.
-
statusCallback
public EMultiPublishFeed.Builder statusCallback(FeedStatusCallback<IEPublishFeed> cb)
Puts the publish status callback in place. Ifcb
is notnull
, publish status updates will be passed tocb
rather thanEPublisher.publishStatus(EFeedState, IEPublishFeed)
. The reverse is true, ifcb
isnull
, then updates are posted to theEPublisher.publishStatus(EFeedState, IEPublishFeed)
override.The following example shows how to use this method:
statusCallback( (fs, f) → { if (fs == EFeedState.DOWN) { // Clean up in-progress work. } }
- Parameters:
cb
- publish status update callback. May benull
.- Returns:
this Builder
instance.
-
-