Record Class FlagCorrelation

java.lang.Object
java.lang.Record
de.z0rdak.yawp.core.flag.FlagCorrelation
Record Components:
region - the region responsible for the resolved flag state, must not be null
flag - the flag associated with the resolved state, may be null if undefined

public record FlagCorrelation(IProtectedRegion region, @Nullable IFlag flag) extends Record
Represents the resolved association between a region and a flag.

This class determines which region is responsible for a specific flag state. The responsible region may not always be the one directly involved in a flag check event; it could be an ancestor region that overrides the flag state of a child region.

FlagCorrelation is primarily used for passing information in recursive flag evaluations and retaining flag resolution details for use in the CLI.

  • Constructor Details

    • FlagCorrelation

      public FlagCorrelation(IProtectedRegion region, @Nullable @Nullable IFlag flag)
      Creates an instance of a FlagCorrelation record class.
      Parameters:
      region - the value for the region record component
      flag - the value for the flag 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.
    • region

      public IProtectedRegion region()
      Returns the value of the region record component.
      Returns:
      the value of the region record component
    • flag

      @Nullable public @Nullable IFlag flag()
      Returns the value of the flag record component.
      Returns:
      the value of the flag record component