public class BeaconEvent
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
additional |
private java.lang.String |
beacon |
private com.google.gson.JsonElement |
data |
private static com.google.gson.Gson |
GSON |
private java.lang.String |
minionId |
private static java.util.regex.Pattern |
PATTERN |
Modifier | Constructor and Description |
---|---|
private |
BeaconEvent(java.lang.String minionId,
java.lang.String beacon,
java.lang.String additional,
com.google.gson.JsonElement data)
Creates a new BeaconEvent
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAdditional()
Provides additional information from the tag depending on the type of beacon
|
java.lang.String |
getBeacon()
Returns the beacon name.
|
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 |
getMinionId()
Returns the id of the minion that triggered the beacon
|
static java.util.Optional<BeaconEvent> |
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 beacon
private final java.lang.String minionId
private final java.lang.String additional
private final com.google.gson.JsonElement data
private BeaconEvent(java.lang.String minionId, java.lang.String beacon, java.lang.String additional, com.google.gson.JsonElement data)
minionId
- the id of the minion sending the eventbeacon
- the beacon nameadditional
- additional information depending on the beacondata
- data containing more information about this eventpublic java.lang.String getBeacon()
public java.lang.String getMinionId()
public java.lang.String getAdditional()
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 java.util.Map<java.lang.String,java.lang.Object> getData()
public static java.util.Optional<BeaconEvent> parse(Event event)
event
- the generic event to parse