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>(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, @Nullable String name) A tuple representing aComponent'suniqueness, consisting out of aclazzandname.Identifier(Type type, @Nullable String name) A tuple representing aComponent'suniqueness, consisting out of atypeandname.Identifier(TypeReference<C> type, @Nullable 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) booleanmatchesByTypeRef(Component.Identifier<?> other) Validate whether the givenotheridentifier matches withthisidentifier, by matching thenamesand thetype references.booleanmatchesType(Component.Identifier<?> other) booleanmatchesTypeByTypeRef(Component.Identifier<?> other) @Nullable Stringname()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 givenotheridentifier matches withthisidentifier, by matching thenamesand theraw types. Types are considered matching if the raw type of this isassignable fromthe raw type of theotheridentifier.- Parameters:
other- the other identifier to compare with this identifier- Returns:
trueif theraw typeisassignable fromtheothertype and thename()is identical,falseotherwise
-
matchesType
Validate whether theraw typesof the givenotheridentifier andthisidentifier match. Types are considered matching if the raw type of this isassignable fromthe raw type of theotheridentifier.- Parameters:
other- the other identifier to compare with this identifier- Returns:
trueif theraw typeisassignable fromtheothertype,falseotherwise.
-
matchesByTypeRef
Validate whether the givenotheridentifier matches withthisidentifier, by matching thenamesand thetype references. Types are considered matching if the type reference of this isassignable fromthe type reference of theotheridentifier.- Parameters:
other- the other identifier to compare with this identifier- Returns:
trueif thetype()isassignable fromtheothertype and thename()is identical,falseotherwise
-
matchesTypeByTypeRef
Validate whether theraw typesof the givenotheridentifier andthisidentifier match. Types are considered matching if the raw type of this isassignable fromthe raw type of theotheridentifier.- Parameters:
other- the other identifier to compare with this identifier- Returns:
trueif thetype()isassignable fromtheothertype,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
-