rob*_*rto 5 java annotations lombok spring-boot java-annotations
我想创建一个java 注释,它在编译时生成一个方法,例如 Lombok:我有这个类:
@MyNewAnnotation()
public class ClassTest {
private String name;
private Integer id;
private String lastName;
public final static String COL_NAME = "NAME";
public final static String COL_LAST_NAME = "LAST_NAME";
}
Run Code Online (Sandbox Code Playgroud)
我希望 myNewAnnotation 可以生成getCol返回的方法,"NAME, LAST_NAME"例如:
public static String getCol() {
return COL_NAME + "," + COL_LAST_NAME;
}
Run Code Online (Sandbox Code Playgroud)
注释必须读取以“COL_”开头的所有属性,并在编译时生成新方法,或多或少类似于 Lombok 生成 getter 或 setter 时的情况
| 归档时间: |
|
| 查看次数: |
2155 次 |
| 最近记录: |