Package org.spongepowered.api.event
Class EventContext.Builder
- java.lang.Object
-
- org.spongepowered.api.event.EventContext.Builder
-
- All Implemented Interfaces:
AbstractBuilder<EventContext>
,Buildable.Builder<EventContext>
,Builder<EventContext,EventContext.Builder>
,CopyableBuilder<EventContext,EventContext.Builder>
,ResettableBuilder<EventContext,EventContext.Builder>
- Enclosing class:
- EventContext
public static final class EventContext.Builder extends java.lang.Object implements Builder<EventContext,EventContext.Builder>, CopyableBuilder<EventContext,EventContext.Builder>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> EventContext.Builder
add(java.util.function.Supplier<EventContextKey<T>> key, T value)
Adds the given context key value pair to the context.<T> EventContext.Builder
add(EventContextKey<T> key, T value)
Adds the given context key value pair to the context.EventContext
build()
Creates a newEventContext
.EventContext.Builder
from(EventContext value)
Resets this builder to the values of the given built object.EventContext.Builder
reset()
Resets this builder to a "default" state such that there is no remaining data to set.
-
-
-
Method Detail
-
add
public <T> EventContext.Builder add(EventContextKey<T> key, T value)
Adds the given context key value pair to the context.- Type Parameters:
T
- The type of the value stored with the key- Parameters:
key
- The keyvalue
- The value- Returns:
- This builder, for chaining
-
add
public <T> EventContext.Builder add(java.util.function.Supplier<EventContextKey<T>> key, T value)
Adds the given context key value pair to the context.- Type Parameters:
T
- The type of the value stored with the key- Parameters:
key
- The keyvalue
- The value- Returns:
- This builder, for chaining
-
from
public EventContext.Builder from(EventContext value)
Description copied from interface:CopyableBuilder
Resets this builder to the values of the given built object.- Specified by:
from
in interfaceCopyableBuilder<EventContext,EventContext.Builder>
- Parameters:
value
- The built object- Returns:
- This builder, for chaining
-
reset
public EventContext.Builder reset()
Description copied from interface:Builder
Resets this builder to a "default" state such that there is no remaining data to set. This is to be the presumed "default" state.- Specified by:
reset
in interfaceBuilder<EventContext,EventContext.Builder>
- Specified by:
reset
in interfaceResettableBuilder<EventContext,EventContext.Builder>
- Returns:
- This builder, for chaining
-
build
public EventContext build()
Creates a newEventContext
.- Specified by:
build
in interfaceAbstractBuilder<EventContext>
- Specified by:
build
in interfaceBuildable.Builder<EventContext>
- Returns:
- The EventContext
-
-