I'm searching for a solution to get two name for one method using Java Annotation. I need something like this :
@SOMETHING(name="Method_Name_2")
public String methodName1(String arg){
// Some code
return var;
}
and when I call the method
obj.Method_Name_2(arg)
or
obj.methodName1(arg)
I need that the two call execute the same method.
You cannot provide two different names for a method in java. However you can wrap original method inside new method name: