@Test public void testStaticValue() throws Exception { DynamicType.Loaded<?> loaded = new ByteBuddy() .subclass(staticSwap) .method(isDeclaredBy(staticSwap)) .intercept(FieldAccessor.ofField(BAR).setsValue(value)) .make() .load(staticSwap.getClassLoader(), ClassLoadingStrategy.Default.WRAPPER); assertThat(loaded.getLoaded().getMethod(FOO).invoke(loaded.getLoaded().getConstructor().newInstance()), nullValue(Object.class)); assertThat(loaded.getLoaded().getField(BAR).get(null), is(value)); }
public static OwnerTypeLocatable ofField(String name) { return of(new FieldNameExtractor.ForFixedValue(name)); }
FieldAccessor implements Implementation { public static OwnerTypeLocatable ofField(String name) { return of(new FieldNameExtractor.ForFixedValue(name)); } }
FieldAccessor implements Implementation { public static OwnerTypeLocatable ofField(String name) { return of(new FieldNameExtractor.ForFixedValue(name)); } protected  FieldAccessor(FieldLocation fieldLocation, Assigner assigner, Assigner.Typing typing); }
FieldAccessor implements Implementation { public static OwnerTypeLocatable ofField(String name) { return of(new FieldNameExtractor.ForFixedValue(name)); } protected  FieldAccessor(FieldLocation fieldLocation, Assigner assigner, Assigner.Typing typing); static OwnerTypeLocatable ofField(String name); static OwnerTypeLocatable ofBeanProperty(); static OwnerTypeLocatable of(FieldNameExtractor fieldNameExtractor); static AssignerConfigurable of(Field field); static AssignerConfigurable of(FieldDescription fieldDescription); }
FieldAccessor implements Implementation { public static OwnerTypeLocatable ofField(String name) { return of(new FieldNameExtractor.ForFixedValue(name)); } protected  FieldAccessor(FieldLocation fieldLocation, Assigner assigner, Assigner.Typing typing); static OwnerTypeLocatable ofField(String name); static OwnerTypeLocatable ofBeanProperty(); static OwnerTypeLocatable of(FieldNameExtractor fieldNameExtractor); static AssignerConfigurable of(Field field); static AssignerConfigurable of(FieldDescription fieldDescription);  }