Package com.suse.salt.netapi.event
Class BeaconEvent
- java.lang.Object
-
- com.suse.salt.netapi.event.BeaconEvent
-
public class BeaconEvent extends java.lang.Object
Represents an event fired by beacons
-
-
Constructor Summary
Constructors Modifier Constructor Description private
BeaconEvent(java.lang.String minionId, java.lang.String beacon, java.lang.String additional, com.google.gson.JsonElement data)
Creates a new BeaconEvent
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getAdditional()
Provides additional information from the tag depending on the type of beaconjava.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(com.google.gson.reflect.TypeToken<R> type)
Return the event data parsed into the given type.<R> R
getData(java.lang.Class<R> type)
Return this event's data parsed into the given type.java.lang.String
getMinionId()
Returns the id of the minion that triggered the beaconstatic java.util.Optional<BeaconEvent>
parse(Event event)
Utility method to parse e generic event to a more specific one
-
-
-
Field Detail
-
PATTERN
private static final java.util.regex.Pattern PATTERN
-
GSON
private static final com.google.gson.Gson GSON
-
beacon
private final java.lang.String beacon
-
minionId
private final java.lang.String minionId
-
additional
private final java.lang.String additional
-
data
private final com.google.gson.JsonElement data
-
-
Constructor Detail
-
BeaconEvent
private BeaconEvent(java.lang.String minionId, java.lang.String beacon, java.lang.String additional, com.google.gson.JsonElement data)
Creates a new BeaconEvent- Parameters:
minionId
- the id of the minion sending the eventbeacon
- the beacon nameadditional
- additional information depending on the beacondata
- data containing more information about this event
-
-
Method Detail
-
getBeacon
public java.lang.String getBeacon()
Returns the beacon name.- Returns:
- the beacon name
-
getMinionId
public java.lang.String getMinionId()
Returns the id of the minion that triggered the beacon- Returns:
- the minion id
-
getAdditional
public java.lang.String getAdditional()
Provides additional information from the tag depending on the type of beacon- Returns:
- additional information
-
getData
public <R> R getData(com.google.gson.reflect.TypeToken<R> type)
Return the event data parsed into the given type.- Type Parameters:
R
- type to parse the data into- Parameters:
type
- type token to parse data- Returns:
- the event data
-
getData
public <R> R getData(java.lang.Class<R> type)
Return this event's data parsed into the given type.- Type Parameters:
R
- type to parse the data into- Parameters:
type
- class to parse data- Returns:
- the data
-
getData
public java.util.Map<java.lang.String,java.lang.Object> getData()
Return event data as Map- Returns:
- event data as map
-
parse
public static java.util.Optional<BeaconEvent> parse(Event event)
Utility method to parse e generic event to a more specific one- Parameters:
event
- the generic event to parse- Returns:
- an option containing the parsed value or non if it could not be parsed
-
-