I'm working on a project to parse jersey based annotations to build an request interaction graph between projects from java source code.
It's easy to parse and get info when everythink like that
@GET
@Path("/parameter/{param}")
public Response getParam(@PathParam("param") String prm) {
String output = "Jersey say : " + prm;
return Response.status(200).entity(output).build();
}
I can extract values like {Method:"GET", Path:"parameter/{param}"}
Other case are
private static final PARAMETER_PATH="/parameter/{param}";
@GET
@Path(PARAMETER_PATH)
public Response getParam(@PathParam("param") String prm) {
String output = "Jersey say : " + prm;
return Response.status(200).entity(output).build();
}
or
private static String PATH_VARIABLE_STR = "{param}";
private static PARAMETER_PATH = "/parameter/"+PATH_VARIABLE_STR;
@GET
@Path(PARAMETER_PATH)
public Response getParam(@PathParam("param") String prm) {
String output = "Jersey say : " + prm;
return Response.status(200).entity(output).build();
}
In last two cases, I could not extract the real value.
How can I get the value of the variable while I'm working on static source code with javaparser, ast or etc.
I'm waiting for your suggestions. Thanks.