Noir::TreeSitterJaxRsExtractor
Tree-sitter-backed JAX-RS / Jakarta REST extractor.
Walks @Path resource classes and emits one Endpoint-shaped
Route per HTTP-method-annotated method. Recognises:
- Class-level
@ServerEndpoint("/x")— surfaced asGETwithprotocol = "ws". - Application-level
@ApplicationPath("/api")for analyzer adapters that need to prefix resource routes. - Class-level
@Path("/x")— joined onto each method's path (or@Path("/sub")if the method has one). - Verb annotations:
@GET,@POST,@PUT,@DELETE,@PATCH,@HEAD,@OPTIONS. @Consumes(MediaType.APPLICATION_*)at class or method level to set the body parameter format. Method-level wins.- Parameter annotations:
@PathParam(skipped — URL carries it),@QueryParam,@HeaderParam,@CookieParam,@FormParam, plus@DefaultValue("x")modifier. @BeanParam— expands the bean class's JAX-RS-annotated fields as parameters with the right param_type, looked up viaNoir::TreeSitterJavaDtoIndex-style cross-file resolution.- Un-annotated, non-primitive parameters — treated as the
request body and expanded against a caller-supplied DTO
index (same pipeline as Spring's
@RequestBody).
Out of scope for this first cut: meta-annotations,
@MatrixParam.
Constants
JAX-RS HTTP-method annotations. Simple names are matched; the walker normalises any package-qualified prefix to the trailing segment.
Framework-provided method parameters that can be injected by
type in RESTEasy Reactive / Quarkus or are commonly carried by
JAX-RS/Servlet @Context / @Suspended. These are never
request bodies.
Both standard JAX-RS names and Quarkus's @Rest* aliases map
to the same param formats. Listing both here keeps the
Quarkus analyzer a thin detector layer on top of this extractor.
@PathParam skip-list — Quarkus's @RestPath is a drop-in
alias for the same role. Both are URL-carried and never emitted
as request parameters.
Java primitive type names (lowercased). Anything else with no parameter annotation gets treated as a request-body DTO.
Instance methods
Read JAX-RS-annotated fields (@QueryParam, @HeaderParam,
...) from every class in the file as {class_name => Params}.
Used to power @BeanParam expansion across files.
@HttpMethod("VERB") is JAX-RS's general mechanism for declaring
a custom HTTP verb — Jersey/RESTEasy Reactive's QUERY support
(and any other non-standard verb a project defines) is just a
user annotation type meta-annotated with it:
@HttpMethod("QUERY") @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface QUERY {}
Reads every @interface declaration in source and maps its
simple name to the verb it declares. A name that collides with a
built-in (HTTP_VERB_ANNOTATIONS) is skipped — the hard-coded
table stays authoritative for those.
Public entry point — walks source and returns one Route
per JAX-RS endpoint defined in path's file. dto_index maps
class_name → fields for cross-file body / @BeanParam
expansion (typically built via TreeSitterJavaDtoIndex).
Same as extract_routes, but reuses a Java tree-sitter root the
caller already parsed. Analyzer adapters use this when they also
need to attach method-body callees without reparsing the file.