Interface EventContextKey<T>

Type Parameters:
T - The type of the value stored with this key
All Superinterfaces:
Keyed, ResourceKeyed

@CatalogedBy(EventContextKeys.class) public interface EventContextKey<T> extends ResourceKeyed
A key for values in the EventContext.
  • Nested Class Summary Link icon

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
     
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    Gets the allowed type for the value of this key.
    Creates a builder to be used for creating a new EventContextKey.
    cast(Object value)
    Cast the provided value to the value type.
    boolean
    Return whether the value is an instance of this key's value type.

    Methods inherited from interface org.spongepowered.api.ResourceKeyed Link icon

    key
  • Method Details Link icon

    • builder Link icon

      static EventContextKey.Builder<?> builder()
      Creates a builder to be used for creating a new EventContextKey.
      Returns:
      The constructed builder
    • allowedType Link icon

      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 Link icon

      boolean isInstance(Object value)
      Return whether the value is an instance of this key's value type.
      Parameters:
      value - value to check
      Returns:
      if instance
    • cast Link icon

      T cast(Object value)
      Cast the provided value to the value type.
      Parameters:
      value - value
      Returns:
      the casted value
      Throws:
      ClassCastException - if value is not of the correct type