I want to automatically replace all occurrences
if(variable!=null && variable.equals(value)) ...
by
if(StringUtils.equals(variable, value)) ...
subject to type. This means that variable and value must be String (and not just lexicographic processing, for example, with awk / perl).
It should also be flexible enough to apply either a literal or a constant ( final static ) or another variable or parameter to value — something that will necessarily be String in this context. In addition, there may be more logical expressions.
I suspect the Java Std API may help here, but the conversion code itself is not handled by this API, but simply access to the code.
source share