@Test public void testArgument() throws Exception { Class<? extends FooQux> fooQux = new ByteBuddy() .subclass(FooQux.class) .method(isDeclaredBy(FooQux.class)) .intercept(FixedValue.argument(1)) .make() .load(FooQux.class.getClassLoader(), ClassLoadingStrategy.Default.WRAPPER) .getLoaded(); assertThat(fooQux.getDeclaredFields().length, is(0)); assertThat(fooQux.getDeclaredMethods().length, is(1)); assertThat(fooQux.getDeclaredMethod(BAR, Integer.class, String.class).invoke(fooQux.getDeclaredConstructor().newInstance(), 0, BAR), is((Object) BAR)); }
public static AssignerConfigurable argument(int index) { if (index < 0) { throw new IllegalArgumentException("Argument index cannot be negative: " + index); } return new ForArgument(index); }
FixedValue implements Implementation { public static AssignerConfigurable argument(int index) { if (index < 0) { throw new IllegalArgumentException("Argument index cannot be negative: " + index); } return new ForArgument(index); } }
FixedValue implements Implementation { public static AssignerConfigurable argument(int index) { if (index < 0) { throw new IllegalArgumentException("Argument index cannot be negative: " + index); } return new ForArgument(index); } protected  FixedValue(Assigner assigner, Assigner.Typing typing); }
FixedValue implements Implementation { public static AssignerConfigurable argument(int index) { if (index < 0) { throw new IllegalArgumentException("Argument index cannot be negative: " + index); } return new ForArgument(index); } protected  FixedValue(Assigner assigner, Assigner.Typing typing); static AssignerConfigurable value(Object fixedValue); static AssignerConfigurable reference(Object fixedValue); static AssignerConfigurable reference(Object fixedValue, String fieldName); static AssignerConfigurable value(TypeDescription fixedValue); static AssignerConfigurable value(JavaConstant fixedValue); static AssignerConfigurable argument(int index); static AssignerConfigurable self(); static Implementation nullValue(); static AssignerConfigurable originType(); }
FixedValue implements Implementation { public static AssignerConfigurable argument(int index) { if (index < 0) { throw new IllegalArgumentException("Argument index cannot be negative: " + index); } return new ForArgument(index); } protected  FixedValue(Assigner assigner, Assigner.Typing typing); static AssignerConfigurable value(Object fixedValue); static AssignerConfigurable reference(Object fixedValue); static AssignerConfigurable reference(Object fixedValue, String fieldName); static AssignerConfigurable value(TypeDescription fixedValue); static AssignerConfigurable value(JavaConstant fixedValue); static AssignerConfigurable argument(int index); static AssignerConfigurable self(); static Implementation nullValue(); static AssignerConfigurable originType();  }