Package net.solarnetwork.event
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 Summary
Modifier and TypeMethodDescriptiondefault booleancontainsProperty(String key) Test if a event property is available.Get the date the event was created.Get the properties of the event.default ObjectgetProperty(String key) Get an event property by key.default <T> TgetProperty(String key, Class<T> type) Get an event property of a specific type.default String[]Get all available property names as an array.getTopic()Get the event topic.
-
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
Get the properties of the event.The available properties is topic-specific.
- Returns:
- the event properties, never null
-
containsProperty
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
Get all available property names as an array.- Returns:
- the available property names, never null
-
getProperty
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
Get an event property of a specific type.- Type Parameters:
T- the type of property value expected- Parameters:
key- the property key to gettype- the property type- Returns:
- the associated property value, or null if not
available or not of type
T
-