@Test public void testNullNestedProperty() { NestedMethodProperty<String> managerNameProperty = new NestedMethodProperty<String>( vaadin, "manager.name"); NestedMethodProperty<String> streetProperty = new NestedMethodProperty<String>( vaadin, "manager.address.street"); joonas.setAddress(null); assertNull(streetProperty.getValue()); vaadin.setManager(null); assertNull(managerNameProperty.getValue()); assertNull(streetProperty.getValue()); vaadin.setManager(joonas); Assert.assertEquals("Joonas", managerNameProperty.getValue()); Assert.assertNull(streetProperty.getValue()); }
@Override public T getValue() { try { Object object = instance; for (Method m : getMethods) { object = m.invoke(object); if (object == null) { return null; } } return (T) object; } catch (final Throwable e) { throw new MethodException(this, e); } }
NestedMethodProperty extends AbstractProperty<T> { @Override public T getValue() { try { Object object = instance; for (Method m : getMethods) { object = m.invoke(object); if (object == null) { return null; } } return (T) object; } catch (final Throwable e) { throw new MethodException(this, e); } } }
NestedMethodProperty extends AbstractProperty<T> { @Override public T getValue() { try { Object object = instance; for (Method m : getMethods) { object = m.invoke(object); if (object == null) { return null; } } return (T) object; } catch (final Throwable e) { throw new MethodException(this, e); } } NestedMethodProperty(Object instance, String propertyName);   NestedMethodProperty(Class<?> instanceClass, String propertyName); }
NestedMethodProperty extends AbstractProperty<T> { @Override public T getValue() { try { Object object = instance; for (Method m : getMethods) { object = m.invoke(object); if (object == null) { return null; } } return (T) object; } catch (final Throwable e) { throw new MethodException(this, e); } } NestedMethodProperty(Object instance, String propertyName);   NestedMethodProperty(Class<?> instanceClass, String propertyName); @Override Class<? extends T> getType(); @Override boolean isReadOnly(); @Override T getValue(); @Override void setValue(T newValue); }
NestedMethodProperty extends AbstractProperty<T> { @Override public T getValue() { try { Object object = instance; for (Method m : getMethods) { object = m.invoke(object); if (object == null) { return null; } } return (T) object; } catch (final Throwable e) { throw new MethodException(this, e); } } NestedMethodProperty(Object instance, String propertyName);   NestedMethodProperty(Class<?> instanceClass, String propertyName); @Override Class<? extends T> getType(); @Override boolean isReadOnly(); @Override T getValue(); @Override void setValue(T newValue);  }