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 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.Builderadd(Supplier<EventContextKey<T>> key, T value)Adds the given context key value pair to the context.<T> EventContext.Builderadd(EventContextKey<T> key, T value)Adds the given context key value pair to the context.EventContextbuild()Creates a newEventContext.EventContext.Builderfrom(EventContext value)Resets this builder to the values of the given built object.EventContext.Builderreset()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(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:CopyableBuilderResets this builder to the values of the given built object.- Specified by:
fromin interfaceCopyableBuilder<EventContext,EventContext.Builder>- Parameters:
value- The built object- Returns:
- This builder, for chaining
-
reset
public EventContext.Builder reset()
Description copied from interface:BuilderResets 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:
resetin interfaceBuilder<EventContext,EventContext.Builder>- Specified by:
resetin interfaceResettableBuilder<EventContext,EventContext.Builder>- Returns:
- This builder, for chaining
-
build
public EventContext build()
Creates a newEventContext.- Specified by:
buildin interfaceAbstractBuilder<EventContext>- Specified by:
buildin interfaceBuildable.Builder<EventContext>- Returns:
- The EventContext
-
-