AttributeDescriptor { Field getReadField(Class targetType) { try { return targetType.getField(_name); } catch (NoSuchFieldException e) { return null; } } AttributeDescriptor(TypeRegistry pdxRegistry, String name); boolean validateReadType(Class targetType); Object read(Object target, ExecutionContext executionContext);  }
@Test @Parameters({PRIVATE_ACCESSOR_BY_NAME, PRIVATE_ACCESSOR_BY_GETTER}) public void getReadFieldShouldReturnNullForNonPublicAttributes(String attributeName) { AttributeDescriptor attributeDescriptor = new AttributeDescriptor(typeRegistry, attributeName); assertThat(attributeDescriptor.getReadField(TestBean.class)).isNull(); }
@Test @Parameters({PUBLIC_NO_ACCESSORS, PUBLIC_ACCESSOR_BY_NAME, PUBLIC_ACCESSOR_BY_GETTER}) public void getReadFieldShouldReturnRequestedFieldForPublicAttributes(String attributeName) throws NoSuchFieldException { AttributeDescriptor attributeDescriptor = new AttributeDescriptor(typeRegistry, attributeName); assertThat(attributeDescriptor.getReadField(TestBean.class)) .isEqualTo(TestBean.class.getField(attributeName)); }