public class EventFactorySupport
extends java.lang.Object
Event
objects.
This class can be used as a simple utility class when you need to create common event objects. Alternatively you could extend it as a base support class when creating custom event factories.
Constructor and Description |
---|
EventFactorySupport() |
Modifier and Type | Method and Description |
---|---|
Event |
error(java.lang.Object source)
Returns an "error" event.
|
Event |
error(java.lang.Object source,
java.lang.Exception e)
Returns an "error" event caused by the provided exception.
|
Event |
event(java.lang.Object source,
boolean booleanResult)
Returns an event to communicate an occurrence of a boolean expression.
|
Event |
event(java.lang.Object source,
java.lang.String eventId)
Returns a event with the specified identifier.
|
Event |
event(java.lang.Object source,
java.lang.String eventId,
AttributeMap<java.lang.Object> attributes)
Returns a event with the specified identifier and the specified set of attributes.
|
Event |
event(java.lang.Object source,
java.lang.String eventId,
java.lang.String attributeName,
java.lang.Object attributeValue)
Returns a result event with the specified identifier and a single attribute.
|
java.lang.String |
getErrorEventId() |
java.lang.String |
getExceptionAttributeName() |
java.lang.String |
getNoEventId() |
java.lang.String |
getNullEventId() |
java.lang.String |
getResultAttributeName() |
java.lang.String |
getSuccessEventId() |
java.lang.String |
getYesEventId() |
Event |
no(java.lang.Object source)
Returns a "no" result event.
|
void |
setErrorEventId(java.lang.String errorEventId) |
void |
setExceptionAttributeName(java.lang.String exceptionAttributeName) |
void |
setNoEventId(java.lang.String noEventId) |
void |
setNullEventId(java.lang.String nullEventId) |
void |
setResultAttributeName(java.lang.String resultAttributeName) |
void |
setSuccessEventId(java.lang.String successEventId) |
void |
setYesEventId(java.lang.String yesEventId) |
Event |
success(java.lang.Object source)
Returns a "success" event.
|
Event |
success(java.lang.Object source,
java.lang.Object result)
Returns a "success" event with the provided result object as an attribute.
|
Event |
yes(java.lang.Object source)
Returns a "yes" event.
|
public java.lang.String getSuccessEventId()
public void setSuccessEventId(java.lang.String successEventId)
public java.lang.String getErrorEventId()
public void setErrorEventId(java.lang.String errorEventId)
public java.lang.String getYesEventId()
public void setYesEventId(java.lang.String yesEventId)
public java.lang.String getNoEventId()
public void setNoEventId(java.lang.String noEventId)
public java.lang.String getNullEventId()
public void setNullEventId(java.lang.String nullEventId)
public java.lang.String getExceptionAttributeName()
public void setExceptionAttributeName(java.lang.String exceptionAttributeName)
public java.lang.String getResultAttributeName()
public void setResultAttributeName(java.lang.String resultAttributeName)
public Event success(java.lang.Object source)
source
- the source of the eventpublic Event success(java.lang.Object source, java.lang.Object result)
getResultAttributeName()
.source
- the source of the eventresult
- the action success resultpublic Event error(java.lang.Object source)
source
- the source of the eventpublic Event error(java.lang.Object source, java.lang.Exception e)
source
- the source of the evente
- the exception that caused the error event, to be put as an event attribute under the name
getExceptionAttributeName()
public Event yes(java.lang.Object source)
source
- the source of the eventpublic Event no(java.lang.Object source)
source
- the source of the eventpublic Event event(java.lang.Object source, boolean booleanResult)
source
- the source of the eventbooleanResult
- the booleanpublic Event event(java.lang.Object source, java.lang.String eventId)
source
- the source of the eventeventId
- the result event identifierpublic Event event(java.lang.Object source, java.lang.String eventId, AttributeMap<java.lang.Object> attributes)
source
- the source of the eventeventId
- the result event identifierattributes
- the event payload attributespublic Event event(java.lang.Object source, java.lang.String eventId, java.lang.String attributeName, java.lang.Object attributeValue)
source
- the source of the eventeventId
- the result idattributeName
- the attribute nameattributeValue
- the attribute value