Alternatives to macro substitution in java -


i have log statement in use this.getclass().getsimplename()as 1st parameter. put in sort of macro constant , use in log statements. learned java has no such simple mechanism unlike c++.

what best way achieve sort of functionality in java?

my example log statements (from android) follows..

log.v(this.getclass().getsimplename(),"starting lociden service..."); 

java doesn't have macros can make code shorter:

log.v(this, "starting lociden service..."); 

and in log class:

public void v(object object, string s) {     _v(object.getclass().getsimplename(), s); } 

another approach inspect call stack.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -