eclipse - How can I add an attribute to java annotation to all methods at once -
i working on java project (eclipse ide) , have custom annotation @customannotation. has several attributes. added new attribute part of project-improvement , need add new attribute methods (and classes). there easier way other manually adding attribute java methods? may via eclipse?
as example:
<code> // current classannotation public @interface customannotation{ boolean enabletest; } // current methodannotation public @interface methodannotation{ boolean enabletest; } //my current class , method @classannotation(enabletest = fasle) classs myclass { @methodanotation(enabletest = false) public void mymethod() {} } //my new classannotation public @interface customannotation{ boolean enabletest; string[] testnames; } // new methodannotation public @interface methodannotation{ boolean enabletest; string[] testnames; } // new class , method looks @classannotation(enabletest = fasle, testnames = { test1, test2}) classs myclass { @methodannotation(enabletest = fasle, testnames = { test1, test2}) public void mymethod() {} } </code>
i tried search clue across internet , stackoverflow no luck. use community.
thank you.
you can either of these:
- use default value attribute (i'd re3commend in case).
- search , replace using regular expressions. search "^(@methodannotation([^)])*)" / replace "$1, mynewattribute=123)" should work.
Comments
Post a Comment