Annotation Interface GetValue


@Target(PARAMETER) @Retention(RUNTIME) public @interface GetValue
A parameter source annotation that gets a value for a certain data key.

This value can be taken from the event cause's first ValueContainer, or any preceding parameter that inherits from ValueContainer.

When looking for a value, searching will start from the parameter immediately before the annotated one, moving backwards and checking the first ValueContainer in the event cause last.

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The name of the field in container() providing this key.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The holder class to fetch keys from.
  • Element Details

    • value

      String value
      The name of the field in container() providing this key.

      This field must be static and have a value of type Key

      Returns:
      the name of the key field to require
    • container

      Class<?> container
      The holder class to fetch keys from.
      Returns:
      the key container, by default Keys
      Default:
      org.spongepowered.api.data.Keys.class