Class EngineEvent


  • public class EngineEvent
    extends java.lang.Object
    Represents an event fired by engines
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String additional  
      private com.google.gson.JsonElement data  
      private java.lang.String engine  
      private static com.google.gson.Gson GSON  
      private java.util.Optional<java.lang.String> minionId  
      private static java.util.regex.Pattern PATTERN  
      private java.lang.String timestamp  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private EngineEvent​(java.lang.String engine, java.lang.String additional, java.lang.String timestamp, java.util.Optional<java.lang.String> minionId, com.google.gson.JsonElement data)
      Creates a new EngineEvent
    • 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 engine
      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 getEngine()
      Returns the engine name.
      java.util.Optional<java.lang.String> getMinionId()
      Returns the id of the minion that triggered the engine event
      java.lang.String getTimestamp()
      Returns the timestamp of the event
      static java.util.Optional<EngineEvent> parse​(Event event)
      Utility method to parse e generic event to a more specific one
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • PATTERN

        private static final java.util.regex.Pattern PATTERN
      • GSON

        private static final com.google.gson.Gson GSON
      • engine

        private final java.lang.String engine
      • timestamp

        private final java.lang.String timestamp
      • additional

        private final java.lang.String additional
      • minionId

        private final java.util.Optional<java.lang.String> minionId
      • data

        private final com.google.gson.JsonElement data
    • Constructor Detail

      • EngineEvent

        private EngineEvent​(java.lang.String engine,
                            java.lang.String additional,
                            java.lang.String timestamp,
                            java.util.Optional<java.lang.String> minionId,
                            com.google.gson.JsonElement data)
        Creates a new EngineEvent
        Parameters:
        engine - the engine name
        additional - additional information depending on the engine
        timestamp - datetime of the event
        minionId - minion id if the event comes from a minion, empty it comes from the master
        data - data containing more information about this event
    • Method Detail

      • getEngine

        public java.lang.String getEngine()
        Returns the engine name.
        Returns:
        the engine name
      • getAdditional

        public java.lang.String getAdditional()
        Provides additional information from the tag depending on the type of engine
        Returns:
        additional information
      • getTimestamp

        public java.lang.String getTimestamp()
        Returns the timestamp of the event
        Returns:
        the timestamp
      • getMinionId

        public java.util.Optional<java.lang.String> getMinionId()
        Returns the id of the minion that triggered the engine event
        Returns:
        the minion id
      • 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<EngineEvent> 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