Record Class HandlerInputResolver.Resolution<M>

java.lang.Object
java.lang.Record
io.fluxzero.common.handling.HandlerInputResolver.Resolution<M>
Type Parameters:
M - the message type used by the handling pipeline
Record Components:
matched - whether this resolver claims the parameter
resolver - function that obtains the argument from each input, or null for an unmatched or rejected result
Enclosing interface:
HandlerInputResolver<M>

public static record HandlerInputResolver.Resolution<M>(boolean matched, Function<? super HandlerInput<M>, Object> resolver) extends Record
Describes what a resolver decided for one handler parameter.
  • Constructor Details

    • Resolution

      public Resolution(boolean matched, Function<? super HandlerInput<M>, Object> resolver)
      Creates an instance of a Resolution record class.
      Parameters:
      matched - the value for the matched record component
      resolver - the value for the resolver record component
  • Method Details

    • unmatched

      public static <M> HandlerInputResolver.Resolution<M> unmatched()
      Returns a result indicating that this resolver does not handle the parameter. The next resolver may be tried.
    • rejected

      public static <M> HandlerInputResolver.Resolution<M> rejected()
      Returns a result indicating that this resolver claims the parameter but rejects the representative input. No later resolver should be tried for that parameter.
    • resolved

      public static <M> HandlerInputResolver.Resolution<M> resolved(Function<? super HandlerInput<M>, Object> resolver)
      Returns a successful result with a function that supplies the argument for each compatible input.
      Parameters:
      resolver - the reusable argument-resolution function
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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
    • resolver

      public Function<? super HandlerInput<M>, Object> resolver()
      Returns the value of the resolver record component.
      Returns:
      the value of the resolver record component