package dev.relism.extension; import dev.relism.http.HttpMethod; import dev.relism.routing.Middleware; import java.util.List; /** * Immutable snapshot of a route captured at registration time. * *

Emitted by {@link FlashApp} and {@link FlashScope} to every registered * {@link 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

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

Handler abstraction chain

* Walk {@link #handlerClass} upward via {@link Class#getSuperclass()} to reconstruct * the full inheritance chain (e.g. {@code EditPostPageHandler → HtmlHandler → RequestHandler}). * Read {@link Class#getAnnotations()} on each level to discover declared pointcuts * ({@code @Authenticated}, {@code @RolesAllowed}, {@code @Route}/{@code @GET}, etc.). * * @param method HTTP method for this route * @param path full path as declared (including namespace prefix for scoped routes) * @param namespace namespace prefix of the router that owns this route ({@code "/"} for root) * @param routerType simple class name of the owning router implementation * @param handlerClass concrete handler class, or {@code null} for anonymous lambda handlers * @param middlewareChain ordered middleware classes, outermost first */ public record RouteEvent( HttpMethod method, String path, String namespace, String routerType, Class handlerClass, List> middlewareChain ) {}