How to name setter that does data conversion?
Posted
by
IAdapter
on Programmers
See other posts from Programmers
or by IAdapter
Published on 2011-11-14T13:19:10Z
Indexed on
2011/11/14
18:12 UTC
Read the original article
Hit count: 240
I'm struggling with how to name this method, I don't like the "set" prefix, because I feel it should be reserved for normal "dumb" setters and some tools might not like it (i did not check it in checkstyle, pmd, etc., but I got a feeling they won't like it.)
for example (in java, but I feel its language agnostic)
public void setActionListenerClicked(boolean actionListenerClicked) {
this.actionListenerClicked = actionListenerClicked ? "1" : "0";
}
The only purpose of this method is ONLY to set, this method is needed and cannot be joined with any other (because of framework used).
P.S. I DO know that question is similar to How to name multi-setter?, but I feel its not the same question.
© Programmers or respective owner