public class ResultEvent
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private com.google.gson.JsonElement |
data |
private static com.google.gson.Gson |
GSON |
private java.lang.String |
jid |
private java.lang.String |
minionId |
private static java.util.regex.Pattern |
PATTERN |
Constructor and Description |
---|
ResultEvent(java.lang.String jid,
java.lang.String minionId,
com.google.gson.JsonElement data)
Creates a new ResultEvent
|
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.lang.Object> |
getData()
Return event data as Map
|
<R> R |
getData(java.lang.Class<R> type)
Return this event's data parsed into the given type.
|
<R> R |
getData(com.google.gson.reflect.TypeToken<R> type)
Return the event data parsed into the given type.
|
java.lang.String |
getJid()
The job id to which the result belongs
|
java.lang.String |
getMinionId()
The id of the minion from which the result came
|
static java.util.Optional<ResultEvent> |
parse(Event event)
Utility method to parse e generic event to a more specific one
|
private static final java.util.regex.Pattern PATTERN
private static final com.google.gson.Gson GSON
private final java.lang.String jid
private final java.lang.String minionId
private final com.google.gson.JsonElement data
public ResultEvent(java.lang.String jid, java.lang.String minionId, com.google.gson.JsonElement data)
jid
- the id of the job this event is aboutminionId
- the id of the minion sending the eventdata
- data containing more information about this eventpublic java.lang.String getJid()
public java.lang.String getMinionId()
public java.util.Map<java.lang.String,java.lang.Object> getData()
public <R> R getData(com.google.gson.reflect.TypeToken<R> type)
R
- type to parse the data intotype
- type token to parse datapublic <R> R getData(java.lang.Class<R> type)
R
- type to parse the data intotype
- class to parse datapublic static java.util.Optional<ResultEvent> parse(Event event)
event
- the generic event to parse