Interface AppEvent

All Known Implementing Classes:
BasicAppEvent

public interface AppEvent
An application event.

Application events are generated by SolarNetwork applications themselves. This has been modeled after org.osgi.service.event.Event to help working in non-OSGi environments.

Since:
2.0
Version:
1.0
Author:
matt
  • Method Details

    • getTopic

      String getTopic()
      Get the event topic.

      By convention topics are path-like structures like datum/agg/calculated.

      Returns:
      the event topic, never null
    • getCreated

      Instant getCreated()
      Get the date the event was created.
      Returns:
      the creation date, never null
    • getEventProperties

      Map<String,?> getEventProperties()
      Get the properties of the event.

      The available properties is topic-specific.

      Returns:
      the event properties, never null
    • containsProperty

      default boolean containsProperty(String key)
      Test if a event property is available.
      Parameters:
      key - the event property name to test
      Returns:
      true if a non-null property exists for key
    • getPropertyNames

      default String[] getPropertyNames()
      Get all available property names as an array.
      Returns:
      the available property names, never null
    • getProperty

      default Object getProperty(String key)
      Get an event property by key.
      Parameters:
      key - the event property name to get
      Returns:
      the associated property value, or null if not available
    • getProperty

      default <T> T getProperty(String key, Class<T> type)
      Get an event property of a specific type.
      Type Parameters:
      T - the type of property value expected
      Parameters:
      key - the property key to get
      type - the property type
      Returns:
      the associated property value, or null if not available or not of type T