Reputation: 273
If I have a member variable private int mScore
how do I setup Android Studio so it generates the following getters and setters?
public int score() {
return mScore;
}
public void setScore(int score) {
mScore = score;
}
So instead of getScore() I'd have only score().
Upvotes: 1
Views: 895
Reputation: 7351
You won't like this answer, but you can't do that in IntelliJ.
That said, I'm curious what your reason is for wanting to do it that way. It's strongly against the Java convention, as well as conventions used in the Android SDK, so you'll inevitably be introducing a conflicting pattern into your code base. You may be interested in Project Lombok for reducing boilerplate though, specifically the @Setter
and @Getter
annotations.
Upvotes: 2