Record Class QualifiedName

java.lang.Object
java.lang.Record
org.axonframework.messaging.core.QualifiedName
Record Components:
name - The qualifiedName of this QualifiedName. Must not be null or empty.

public record QualifiedName(@Nonnull String name) extends Record
Interface describing a qualified qualifiedName, providing space for a namespace, local qualifiedName.

The given qualifiedName uses a dot . as the separator between the namespace and local qualifiedName. When multiple dots are present in the qualifiedName, the local qualifiedName constitutes the trailing text after the last dot. Thus, the namespace as all the text before the last dot.

The QualifiedName is useful to provide clear names to Messages, MessageHandlers, and other components that require naming. To combine a qualified qualifiedName with a version, consider using the MessageType.

Since:
5.0.0
Author:
Allard Buijze, Mitchell Herrijgers, Steven van Beelen
See Also:
  • Constructor Details

    • QualifiedName

      public QualifiedName(@Nonnull String name)
      Compact constructor asserting whether the qualifiedName is non-null and not empty.
    • QualifiedName

      public QualifiedName(String namespace, @Nonnull String localName)
      Constructor providing combining the given namespace and localName, delimited by a dot ..

      If the given namespace is an empty or null String, the name() becomes the localName. If the localName is empty or null, an IllegalArgumentException will be thrown.

      Parameters:
      namespace - The first part of the name().
      localName - The last part of the name().
    • QualifiedName

      public QualifiedName(@Nonnull Class<?> clazz)
      Constructor taking the Class.getName() as the name() of the QualifiedName under construction.
      Parameters:
      clazz - The Class from which to use the Class.getName() as the name().
  • Method Details

    • namespace

      @Nullable public String namespace()
    • localName

      @Nonnull public String localName()
    • toString

      public String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • fullName

      public String fullName()
      Returns the full name of this QualifiedName, consisting of the namespace and localName, separated by a "." (dot). If no namespace is defined, it returns the localName only.
      Returns:
      the full name of this QualifiedName
      See Also:
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      @Nonnull public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component