Package org.axonframework.messaging.core
Record Class MessageType
java.lang.Object
java.lang.Record
org.axonframework.messaging.core.MessageType
- Record Components:
qualifiedName- TheQualifiedNameof thisMessageType.version- the version of thisMessageType.
Record combining a
qualified name and version.
The QualifiedName is useful to provide clear names to Messages,
MessageHandlers, and other components that require naming.
When you do not require a version for typing, consider using the QualifiedName directly instead.
- Since:
- 5.0.0
- Author:
- Allard Buijze, Mateusz Nowak, Steven van Beelen
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe default version of aMessageTypewhen none is given. -
Constructor Summary
ConstructorsConstructorDescriptionMessageType(Class<?> clazz) AMessageTypeconstructor using the givenclazzto invoke theQualifiedName(Class)constructor to derive thequalifiedNamefor thisMessageType.MessageType(Class<?> clazz, String version) AMessageTypeconstructor using the givenclazzto invoke theQualifiedName(Class)constructor to derive thequalifiedNamefor thisMessageType.MessageType(String qualifiedName) AMessageTypeconstructor using the givenqualifiedNameinvoking theQualifiedName(String)constructor.MessageType(String qualifiedName, String version) AMessageTypeconstructor using the givenqualifiedNameto invoke theQualifiedName(String)constructor to derive thequalifiedNamefor thisMessageType.MessageType(String namespace, String localName, String version) AMessageTypeconstructor using the givennamespaceandlocalNameto invoke theQualifiedName(String, String)constructor to derive thequalifiedNamefor thisMessageType.MessageType(QualifiedName name) AMessageTypeconstructor setting theversiontonull.MessageType(QualifiedName qualifiedName, String version) Compact constructor validating that the givenqualifiedNameis non-null. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.static MessageTypefromString(String messageTypeString) Reconstruct aMessageTypebased on the output oftoString().final inthashCode()Returns a hash code value for this object.name()Returns the value of thequalifiedNamerecord component.toString()The output ofMessageType#toString()is a concatenation of thequalifiedName()andversion(), split by means of a hashtag (#).version()Returns the value of theversionrecord component.
-
Field Details
-
DEFAULT_VERSION
The default version of aMessageTypewhen none is given. Set to0.0.1.- See Also:
-
-
Constructor Details
-
MessageType
Compact constructor validating that the givenqualifiedNameis non-null. -
MessageType
AMessageTypeconstructor setting theversiontonull.- Parameters:
name- TheQualifiedNameof thisMessageType.
-
MessageType
AMessageTypeconstructor using the givenqualifiedNameinvoking theQualifiedName(String)constructor. Theversionis fixed tonull.- Parameters:
qualifiedName- The qualifiedName for theQualifiedNamefor theMessageTypeunder construction.
-
MessageType
AMessageTypeconstructor using the givenqualifiedNameto invoke theQualifiedName(String)constructor to derive thequalifiedNamefor thisMessageType.- Parameters:
qualifiedName- The qualified qualifiedName used to invokeQualifiedName(String)constructor for theMessageTypeunder construction.version- The version for theMessageTypeunder construction.
-
MessageType
AMessageTypeconstructor using the givennamespaceandlocalNameto invoke theQualifiedName(String, String)constructor to derive thequalifiedNamefor thisMessageType.- Parameters:
namespace- The namespace used to invokeQualifiedName(String, String)constructor for theMessageTypeunder construction.localName- The local qualifiedName used to invokeQualifiedName(String, String)constructor for theMessageTypeunder construction.version- The version for theMessageTypeunder construction.
-
MessageType
AMessageTypeconstructor using the givenclazzto invoke theQualifiedName(Class)constructor to derive thequalifiedNamefor thisMessageType.- Parameters:
clazz- TheClassused to invokeQualifiedName(Class)constructor for theMessageTypeunder construction.version- The version for theMessageTypeunder construction.
-
MessageType
AMessageTypeconstructor using the givenclazzto invoke theQualifiedName(Class)constructor to derive thequalifiedNamefor thisMessageType. Theversionis fixed tonull.- Parameters:
clazz- TheClassused to invokeQualifiedName(Class)constructor for theMessageTypeunder construction.
-
-
Method Details
-
name
- Returns:
- The outcome
QualifiedName.name()of thisMessageType'sQualifiedName.
-
fromString
Reconstruct aMessageTypebased on the output oftoString().The output of
MessageType#toString()is a concatenation of thequalifiedName()andversion(), split by means of a hashtag (#).Thus, if the given
Stringequals"my.context.BusinessName#1.0.5", the#qualifiedName()is set to aQualifiedNameof"my.context.BusinessName"and theversion()is set to"1.0.5".- Parameters:
messageTypeString- The output oftoString(), given to reconstruct it into aMessageType.- Returns:
- A reconstructed
MessageTypebased on the expected output oftoString().
-
toString
The output ofMessageType#toString()is a concatenation of thequalifiedName()andversion(), split by means of a hashtag (#).Thus, if
#qualifiedName()returns"my.context.BusinessName"and the#version()returns"1.0.5", the result of this operation would be"my.context.BusinessName#1.0.5".- Specified by:
toStringin classRecord- Returns:
- A combination of the
qualifiedName()andversion(), separated by a hashtag.
-
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). -
qualifiedName
Returns the value of thequalifiedNamerecord component.- Returns:
- the value of the
qualifiedNamerecord component
-
version
Returns the value of theversionrecord component.- Returns:
- the value of the
versionrecord component
-