Annotation Interface Has


@Target(PARAMETER) @Retention(RUNTIME) public @interface Has
Filters a parameter in an event @Listener method to only one that has a value for certain data.

The parameter type must be DataHolder or one of its subtypes.

This is a filtering annotation, meaning it needs to be used in conjunction with one of the source annotations on a parameter.

  • 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.
    boolean
    If true then the behavior of this filter is reversed and the data holders having the specified key are excluded.
  • 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
    • inverse

      boolean inverse
      If true then the behavior of this filter is reversed and the data holders having the specified key are excluded.
      Returns:
      if the parameter filter is reversed
      Default:
      false