Package fr.olympus.prometheus.register
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 Summary
ConstructorsConstructorDescriptionEvolutionRegistryEntry(String id, Supplier<? extends EvolutionCondition> supplier) Constructs a new EvolutionRegistryEntry with the specified unique identifier and supplier. -
Method Summary
Modifier and TypeMethodDescriptionCreates a new instance of the evolution condition using the supplier.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.Supplier<? extends EvolutionCondition> supplier()Returns the value of thesupplierrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
EvolutionRegistryEntry
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
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
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). -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
supplier
Returns the value of thesupplierrecord component.- Returns:
- the value of the
supplierrecord component
-