I can't seem to get the templates for getters and setters to work. It it always using something else, but I can't determine what exactly it is using. My template looks like this:
Hi,
Your template seems to be ok. There is an option "etter from field comment". If this option is selected, the related template is ignored. Could this be your problem?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank-you. That was the problem. Could you provide an explanation of what that parameter is supposed to do?
Also, on my getter template I had Target - Element Name checked which also caused problems. Perhaps some additional explanation of when to use Element Name and when to use Signature would also be helpful.
Thanks!
BTW - I do like this tool! Thanks for creating it! I think it provides value in that it gets a base comment started and you can carefully add more to that base later if necessary.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I can't seem to get the templates for getters and setters to work. It it always using something else, but I can't determine what exactly it is using. My template looks like this:
Name: Setter
Pattern: void set(\S+)\(+ (+)\)
Example: void setNumberOfQuestions(int number)
Template:
/**
* Sets the ${e.g(1).rsfl()}.
*
* @param ${e.g(2)} the helloworld ${e.g(1).rsfl()}
*/
My code:
public void setMyId(String myIdParam) {
this.myId = myId;
}
After running template:
/**
* Sets the my id.
*
* @param myIdParam the new my id
*/
public void setMyId(String myIdParam) {
this.myId = myId;
}
There seems to be a similar problem with getters. FWIW I have the same problem with Eclipse (3.7) templates. Getters and setters seem to be ignored.
Please let me know if I'm doing something wrong.
Thanks.
Hi,
Your template seems to be ok. There is an option "etter from field comment". If this option is selected, the related template is ignored. Could this be your problem?
Thank-you. That was the problem. Could you provide an explanation of what that parameter is supposed to do?
Also, on my getter template I had Target - Element Name checked which also caused problems. Perhaps some additional explanation of when to use Element Name and when to use Signature would also be helpful.
Thanks!
BTW - I do like this tool! Thanks for creating it! I think it provides value in that it gets a base comment started and you can carefully add more to that base later if necessary.
If the option "etter from field comment" is checked, the setter comment will be created like this:
/**
* Sets the <field comment>.
*
* @param myIdParam the new <field comment>
*/
public void setMyId(String myIdParam) {
this.myId = myId;
}
Everything but <field comment> is hard coded and cannot be changed by templates. <field comment> is taken from the Javadoc of the related field.
"Target" defines what the given Pattern should match:
Element name: "setMyId"
Signature: "void setMyId(String myIdParam)"
With "Signature" checked you can write templates for methods with a specific return type and number of parameters.