Record Class UpgradeEnumModifier<T extends Enum<T>>

java.lang.Object
java.lang.Record
de.Keyle.MyPet.api.skill.modifier.UpgradeEnumModifier<T>
Type Parameters:
T - the enum type of the skill parameter
Record Components:
value - the enum constant to set when this modifier is applied
All Implemented Interfaces:
UpgradeModifier<T>

public record UpgradeEnumModifier<T extends Enum<T>>(T extends Enum<T> value) extends Record implements UpgradeModifier<T>
An UpgradeModifier for enum-typed skill parameters.

Like UpgradeBooleanModifier, this is a replacement modifier: it unconditionally sets the parameter to the enum constant carried by this record, ignoring the previous value. Useful for skills that switch behavior modes at specific upgrade levels (e.g., selecting an attack type or targeting strategy).

  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an instance of a UpgradeEnumModifier record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    modify(T value)
    Applies this modifier to the given current value, producing an updated result.
    final String
    Returns a string representation of this record class.
    Returns the value of the value record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • UpgradeEnumModifier

      public UpgradeEnumModifier(T value)
      Creates an instance of a UpgradeEnumModifier record class.
      Parameters:
      value - the value for the value record component
  • Method Details

    • modify

      public T modify(T value)
      Applies this modifier to the given current value, producing an updated result. Unconditionally returns this modifier's enum constant, ignoring the input.
      Specified by:
      modify in interface UpgradeModifier<T extends Enum<T>>
      Parameters:
      value - the current parameter value before modification
      Returns:
      the modified parameter value
    • 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.
    • value

      public T value()
      Returns the value of the value record component.
      Specified by:
      value in interface UpgradeModifier<T extends Enum<T>>
      Returns:
      the value of the value record component