Package org.spongepowered.api.event
Interface EventContextKey<T>
- Type Parameters:
T
- The type of the value stored with this key
- All Superinterfaces:
Keyed
,ResourceKeyed
A key for values in the
EventContext
.-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets the allowed type for the value of this key.static EventContextKey.Builder
<?> builder()
Creates a builder to be used for creating a newEventContextKey
.Cast the provided value to the value type.boolean
isInstance
(Object value) Return whether the value is an instance of this key's value type.Methods inherited from interface org.spongepowered.api.ResourceKeyed
key
-
Method Details
-
builder
Creates a builder to be used for creating a newEventContextKey
.- Returns:
- The constructed builder
-
allowedType
Type allowedType()Gets the allowed type for the value of this key.This is a concrete type equal to the parameter
T
- Returns:
- The allowed type
-
isInstance
Return whether the value is an instance of this key's value type.- Parameters:
value
- value to check- Returns:
- if instance
-
cast
Cast the provided value to the value type.- Parameters:
value
- value- Returns:
- the casted value
- Throws:
ClassCastException
- ifvalue
is not of the correct type
-