Rearranger question (order of getters/setters)

I'd like to have the Rearranger plugin put my getters/setters at the end
of my file, but have all the setters first, and then all the getters. Is
there any way to force this to happen without having to define my own method
definition for getters and setters? It seems like currently, it's whatever
order they were initially defined in.

Tobin


4 comments

I don't believe there is any easy way to do what you want. Putting getters and setters at the end of the file is easy and the only ordering you can do for them is alphabetical. However, I question your desire to separate getters and setters into different groups. Most people like to keep the getter with the setter because if you remove the attribute it's easier to clean up the getter and setter for it. I can't think of any reason to keep them in separate lists.

0

Thanks for the info. The reason a feature like this would be nice is because
we are using WebWork as our MVC framework for our webapp, and the setters
and getters for the actions have specific meanings, and don't necessarily
tie together.

Tobin


0

Tobin,

Someone else also asked me to implement the ability to group getters and setters independently. I was actually thinking of completely redesigning the getter/setter stuff so that the definitions were more flexible (e.g., "addObject" and "removeObject" could be considered getter/setter for a field "object"; and not limit the number of getters and setters for a field to one each.) Also would enhance the grouping capability, so that these methods could be grouped with their field/property definition, or separately as you desired.

It's a big change, though, and I haven't gotten far on it. But I will try to take a look at it again.

-Dave

0

Cool, keep us updated on it. Thanks.

Tobin


0

Please sign in to leave a comment.