How to add a field to a class in ByteBuddy and set / get that value in a method interceptor
<p>I am using byte-buddy to build an ORM on top of Ignite, we need to add a field to a class and then access it in a method interceptor.. </p>

<p>So here's an example where I add a field to a class</p>

<pre><code>final ByteBuddy buddy = new ByteBuddy();

final Class&lt;? extends TestDataEnh&gt; clz =  buddy.subclass(TestDataEnh.class)
        .defineField("stringVal",String.class)
        .method(named("setFieldVal")).intercept(
            MethodDelegation.to(new SetterInterceptor())
    )
    .make()
    .load(getClass().getClassLoader(), ClassLoadingStrategy.Default.WRAPPER)
    .getLoaded();

final TestDataEnh enh = clz.newInstance();

enh.getFieldVal();
enh.setFieldVal();

System.out.println(enh.getClass().getName());
</code></pre>

<p>And the Interceptor is like this</p>

<pre><code>public class SetterInterceptor {
    @RuntimeType
    public  Object intercept() {
        System.out.println("Invoked method with: ");
        return null;
    }
}
</code></pre>

<p>So how do I get the value of the new field into the interceptor so I can change it's value? (stringVal)</p>

<p>Thanks in advance</p>