@Test public void testGet() { TypeReflector<TestClass> underTest = new TypeReflector<>(TestClass.class); assertEquals(1, underTest.getPropertyDescriptors().size()); TestClass instance = new TestClass(); assertNull(instance.getValue()); assertNull(underTest.get(instance, "value")); instance.setValue("test"); assertEquals("test", underTest.get(instance, "value")); }
public Object get(T bean, String name) { validate(bean, name); Function<T, Object> getter = getters.get(name); if (getter == null) { throw new IllegalArgumentException("No getter specified for property '" + name + "' on bean class '" + bean.getClass() + "'"); } return getter.apply(bean); }
TypeReflector { public Object get(T bean, String name) { validate(bean, name); Function<T, Object> getter = getters.get(name); if (getter == null) { throw new IllegalArgumentException("No getter specified for property '" + name + "' on bean class '" + bean.getClass() + "'"); } return getter.apply(bean); } }
TypeReflector { public Object get(T bean, String name) { validate(bean, name); Function<T, Object> getter = getters.get(name); if (getter == null) { throw new IllegalArgumentException("No getter specified for property '" + name + "' on bean class '" + bean.getClass() + "'"); } return getter.apply(bean); } TypeReflector(Class<T> clazz);  TypeReflector(JavaType javaType); }
TypeReflector { public Object get(T bean, String name) { validate(bean, name); Function<T, Object> getter = getters.get(name); if (getter == null) { throw new IllegalArgumentException("No getter specified for property '" + name + "' on bean class '" + bean.getClass() + "'"); } return getter.apply(bean); } TypeReflector(Class<T> clazz);  TypeReflector(JavaType javaType); @Override boolean equals(Object o); @Override int hashCode(); JavaType getJavaType(); @SuppressWarnings("unchecked") Class<T> getTypeClass(); T instantiate(); List<PropertyDescriptor> getPropertyDescriptors(); Map<String, PropertyDescriptor> getPropertyDescriptorIndex(); Object get(T bean, String name); void set(T bean, String name, Object value); A getAnnotation(Class<A> annotationClass); A getAnnotation(PropertyDescriptor propertyDescriptor, Class<A> annotationClass); A getAnnotation(String propertyName, Class<A> annotationClass); Class reifyPropertyType(String property); Class reifyPropertyType(PropertyDescriptor property); }
TypeReflector { public Object get(T bean, String name) { validate(bean, name); Function<T, Object> getter = getters.get(name); if (getter == null) { throw new IllegalArgumentException("No getter specified for property '" + name + "' on bean class '" + bean.getClass() + "'"); } return getter.apply(bean); } TypeReflector(Class<T> clazz);  TypeReflector(JavaType javaType); @Override boolean equals(Object o); @Override int hashCode(); JavaType getJavaType(); @SuppressWarnings("unchecked") Class<T> getTypeClass(); T instantiate(); List<PropertyDescriptor> getPropertyDescriptors(); Map<String, PropertyDescriptor> getPropertyDescriptorIndex(); Object get(T bean, String name); void set(T bean, String name, Object value); A getAnnotation(Class<A> annotationClass); A getAnnotation(PropertyDescriptor propertyDescriptor, Class<A> annotationClass); A getAnnotation(String propertyName, Class<A> annotationClass); Class reifyPropertyType(String property); Class reifyPropertyType(PropertyDescriptor property);  }