Java Code Examples for net.bytebuddy.description.field.FieldDescription#ForLoadedField

The following examples show how to use net.bytebuddy.description.field.FieldDescription#ForLoadedField . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GenericSignatureResolutionTest.java    From byte-buddy with Apache License 2.0 5 votes vote down vote up
@Test
public void testGenericField() throws Exception {
    DynamicType.Unloaded<?> unloaded = new ByteBuddy()
            .redefine(GenericField.class)
            .make();
    Class<?> type = unloaded.load(ClassLoadingStrategy.BOOTSTRAP_LOADER, ClassLoadingStrategy.Default.WRAPPER).getLoaded();
    FieldDescription createdField = new FieldDescription.ForLoadedField(type.getDeclaredField(FOO));
    FieldDescription originalField = new FieldDescription.ForLoadedField(GenericField.class.getDeclaredField(FOO));
    assertThat(createdField.getType(), is(originalField.getType()));
}
 
Example 2
Source File: TypePoolDefaultLazyFieldListTest.java    From byte-buddy with Apache License 2.0 4 votes vote down vote up
protected FieldDescription.InDefinedShape asElement(Field element) {
    return new FieldDescription.ForLoadedField(element);
}