我可以在java中创建一个注释,当放置在" private static final"数组字段应将其视为公共字段,但在调用时应返回其克隆对象。 e.g
private static final String[] test = {"Abc","CDE"}
public static final String[] getTest(){
return Arrays.copyOf(test,test.lenght)
}
而不是完成上述所有代码,我有办法做到这一点吗?
@notation
private static final String[] test = {"Abc","CDE"}