Package org.spongepowered.api.event
Interface CauseStackManager.StackFrame
-
- All Superinterfaces:
AutoCloseable
- Enclosing interface:
- CauseStackManager
public static interface CauseStackManager.StackFrame extends AutoCloseable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default <T> CauseStackManager.StackFrame
addContext(Supplier<EventContextKey<T>> key, Supplier<? extends T> value)
Adds the given object to the current context under the given key.default <T> CauseStackManager.StackFrame
addContext(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, 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.Object
popCause()
Pops the most recently pushed cause object off of the stack and returns it.CauseStackManager.StackFrame
pushCause(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> Optional<T>
removeContext(Supplier<EventContextKey<T>> key)
Removes the given context key from the current context.<T> 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(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
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, 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(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(Supplier<EventContextKey<T>> key, 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> 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> Optional<T> removeContext(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 interfaceAutoCloseable
-
-