Record Class StateRebuildingCache.CacheKey<I>

java.lang.Object
java.lang.Record
com.opencqrs.framework.command.cache.StateRebuildingCache.CacheKey<I>
Type Parameters:
I - the generic instance type being cached
Record Components:
subject - the corresponding Command.getSubject()
instanceClass - the corresponding CommandHandlerDefinition.instanceClass() and those of its StateRebuildingHandlerDefinitions.
sourcingMode - the corresponding CommandHandlerDefinition.sourcingMode()
Enclosing interface:
StateRebuildingCache

public static record StateRebuildingCache.CacheKey<I>(@Nonnull String subject, @Nonnull Class<I> instanceClass, @Nonnull SourcingMode sourcingMode) extends Record
Represents the cache key, whose equality determines, which StateRebuildingCache.CacheValue to fetch.
  • Constructor Details

    • CacheKey

      public CacheKey(@Nonnull String subject, @Nonnull Class<I> instanceClass, @Nonnull SourcingMode sourcingMode)
      Creates an instance of a CacheKey record class.
      Parameters:
      subject - the value for the subject record component
      instanceClass - the value for the instanceClass record component
      sourcingMode - the value for the sourcingMode record component
  • Method Details

    • toString

      public final 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
    • 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.
    • subject

      @Nonnull public String subject()
      Returns the value of the subject record component.
      Returns:
      the value of the subject record component
    • instanceClass

      @Nonnull public Class<I> instanceClass()
      Returns the value of the instanceClass record component.
      Returns:
      the value of the instanceClass record component
    • sourcingMode

      @Nonnull public SourcingMode sourcingMode()
      Returns the value of the sourcingMode record component.
      Returns:
      the value of the sourcingMode record component