getter and setter templates

I would like to use file templates to customize the look of getters and setters. Specificly, I would like to specify that getters have a @see #setMethodName javadoc tag and setters have a @see #getMethodName tag. Is this possible within IDEA today, or would this need to be a feature request?

10 comments
Comment actions Permalink

>
>
>.. I would like to specify that getters have a @see #setMethodName javadoc tag and setters have a @see #getMethodName tag.
>
How would you handle "orphan" getters (with no setters), and vice-versa.?

Alain

0
Comment actions Permalink

How would you handle "orphan" getters (with no
setters), and vice-versa.?


I assume that would be a problem if file templates were used. The current file templates do have some minor scripting abilities, but I'm sure they wouldn't handle this.

To tell you the truth, the real reason I like the @see tag, is that IDEA allows drill-throughs on them. I like being able to quickly find the getter for a setter by ctrl-clicking on the class after the @see tag.

0
Comment actions Permalink

Bryan Young wrote:

>To tell you the truth, the real reason I like the @see tag, is that IDEA allows drill-throughs on them. I like being able to quickly find the getter for a setter by ctrl-clicking on the class after the @see tag.
>

Why would you want drilling through a getter/setter? To see what it's
doing? To examine the code?

Alain

0
Comment actions Permalink

What if there's no setter? Would you also like the @see tag for the getter
be added when I add a setter later?

Eugene


"Bryan Young" <BryanYoung@scruffles.net> wrote in message
news:715232.1060205583897.JavaMail.itn@is.intellij.net...

How would you handle "orphan" getters (with no
setters), and vice-versa.?

>

I assume that would be a problem if file templates were used. The current

file templates do have some minor scripting abilities, but I'm sure they
wouldn't handle this.
>

To tell you the truth, the real reason I like the @see tag, is that IDEA

allows drill-throughs on them. I like being able to quickly find the getter
for a setter by ctrl-clicking on the class after the @see tag.


0
Comment actions Permalink

Why would you want drilling through a getter/setter?
To see what it's
doing? To examine the code?


For the most part, I need to find the getters and setters to find usages of a field. When you find usages of a field, it doesn't find the useages of the getters and setters. Many times, I end up going to the getter, pressing Ctrl-Shift-F7 to higlight usages, and then finding the setter and doing the same. If I were to just do Ctrl-Shift-F7 on the field, it would only highlight the usages in the getter and the setter.

Maybe all I need is smarter 'find usages' and 'highlight usages' features. Then I could just ignore the getters and setters.

0
Comment actions Permalink

Bryan Young wrote:

>Maybe all I need is smarter 'find usages' and 'highlight usages' features. Then I could just ignore the getters and setters.

>

You're right. It's one of those features that should have been present
in IDEA 1.0, but is still absent, from some mysterious reason.
I was about to post a request, but I found this one :
See : http://www.intellij.net/tracker/idea/viewSCR?publicId=3087

There is hope : it's planned .... for Ariadna :)

Alain

0
Comment actions Permalink

+1 if you can do this. That would be very useful and save time for
documentation upkeep.

Thanks.
R

Eugene Belyaev wrote:

What if there's no setter? Would you also like the @see tag for the getter
be added when I add a setter later?

Eugene


"Bryan Young" <BryanYoung@scruffles.net> wrote in message
news:715232.1060205583897.JavaMail.itn@is.intellij.net...

>>>How would you handle "orphan" getters (with no
>>>setters), and vice-versa.?
>>
>>I assume that would be a problem if file templates were used. The current


file templates do have some minor scripting abilities, but I'm sure they
wouldn't handle this.

>>To tell you the truth, the real reason I like the @see tag, is that IDEA


allows drill-throughs on them. I like being able to quickly find the getter
for a setter by ctrl-clicking on the class after the @see tag.


0
Comment actions Permalink

Robert S. Sfeir wrote:

+1 if you can do this. That would be very useful and save time for
documentation upkeep.



I still wonder what there is to document in a getter or setter? It's a
standard pattern. The most used and best known of all patterns.

Even worlse, seing javadoc next to a s/getXXX() would have me think it
does something non-standard, that justified an explicit documentation,
and I would feel obliged to read it, and I would lose my time.

Alain

0
Comment actions Permalink

to each our own? Some of us are required to document more than we want,
and therefore we do. Try doing Government work and deal with weird
requests... :-\

R

Alain Ravet wrote:

Robert S. Sfeir wrote:

>> +1 if you can do this. That would be very useful and save time for
>> documentation upkeep.



I still wonder what there is to document in a getter or setter? It's a
standard pattern. The most used and best known of all patterns.

Even worlse, seing javadoc next to a s/getXXX() would have me think it
does something non-standard, that justified an explicit documentation,
and I would feel obliged to read it, and I would lose my time.

Alain


0
Comment actions Permalink

How about writing a simply tool (e.g. plugin with use of PSI API) which
would run across the whole code and insert missing links to the accessors?
This seems to be much easier than caring of these links to be always
up-to-date.

--
Valentin Kipiatkov
JetBrains, Inc
http://www.intellij.com
"Develop with pleasure!"

"Robert S. Sfeir" <sfcodewarrior@hotmail.com> wrote in message
news:bgv2e3$93n$1@is.intellij.net...

to each our own? Some of us are required to document more than we want,
and therefore we do. Try doing Government work and deal with weird
requests... :-\

>

R

>

Alain Ravet wrote:

>

Robert S. Sfeir wrote:

>
>> +1 if you can do this. That would be very useful and save time for
>> documentation upkeep.
>
>
>

I still wonder what there is to document in a getter or setter? It's a
standard pattern. The most used and best known of all patterns.

>

Even worlse, seing javadoc next to a s/getXXX() would have me think it
does something non-standard, that justified an explicit documentation,
and I would feel obliged to read it, and I would lose my time.

>

Alain

>

>


0

Please sign in to leave a comment.