Record Class Topic<T>
java.lang.Object
java.lang.Record
com.iantapply.relay.api.Topic<T>
- Type Parameters:
T- payload type- Record Components:
name- stable topic name shared by publishers and subscriberscodec- payload codec
A named messaging route paired with the codec for its payload type.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncodec()Returns the value of thecodecrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static booleanisValidName(String name) Tests whether a name can be used as a Relay topic.name()Returns the value of thenamerecord component.static <T> Topic<T> of(String name, MessageCodec<T> codec) Creates and validates a topic.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Topic
Validates a topic name and codec.- Parameters:
name- topic namecodec- payload codec
-
-
Method Details
-
of
Creates and validates a topic.- Type Parameters:
T- payload type- Parameters:
name- topic namecodec- payload codec- Returns:
- validated topic
-
isValidName
Tests whether a name can be used as a Relay topic.- Parameters:
name- candidate name- Returns:
trueif the name is valid
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
name
-
codec
-