@Test public void testGetPropertyValueBeanAndPropertyNameNotNull() throws Exception { FooBean foo = new FooBean(); foo.setBar("test"); Object o = ConstraintValidatorsUtils.getPropertyValue(foo, "bar"); assertThat(o, notNullValue()); }
static Object getPropertyValue(Object bean, String propertyName) { if (bean == null || isEmpty(propertyName)) { return null; } try { PropertyDescriptor property = new PropertyDescriptor(propertyName, bean .getClass()); Method getter = property.getReadMethod(); return getter.invoke(bean); } catch (Exception e) { throw reportFailedToInitialize(e); } }
ConstraintValidatorsUtils { static Object getPropertyValue(Object bean, String propertyName) { if (bean == null || isEmpty(propertyName)) { return null; } try { PropertyDescriptor property = new PropertyDescriptor(propertyName, bean .getClass()); Method getter = property.getReadMethod(); return getter.invoke(bean); } catch (Exception e) { throw reportFailedToInitialize(e); } } }
ConstraintValidatorsUtils { static Object getPropertyValue(Object bean, String propertyName) { if (bean == null || isEmpty(propertyName)) { return null; } try { PropertyDescriptor property = new PropertyDescriptor(propertyName, bean .getClass()); Method getter = property.getReadMethod(); return getter.invoke(bean); } catch (Exception e) { throw reportFailedToInitialize(e); } } private  ConstraintValidatorsUtils(); }
ConstraintValidatorsUtils { static Object getPropertyValue(Object bean, String propertyName) { if (bean == null || isEmpty(propertyName)) { return null; } try { PropertyDescriptor property = new PropertyDescriptor(propertyName, bean .getClass()); Method getter = property.getReadMethod(); return getter.invoke(bean); } catch (Exception e) { throw reportFailedToInitialize(e); } } private  ConstraintValidatorsUtils();  }
ConstraintValidatorsUtils { static Object getPropertyValue(Object bean, String propertyName) { if (bean == null || isEmpty(propertyName)) { return null; } try { PropertyDescriptor property = new PropertyDescriptor(propertyName, bean .getClass()); Method getter = property.getReadMethod(); return getter.invoke(bean); } catch (Exception e) { throw reportFailedToInitialize(e); } } private  ConstraintValidatorsUtils();   }