Record Class PlaceholderConditionResult

java.lang.Object
java.lang.Record
com.ordwen.odailyquests.quests.conditions.placeholder.PlaceholderConditionResult
Record Components:
matched - true if the condition was satisfied
invalidFormat - true if the evaluation failed due to invalid input format

public record PlaceholderConditionResult(boolean matched, boolean invalidFormat) extends Record
Represents the outcome of evaluating a placeholder condition.

A result may indicate that the condition was successfully matched, that it failed to match, or that it could not be evaluated due to an invalid input format (for example, when parsing a number or a duration fails).

  • Constructor Details

    • PlaceholderConditionResult

      public PlaceholderConditionResult(boolean matched, boolean invalidFormat)
      Creates an instance of a PlaceholderConditionResult record class.
      Parameters:
      matched - the value for the matched record component
      invalidFormat - the value for the invalidFormat record component
  • Method Details

    • successResult

      public static PlaceholderConditionResult successResult()
      Creates a result indicating that the condition was satisfied.
      Returns:
      a success result
    • failureResult

      public static PlaceholderConditionResult failureResult()
      Creates a result indicating that the condition was evaluated but did not match.
      Returns:
      a failure result
    • invalidFormatResult

      public static PlaceholderConditionResult invalidFormatResult()
      Creates a result indicating that the condition could not be evaluated because the input values were not in a valid format.
      Returns:
      an invalid format result
    • of

      public static PlaceholderConditionResult of(boolean matched)
      Creates either a success or failure result depending on the given flag.
      Parameters:
      matched - whether the condition was satisfied
      Returns:
      a success result if matched is true, otherwise a failure result
    • 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 '=='.
      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.
    • matched

      public boolean matched()
      Returns the value of the matched record component.
      Returns:
      the value of the matched record component
    • invalidFormat

      public boolean invalidFormat()
      Returns the value of the invalidFormat record component.
      Returns:
      the value of the invalidFormat record component