Enforcing a coding template in the getters of a class in java
- by Yoav Schwartz
Hello,
I want to make sure all getters of the classes in a certain package follow a given template.
For example, all getters must be of the form:
XXX getYYY(){
classLock.lock();
return YYY;
finally{
classLock.unlock();
}
}
Basically, I want that my project will not compile/run unless all getters are of that form.
What is the best way to do that?
I would prefer a solution that can be used as an Eclipse plugin.
Thanks,
Yoav