Record Class Tag
java.lang.Object
java.lang.Record
org.axonframework.messaging.eventstreaming.Tag
An
Tag refers to fields and their values within which an EventMessage
has been published, typically referring to domain-specifics used for identification.
Such a Tag is typically used by the EventCriteria as a filter when
sourcing, streaming or appending events.
- Since:
- 5.0.0
- Author:
- Allard Buijze, Michal Negacz, Milan Savić, Marco Amann, Sara Pellegrini, Steven van Beelen
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ContextaddToContext(Context context, Set<Tag> tags) final booleanIndicates whether some other object is "equal to" this one.fromContext(Context context) Returns anOptionalofTags, returning the resource keyed under theRESOURCE_KEYin the givencontext.final inthashCode()Returns a hash code value for this object.key()Returns the value of thekeyrecord component.static TagCreates a newTagwith the givenkeyandvalue.final StringtoString()Returns a string representation of this record class.value()Returns the value of thevaluerecord component.
-
Field Details
-
RESOURCE_KEY
-
-
Constructor Details
-
Tag
Compact constructor validating that the givenkeyandvalueare notnull.
-
-
Method Details
-
addToContext
- Parameters:
context- TheContextto add the giventokento.tags- TheSetofTagsto add to the givencontextusing theRESOURCE_KEY.
-
fromContext
Returns anOptionalofTags, returning the resource keyed under theRESOURCE_KEYin the givencontext.- Parameters:
context- TheContextto retrieve theTagsfrom, if present.- Returns:
- An
OptionalofTags, returning the resource keyed under theRESOURCE_KEYin the givencontext.
-
of
Creates a newTagwith the givenkeyandvalue.- Parameters:
key- The key of the newTag.value- The value of the newTag.- Returns:
- A new
Tagwith the givenkeyandvalue.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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). -
key
Returns the value of thekeyrecord component.- Returns:
- the value of the
keyrecord component
-
value
Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-