Record Class EvolutionRegistryEntry

java.lang.Object
java.lang.Record
fr.olympus.prometheus.register.EvolutionRegistryEntry
Record Components:
id - The unique identifier for the evolution condition.
supplier - A supplier that provides instances of the evolution condition when requested.

public record EvolutionRegistryEntry(String id, Supplier<? extends EvolutionCondition> supplier) extends Record
Represents an entry in the evolution registry, containing the evolution condition's unique identifier and a supplier for creating instances of the evolution condition.
  • Constructor Details

    • EvolutionRegistryEntry

      public EvolutionRegistryEntry(String id, Supplier<? extends EvolutionCondition> supplier)
      Constructs a new EvolutionRegistryEntry with the specified unique identifier and supplier.
      Parameters:
      id - The unique identifier for the evolution condition.
      supplier - A supplier that provides instances of the evolution condition when requested.
  • Method Details

    • createInstance

      public EvolutionCondition createInstance()
      Creates a new instance of the evolution condition using the supplier.
      Returns:
      A new instance of the evolution condition provided by the supplier.
      Throws:
      RuntimeException - if the supplier fails to create an instance.
      IllegalStateException - if the created instance is null or not an instance of EvolutionCondition
    • 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.
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • supplier

      public Supplier<? extends EvolutionCondition> supplier()
      Returns the value of the supplier record component.
      Returns:
      the value of the supplier record component