Record Class RouteEvent

java.lang.Object
java.lang.Record
dev.relism.flash.extension.RouteEvent
Record Components:
method - HTTP method for this route
path - full path as declared (including namespace prefix for scoped routes)
namespace - namespace prefix of the router that owns this route ("/" for root)
routerType - simple class name of the owning router implementation
handlerClass - concrete handler class, or null for anonymous lambda handlers
middlewareChain - ordered middleware classes, outermost first

public record RouteEvent(HttpMethod method, String path, String namespace, String routerType, Class<?> handlerClass, List<Class<? extends Middleware>> middlewareChain) extends Record
Immutable snapshot of a route captured at registration time.

Emitted by FlashApp and FlashScope to every registered RouteListener before the route is compiled into the routing engine. All information is derived automatically — no annotations or declarations are required from the developer.

Middleware chain

middlewareChain lists the Middleware classes outermost-first:
  1. Router-level middlewares (set on the router constructor)
  2. Annotation-injected middlewares (e.g. from @Authenticated)
  3. Handler-level explicit middlewares (passed inline: app.get(path, h, mw...))

Handler abstraction chain

Walk handlerClass upward via Class.getSuperclass() to reconstruct the full inheritance chain (e.g. EditPostPageHandler → HtmlHandler → RequestHandler). Read Class.getAnnotations() on each level to discover declared pointcuts (@Authenticated, @RolesAllowed, @Route/@GET, etc.).
  • Constructor Details

    • RouteEvent

      public RouteEvent(HttpMethod method, String path, String namespace, String routerType, Class<?> handlerClass, List<Class<? extends Middleware>> middlewareChain)
      Creates an instance of a RouteEvent record class.
      Parameters:
      method - the value for the method record component
      path - the value for the path record component
      namespace - the value for the namespace record component
      routerType - the value for the routerType record component
      handlerClass - the value for the handlerClass record component
      middlewareChain - the value for the middlewareChain record component
  • Method Details

    • 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.
    • method

      public HttpMethod method()
      Returns the value of the method record component.
      Returns:
      the value of the method record component
    • path

      public String path()
      Returns the value of the path record component.
      Returns:
      the value of the path record component
    • namespace

      public String namespace()
      Returns the value of the namespace record component.
      Returns:
      the value of the namespace record component
    • routerType

      public String routerType()
      Returns the value of the routerType record component.
      Returns:
      the value of the routerType record component
    • handlerClass

      public Class<?> handlerClass()
      Returns the value of the handlerClass record component.
      Returns:
      the value of the handlerClass record component
    • middlewareChain

      public List<Class<? extends Middleware>> middlewareChain()
      Returns the value of the middlewareChain record component.
      Returns:
      the value of the middlewareChain record component