使用Java代码以编程方式生成eclipse IDE生成的Getter和Setter

我有一个源代码,它将为我的属性生成getter和setter方法名称。我的源代码很简单,它像这样

String getterName= "get"+caps(attr); // caps() method makes the first character of attr to caps.

该代码在某些情况下会失败,

for example : for attribute cApl

the code generated by me is getCApl() but the Eclipse IDE will generate it as getcApl().

I am trying to perfect this code and was wondering if there is any utility/java source code which could do this just as eclipse IDE ? What is the logic that the IDE has adopted to do this.

有人可以照亮吗?

评论