Package net.sf.eBusx.monitor
Class PersistentStatusMessage.Builder
- java.lang.Object
-
- net.sf.eBus.messages.EMessageObject.Builder<M>
-
- net.sf.eBus.messages.EMessage.Builder<M,B>
-
- net.sf.eBus.messages.ENotificationMessage.Builder<PersistentStatusMessage,PersistentStatusMessage.Builder>
-
- net.sf.eBusx.monitor.PersistentStatusMessage.Builder
-
- Enclosing class:
- PersistentStatusMessage
public static final class PersistentStatusMessage.Builder extends ENotificationMessage.Builder<PersistentStatusMessage,PersistentStatusMessage.Builder>
Builder class used to construct apersistent status message
. Used to set status message instance identifier, action level, action name, and action message.
-
-
Field Summary
-
Fields inherited from class net.sf.eBus.messages.ENotificationMessage.Builder
mPosition, mPubId
-
Fields inherited from class net.sf.eBus.messages.EMessageObject.Builder
mTargetClass
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PersistentStatusMessage.Builder
actionLevel(ActionLevel level)
Sets action level.PersistentStatusMessage.Builder
actionMessage(java.lang.String message)
Sets action message.PersistentStatusMessage.Builder
actionName(java.lang.String name)
Sets action name.PersistentStatusMessage.Builder
appName(java.lang.String name)
Sets application name to given value.protected PersistentStatusMessage
buildImpl()
Returns eBus message instance built from the configured properties.PersistentStatusMessage.Builder
hostName(java.lang.String name)
Sets host name to given value.PersistentStatusMessage.Builder
instance(MonitorId id)
Sets monitor identifier.protected Validator
validate(Validator problems)
Checks if message subject and message type are configured.-
Methods inherited from class net.sf.eBus.messages.ENotificationMessage.Builder
position, publisherId
-
Methods inherited from class net.sf.eBus.messages.EMessage.Builder
copy, subject, timestamp, timestamp
-
Methods inherited from class net.sf.eBus.messages.EMessageObject.Builder
build
-
-
-
-
Method Detail
-
buildImpl
protected PersistentStatusMessage buildImpl()
Description copied from class:EMessageObject.Builder
Returns eBus message instance built 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 classEMessageObject.Builder<PersistentStatusMessage>
- Returns:
- target message class instance.
-
validate
protected Validator validate(Validator problems)
Description copied from class:EMessage.Builder
Checks if message subject and message type are configured. If not, then text explaining this error is appended toproblems
.This method should be overridden by subclass message builders and called before doing its own validation. The first line in the subclass
validate
implementation should besuper.validate(problems);
.When overriding this method, be sure to add all discovered validation problems to the list. The validation method should consist of a series of individual
if
statements and not anif/else if
chain. That way all problems are found and not just the first one.Please see
Validator
for a validationBuilder
settings example.- Overrides:
validate
in classEMessage.Builder<PersistentStatusMessage,PersistentStatusMessage.Builder>
- Parameters:
problems
- used to check field validity and collect discovered invalid fields.- Returns:
problems
to allow for method chaining.- See Also:
Validator
-
hostName
public PersistentStatusMessage.Builder hostName(java.lang.String name)
Sets host name to given value. This name does not need to be a network host name but any name meaningful to the application and those monitoring it.- Parameters:
name
- host name.- Returns:
this Builder
instance.- Throws:
java.lang.IllegalArgumentException
- ifname
is eithernull
or empty.
-
appName
public PersistentStatusMessage.Builder appName(java.lang.String name)
Sets application name to given value.- Parameters:
name
- application name.- Returns:
this Builder
instance.- Throws:
java.lang.IllegalArgumentException
- ifname
is eithernull
or empty.
-
instance
public PersistentStatusMessage.Builder instance(MonitorId id)
Sets monitor identifier.- Parameters:
id
- unique monitor identifier.- Returns:
this Builder
instance.
-
actionLevel
public PersistentStatusMessage.Builder actionLevel(ActionLevel level)
Sets action level.- Parameters:
level
- action level.- Returns:
this Builder
instance.- Throws:
java.lang.NullPointerException
- iflevel
isnull
.
-
actionName
public PersistentStatusMessage.Builder actionName(java.lang.String name)
Sets action name.- Parameters:
name
- action name.- Returns:
this Builder
instance.- Throws:
java.lang.IllegalArgumentException
- ifname
is eithernull
or an empty string.
-
actionMessage
public PersistentStatusMessage.Builder actionMessage(@Nullable java.lang.String message)
Sets action message.- Parameters:
message
- action message. May be eithernull
or an empty string.- Returns:
this Builder
instance.
-
-