I have a class like below with a method that just returns a String, but I want to modify what it returns from another class, without hardcoding it myself.
public class Name {
public static String getName() {
return "MyName";
}
}
Is there any way to do this? I tried BCEL but that didn’t seem to change the return value.
Edit: This is for a mod. I’m trying to make it completely independant from the existing code, by not modifying it.
Thanks.
Are you sure you’ve tried BCEL? I created a fully-working example here.