Interface JavaSourceResolver

All Known Subinterfaces:
Debugger, QuteDebugProtocolClient
All Known Implementing Classes:
DebuggeeAgent, EventBasedJavaSourceResolver

public interface JavaSourceResolver
Resolver for Java source locations referenced from Qute templates.

Implementations of this interface provide a way to resolve a Qute template reference (via a qute-java:// URI) to the corresponding Java source file and template position.

This resolver is used by the Debug Adapter Protocol (DAP) **only to support breakpoints** on Java methods or classes related to Qute templates.

Example with a Qute template in a JAX-RS resource

 package org.acme.quarkus.sample;

 import jakarta.ws.rs.GET;
 import jakarta.ws.rs.Path;
 import jakarta.ws.rs.QueryParam;
 import jakarta.ws.rs.Produces;
 import jakarta.ws.rs.core.MediaType;

 import io.quarkus.qute.TemplateContents;
 import io.quarkus.qute.TemplateInstance;

 @Path("hello")
 public class HelloResource {

     @TemplateContents("""
             <p>Hello {name ?: "Qute"}</p>!
             """)
     record Hello(String name) implements TemplateInstance {
     }

     @GET
     @Produces(MediaType.TEXT_PLAIN)
     public TemplateInstance get(@QueryParam("name") String name) {
         return new Hello(name);
     }
 }
 

Corresponding qute-java:// URI for the record:

 qute-java://org.acme.quarkus.sample.HelloResource$Hello@io.quarkus.qute.TemplateContents
 

Parsed into JavaSourceLocationArguments:

  • unresolvedUri = "qute-java://org.acme.quarkus.sample.HelloResource$Hello@io.quarkus.qute.TemplateContents"
  • typeName = "org.acme.quarkus.sample.HelloResource$Hello"
  • method = null (the annotation is on the record class)
  • annotation = "io.quarkus.qute.TemplateContents"

Example resulting JavaSourceLocationResponse:

  • javaFileUri = "file:///path/to/project/src/main/java/org/acme/quarkus/sample/HelloResource.java"
  • startLine = 16 (line of the text block content of the TemplateContents annotation)