Record Class RouteRegistry.EndpointMapping

java.lang.Object
java.lang.Record
de.craftsblock.craftsnet.api.RouteRegistry.EndpointMapping
Record Components:
priority - The ProcessPriority.Priority level for this endpoint.
method - The Method associated with the handler.
handler - The Handler instance that owns the method.
validator - The Pattern used for validating input related to the endpoint.
requirements - A concurrent map of requirements, indexed by their annotation class.
All Implemented Interfaces:
RouteRegistry.Mapping
Enclosing class:
RouteRegistry

public static record RouteRegistry.EndpointMapping(ProcessPriority.Priority priority, @NotNull Method method, @NotNull Handler handler, @NotNull Pattern validator, ConcurrentHashMap<Class<? extends Annotation>,RequirementInfo> requirements, Stack<Middleware> middlewares) extends Record implements RouteRegistry.Mapping
Represents the mapping of a registered endpoint handler.

This class stores information about the endpoint's processing priority, the associated handler method, its parent handler, a validation pattern, and any requirement-related metadata.

Since:
3.0.5-SNAPSHOT
  • Constructor Details

  • Method Details

    • isPresent

      public <A extends Annotation> boolean isPresent(@NotNull @NotNull Class<A> annotation)
      Checks whether the given annotation is present in the requirements.
      Specified by:
      isPresent in interface RouteRegistry.Mapping
      Parameters:
      annotation - The annotation class to check for.
      Returns:
      true if the annotation is present, false otherwise.
    • isPresent

      public <A extends Annotation> boolean isPresent(@NotNull @NotNull Class<A> annotation, @NotNull @NotNull String key)
      Checks whether a specific key within the given annotation's requirements is present.
      Specified by:
      isPresent in interface RouteRegistry.Mapping
      Parameters:
      annotation - The annotation class to check for.
      key - The specific key to check within the annotation's requirements.
      Returns:
      true if the key is present within the annotation's requirements, false otherwise.
    • getRequirements

      public <A extends Annotation, T> T getRequirements(@NotNull @NotNull Class<A> annotation, @NotNull @NotNull String key)
      Retrieves a specific value from the requirements of the given annotation.
      Specified by:
      getRequirements in interface RouteRegistry.Mapping
      Parameters:
      annotation - The annotation class to retrieve the value from.
      key - The specific key within the annotation's requirements.
      Returns:
      The value associated with the given key, or null if not present.
    • 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.
    • priority

      @NotNull public ProcessPriority.Priority priority()
      Returns the value of the priority record component.
      Returns:
      the value of the priority record component
    • method

      @NotNull public @NotNull Method method()
      Returns the value of the method record component.
      Returns:
      the value of the method record component
    • handler

      @NotNull public @NotNull Handler handler()
      Returns the value of the handler record component.
      Returns:
      the value of the handler record component
    • validator

      @NotNull public @NotNull Pattern validator()
      Returns the value of the validator record component.
      Returns:
      the value of the validator record component
    • requirements

      public ConcurrentHashMap<Class<? extends Annotation>,RequirementInfo> requirements()
      Returns the value of the requirements record component.
      Returns:
      the value of the requirements record component
    • middlewares

      public Stack<Middleware> middlewares()
      Returns the value of the middlewares record component.
      Returns:
      the value of the middlewares record component