[英]How are java annotations like “@PathParam(” “) ” processed in java? Where can we find the source code of that particular annotation processor?
我在jax-rs中有一個服務文件,它有一個通過@QueryParam Annotation接受參數的方法。
注釋清楚地在編譯過程中的某處處理。 哪個類執行修改操作? 像QueryParam一樣從URL獲取參數。
@PUT
@Path("/score")
@Produces("application/json")
public String update(@QueryParam("wins") int wins,
@QueryParam("losses") int losses,
@QueryParam("ties") int ties) {
Hello.wins = wins;
Hello.ties = ties;
Hello.losses = losses;
String pattern =
"{ \"wins\":\"%s\", \"losses\":\"%s\", \"ties\": \"%s\"}";
return String.format(pattern, Hello.wins, Hello.losses, Hello.ties );
}
謝謝,我自己找到了解決方案。 在球衣庫中存在的每個注釋都有InjectableProvider類,用於處理傳入的注釋。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.