Let's say I have the following class (or can it be done with an interface also ?) :
class MyCustomClass {
boolean myCustomMethod(int a, int b){}
}
And the following string :
Math.abs(a - b) >= 10;
Is there a way, with Byte Buddy, to inject the code from the string into a new subclass of MyCustomClass, in the method myCustomMethod ? Even if the String is processed with ANTLR before ?
So I get
class MyCustomClass_SubClassInstance extends MyCustomClass {
// I know that with ByteBuddy, all this "ceremonial" code is not needed.
boolean myCustomMethod(int a, int b){
Math.abs(a - b) >= 10; // Injected code from the string
}
}