Record Class KeyedParameterResolver.Resolution<M>

java.lang.Object
java.lang.Record
io.fluxzero.common.handling.KeyedParameterResolver.Resolution<M>
Type Parameters:
M - message type
Record Components:
matched - whether this resolver claims the parameter
resolver - reusable current-message value resolver; null for unmatched or rejected outcomes
Enclosing interface:
KeyedParameterResolver<M>

public static record KeyedParameterResolver.Resolution<M>(boolean matched, Function<? super M, Object> resolver) extends Record
Cached outcome of evaluating one resolver for one handler parameter.

An unmatched resolution allows the next resolver to be considered. A rejected resolution claims the parameter but makes the handler inapplicable. A resolved outcome supplies a reusable value resolver.

  • Constructor Details

    • Resolution

      public Resolution(boolean matched, Function<? super 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> KeyedParameterResolver.Resolution<M> unmatched()
      Returns an outcome that allows the next parameter resolver to be considered.
    • rejected

      public static <M> KeyedParameterResolver.Resolution<M> rejected()
      Returns an outcome that rejects the handler without considering later resolvers.
    • resolved

      public static <M> KeyedParameterResolver.Resolution<M> resolved(Function<? super M, Object> resolver)
      Returns an outcome backed by a reusable current-message value resolver.
    • 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 M, Object> resolver()
      Returns the value of the resolver record component.
      Returns:
      the value of the resolver record component