P
P
Petr Petrovich2016-06-26 23:29:19
Java
Petr Petrovich, 2016-06-26 23:29:19

How to replace the word "set" in methods?

Hello. What can replace the set prefix in setters in a class?
I would like that when using autocomplete in the development environment, a list of only my setters falls out. For example, if I write a widget - a viewgroup heir, then there will be a huge list of setters, both mine and from the parent class. What are the options?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rou1997, 2016-06-27
@michael_bel

set_ or put , or no prefixes at all:

public String Title() { //get
...
}
public void Title(String title) { //set
...
}

This is the most noticeable, and quite "cool", I would say.
"there will be a huge list of setters, both mine and from the parent class"
You can write a plugin for the IDE, or write a decorator instead of an inheritor, but both take time.

K
Konstantin Malyarov, 2016-06-26
@Konstantin18ko

set can be replaced with value(value), get with share(share).

public void valuveCatName(){
this.catName = catName;
}
public String shareCatName(){
return catName;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question