Class SignalKey<T>
java.lang.Object
me.tamkungz.signals.SignalKey<T>
- Type Parameters:
T- payload type
Identifies one signal channel: a payload type plus a name.
Keys with the same type and name address the same channel; derived keys created by
Signal.filter(Predicate) and Signal.map(Class, Function) are always unique.
Primitive payload types are boxed, so int.class and Integer.class address the same channel
and eventType() reports Integer.class for both.
-
Method Summary
Modifier and TypeMethodDescriptionCasts a value to this key's payload type.booleanReturns the payload type, with primitives boxed.inthashCode()name()Returns the channel name.static <T> SignalKey<T> Returns the key of a named channel for a payload type.static <T> SignalKey<T> Returns the default key of a payload type, the same asnamed(eventType, "default").toString()
-
Method Details
-
of
-
named
-
eventType
-
name
-
cast
Casts a value to this key's payload type.- Parameters:
value- value to cast, may benull- Returns:
- the value as
T - Throws:
ClassCastException- if the value is not an instance of the payload type
-
equals
-
hashCode
-
toString
-