Record Class Component.Identifier<C>
java.lang.Object
java.lang.Record
org.axonframework.common.configuration.Component.Identifier<C>
- Type Parameters:
C- The type of the component this object identifies, typically an interface.- Record Components:
type- The type reference of the component this object identifies.name- The name of the component this object identifies, potentiallynullwhen unimportant. Will throw anIllegalArgumentExceptionfor an emptyname.
public static record Component.Identifier<C>(@Nonnull TypeReference<C> type, @Nullable String name)
extends Record
A tuple representing a
Component's uniqueness, consisting out of a type and name.-
Constructor Summary
ConstructorsConstructorDescriptionIdentifier(Class<C> clazz, String name) A tuple representing aComponent'suniqueness, consisting out of aclazzandname.Identifier(Type type, String name) A tuple representing aComponent'suniqueness, consisting out of atypeandname.Identifier(TypeReference<C> type, String name) Compact constructor asserting whether thetypeandnameare non-null and not empty. -
Method Summary
Modifier and TypeMethodDescriptionbooleanfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanmatches(Component.Identifier<?> other) Validate whether the givenother Identifiermatches withthis Identifier, by matching thenamesand checking if thetype()isClass.isAssignableFrom(Class)to giveothertype.booleanmatchesType(Component.Identifier<?> other) Validate whether the givenother Identifiertype matches withthis Identifiertype, by checking if thetype()isClass.isAssignableFrom(Class)to giveothertype.name()Returns the value of thenamerecord component.toString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.
-
Constructor Details
-
Identifier
A tuple representing aComponent'suniqueness, consisting out of aclazzandname.- Parameters:
clazz- The clazz of the component this object identifies, typically an interface.name- The name of the component this object identifies, potentiallynullwhen unimportant. Will throw anIllegalArgumentExceptionfor an emptyname.
-
Identifier
A tuple representing aComponent'suniqueness, consisting out of atypeandname.- Parameters:
type- The type of the component this object identifies, typically an interface.name- The name of the component this object identifies, potentiallynullwhen unimportant. Will throw anIllegalArgumentExceptionfor an emptyname.
-
Identifier
Compact constructor asserting whether thetypeandnameare non-null and not empty.- Parameters:
type- The type of the component.name- The name of the component.
-
-
Method Details
-
matches
Validate whether the givenother Identifiermatches withthis Identifier, by matching thenamesand checking if thetype()isClass.isAssignableFrom(Class)to giveothertype. -
matchesType
Validate whether the givenother Identifiertype matches withthis Identifiertype, by checking if thetype()isClass.isAssignableFrom(Class)to giveothertype.- Parameters:
other- The other identifier to compare with this identifier.- Returns:
trueif thetype()is assignable from theothertype,falseotherwise.
-
typeAsClass
-
areTypeAndNameEqual
public boolean areTypeAndNameEqual()- Returns:
truewhenever theClass.getName()of thisIdentifier'sgiventypeis equal to the givenname,falseotherwise.
-
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). -
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-