Package org.spongepowered.api.event
Interface CauseStackManager.StackFrame
-
- All Superinterfaces:
java.lang.AutoCloseable
- Enclosing interface:
- CauseStackManager
public static interface CauseStackManager.StackFrame extends java.lang.AutoCloseable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default <T> CauseStackManager.StackFrame
addContext(java.util.function.Supplier<EventContextKey<T>> key, java.util.function.Supplier<? extends T> value)
Adds the given object to the current context under the given key.default <T> CauseStackManager.StackFrame
addContext(java.util.function.Supplier<EventContextKey<T>> key, T value)
Adds the given object to the current context under the given key.default <T> CauseStackManager.StackFrame
addContext(EventContextKey<T> key, java.util.function.Supplier<? extends T> value)
Adds the given object to the current context under the given key.<T> CauseStackManager.StackFrame
addContext(EventContextKey<T> key, T value)
Adds the given object to the current context under the given key.void
close()
Cause
currentCause()
Gets the currentCause
object from the current cause stack.EventContext
currentContext()
Gets anEventContext
object on the current contextual information.java.lang.Object
popCause()
Pops the most recently pushed cause object off of the stack and returns it.CauseStackManager.StackFrame
pushCause(java.lang.Object obj)
Pushes an object to the current cause stack which will associate it with all events through from api actions until it is popped off again.default <T> java.util.Optional<T>
removeContext(java.util.function.Supplier<EventContextKey<T>> key)
Removes the given context key from the current context.<T> java.util.Optional<T>
removeContext(EventContextKey<T> key)
Removes the given context key from the current context.
-
-
-
Method Detail
-
currentCause
Cause currentCause()
Gets the currentCause
object from the current cause stack.- Returns:
- A cause of the current stack.
- See Also:
CauseStackManager.currentCause()
-
currentContext
EventContext currentContext()
Gets anEventContext
object on the current contextual information.- Returns:
- The current event context
- See Also:
CauseStackManager.currentContext()
-
pushCause
CauseStackManager.StackFrame pushCause(java.lang.Object obj)
Pushes an object to the current cause stack which will associate it with all events through from api actions until it is popped off again.- Parameters:
obj
- The object to push to the stack- Returns:
- The stack frame, for chaining
- See Also:
CauseStackManager.pushCause(Object)
-
popCause
java.lang.Object popCause()
Pops the most recently pushed cause object off of the stack and returns it.- Returns:
- The last pushed object
- See Also:
CauseStackManager.popCause()
-
addContext
<T> CauseStackManager.StackFrame addContext(EventContextKey<T> key, T value)
Adds the given object to the current context under the given key.- Type Parameters:
T
- The type of value key- Parameters:
key
- The context keyvalue
- The object- Returns:
- The stack frame, for chaining
- See Also:
EventContextKeys
,CauseStackManager.addContext(EventContextKey, Object)
-
addContext
default <T> CauseStackManager.StackFrame addContext(EventContextKey<T> key, java.util.function.Supplier<? extends T> value)
Adds the given object to the current context under the given key.- Type Parameters:
T
- The type of value key- Parameters:
key
- The context keyvalue
- The object- Returns:
- The stack frame, for chaining
- See Also:
EventContextKeys
,CauseStackManager.addContext(EventContextKey, Object)
-
addContext
default <T> CauseStackManager.StackFrame addContext(java.util.function.Supplier<EventContextKey<T>> key, T value)
Adds the given object to the current context under the given key.- Type Parameters:
T
- The type of value key- Parameters:
key
- The context keyvalue
- The object- Returns:
- The stack frame, for chaining
- See Also:
EventContextKeys
,CauseStackManager.addContext(EventContextKey, Object)
-
addContext
default <T> CauseStackManager.StackFrame addContext(java.util.function.Supplier<EventContextKey<T>> key, java.util.function.Supplier<? extends T> value)
Adds the given object to the current context under the given key.- Type Parameters:
T
- The type of value key- Parameters:
key
- The context keyvalue
- The object- Returns:
- The stack frame, for chaining
- See Also:
EventContextKeys
,CauseStackManager.addContext(EventContextKey, Object)
-
removeContext
<T> java.util.Optional<T> removeContext(EventContextKey<T> key)
Removes the given context key from the current context.- Type Parameters:
T
- The type of value key- Parameters:
key
- The key to clear- Returns:
- The existing context value, if it was present
- See Also:
EventContextKeys
,CauseStackManager.removeContext(EventContextKey)
-
removeContext
default <T> java.util.Optional<T> removeContext(java.util.function.Supplier<EventContextKey<T>> key)
Removes the given context key from the current context.- Type Parameters:
T
- The type of value key- Parameters:
key
- The key to clear- Returns:
- The existing context value, if it was present
- See Also:
EventContextKeys
,CauseStackManager.removeContext(EventContextKey)
-
close
void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
-
-