2021年3月12日星期五

Compile-time annotation processing

Is there way to do compile-time annotation processing in Java?

Consider this example:

@Name("appName")  private Field<String> appName;    public void setAppName(String name) {     appName.setValue(name);  }    public String getAppName(String name) {     return appName.getValue();  }    public void someFunction() {     String whatFieldName = appName.getName();  }  

Where the annotation Name will be processed at compile-time to set the value for Field That is without the common runtime annotation processing. As such, when appName.getName(); (the Field) is accessed it will return the typed value.

https://stackoverflow.com/questions/66609849/compile-time-annotation-processing March 13, 2021 at 11:29AM

没有评论:

发表评论