Record Class ParameterInvocationHint

java.lang.Object
java.lang.Record
eu.cloudnetservice.driver.network.http.annotation.parser.ParameterInvocationHint
Record Components:
index - the index of the parameter to override.
target - the parameter this hint is associated with.
valueResolver - the resolver of the value to inject into handling http methods depending on the context.

public record ParameterInvocationHint(int index, @NonNull Parameter target, @NonNull BiFunction<String,HttpContext,Object> valueResolver) extends Record
Represents a hint which can be added to a http context while pre-processing to indicate that the parameter at the specified index should get overridden with the value returned by the given resolver.
Since:
4.0
  • Field Details

  • Constructor Details

  • Method Details

    • resolveValue

      @Nullable public @Nullable Object resolveValue(@NonNull @NonNull String requestPath, @NonNull @NonNull HttpContext context)
      Resolves the value of this hint which should be injected into the method parameter at the associated index depending on the calling context and path.
      Parameters:
      requestPath - the path to which the http request to handle by the method was sent.
      context - the http context to resolve the parameter value based on.
      Returns:
      the value to inject into the parameter, can be null.
      Throws:
      NullPointerException - if the given request path or context is null.
    • 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 '=='.
      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.
    • index

      public int index()
      Returns the value of the index record component.
      Returns:
      the value of the index record component
    • target

      @NonNull public @NonNull Parameter target()
      Returns the value of the target record component.
      Returns:
      the value of the target record component
    • valueResolver

      Returns the value of the valueResolver record component.
      Returns:
      the value of the valueResolver record component