| Modifier and Type | Class and Description |
|---|---|
static class |
EventContext.Builder |
| Modifier and Type | Method and Description |
|---|---|
Map<EventContextKey<?>,Object> |
asMap()
Gets this event context as a
Map of EventContextKeys to Objects. |
static EventContext.Builder |
builder()
Creates a new builder for creating an
EventContext. |
boolean |
containsKey(EventContextKey<?> key)
Gets whether the provided
EventContextKey is included in this
context. |
static EventContext |
empty()
Gets an empty context.
|
boolean |
equals(Object object) |
<T> Optional<T> |
get(EventContextKey<T> key)
Gets the value corresponding to the given key from the context.
|
int |
hashCode() |
Set<EventContextKey<?>> |
keySet()
Gets all
EventContextKeys present in this context. |
static EventContext |
of(Map<EventContextKey<?>,Object> entries)
Creates a new
EventContext from the given map of entries. |
<T> T |
require(EventContextKey<T> key)
Gets the value corresponding to the given key from the context.
|
String |
toString() |
public static EventContext empty()
public static EventContext of(Map<EventContextKey<?>,Object> entries)
EventContext from the given map of entries.entries - The context entriespublic static EventContext.Builder builder()
EventContext.public <T> Optional<T> get(EventContextKey<T> key)
T - The type of the value stored with the keykey - The keypublic <T> T require(EventContextKey<T> key)
If the key is not available, NoSuchElementException will be
thrown.
T - The type of the value stored with the keykey - The keypublic boolean containsKey(EventContextKey<?> key)
EventContextKey is included in this
context.key - The context key to checkpublic Set<EventContextKey<?>> keySet()
EventContextKeys present in this context.public Map<EventContextKey<?>,Object> asMap()
Map of EventContextKeys to Objects.