Class CauseKey<V>

java.lang.Object
org.inspirenxe.strata.api.event.cause.CauseKey<V>
Type Parameters:
V - the type of the value

public final class CauseKey<V> extends Object
A typed key for a value in a cause's context. Strata's own keys are in CauseKeys; a library or application can make its own. Keys are compared by identity, so keep each in a constant.
  • Method Details

    • of

      public static <V> CauseKey<V> of(String name, Class<V> type)
      Creates a key.
      Type Parameters:
      V - the type of the value
      Parameters:
      name - a readable name, such as myapp:listing, for debugging
      type - the type of the value
      Returns:
      the new key
    • name

      public String name()
      Returns the key's name.
      Returns:
      the name given to of(String, Class)
    • type

      public Class<V> type()
      Returns the type of the key's value.
      Returns:
      the type given to of(String, Class)
    • toString

      public String toString()
      Returns the key's name, for debugging.
      Overrides:
      toString in class Object
      Returns:
      for example CauseKey[strata:origin]