Adding Getter/Setter pair to interfaces
Is there a way to quickly, conveniently add getter/setter pairs to
interfaces? Something similar to "Encapsulate Fields" would do the
trick. I'll submit a feature request but want to check and see if I'm
missing something-- easy to do with such a rich IDE.
Thanks,
Jon
Please sign in to leave a comment.
Jon Steelman wrote:
How can you added getters/setters to an interface? An interface has no
fields.
Ciao,
Gordon
--
Gordon Tyler
Software Developer, R&D
Sitraka (now part of Quest Software)
"Performance is Mission Critical"
One quick way to do it is to create a property in an implementation class
and pull the get/set methods to the interface.
Eugene
"Gordon Tyler" <gordon.tyler@sitraka.com> wrote in message
news:b4b477$i4v$2@is.intellij.net...
>
>
>
>
Gordon Tyler wrote:
>> Is there a way to quickly, conveniently add getter/setter pairs to
>> interfaces? Something similar to "Encapsulate Fields" would do the
>> trick. I'll submit a feature request but want to check and see if I'm
>> missing something-- easy to do with such a rich IDE.
Right, but you can still want getters and setters anyway. For example,
the interfaces javax.swing.Action has a pair for the boolean enabled and
java.beans.PropertyEditor has getter+setter pairs for text and value.
Jon
I meant to use the Pull Members Up refactoring.
Eugene
"Eugene Belyaev" <beg@intellij.com> wrote in message
news:b4b54f$k8o$1@is.intellij.net...
>
>
>
>
>
Eugene Belyaev wrote:
Yes, thanks. That's what I ended up doing... actually using the
"Encapsulate Fields" followed by "Extract Interface" on a dummy class is
what I've done. Although it is less than ideal, maybe I'll just live
with it. There are times like this when I can't decide whether it is
worth adding a feature request-- The current approach is a workaround
but I'm not sure that adding the feature can justify its own weight
compared to the complexity it adds to IDEA.
Jon
A very simple plugin btw.
Eugene
"Jon Steelman" <steelman@mindspring.com> wrote in message
news:b4b5mt$l3q$1@is.intellij.net...
class
>
>
>
You may vote for http://www.intellij.net/tracker/idea/viewSCR?publicId=1095
--
Valentin Kipiatkov
JetBrains, Inc
http://www.intellij.com
"Develop with pleasure!"
"Jon Steelman" <steelman@mindspring.com> wrote in message
news:b4b1mf$db7$1@is.intellij.net...
>
>