@Test public void testPull_Static() { ReflectionPropertyDispatcher dispatcher = new ReflectionPropertyDispatcher(() -> testPmo, TestModelObject.PROPERTY_ABC, new ExceptionPropertyDispatcher(TestModelObject.PROPERTY_ABC)); Assertions.assertThrows(IllegalStateException.class, () -> { dispatcher.pull(Aspect.of(VisibleAspectDefinition.NAME, false)); }); }
@Override @SuppressWarnings("unchecked") public <V> V pull(Aspect<V> aspect) { if (aspect.isValuePresent()) { throw new IllegalStateException(String .format("Static aspect %s should not be handled by %s. It seems like the dispatcher chain is broken, check your %s", aspect, getClass().getSimpleName(), BindingContext.class.getSimpleName())); } @CheckForNull Object boundObject = getBoundObject(); String propertyAspectName = getPropertyAspectName(aspect); if (boundObject != null && hasReadMethod(propertyAspectName)) { PropertyAccessor<Object, V> accessor = (PropertyAccessor<Object, V>)getAccessor(propertyAspectName); return accessor.getPropertyValue(boundObject); } else { return fallbackDispatcher.pull(aspect); } }
ReflectionPropertyDispatcher implements PropertyDispatcher { @Override @SuppressWarnings("unchecked") public <V> V pull(Aspect<V> aspect) { if (aspect.isValuePresent()) { throw new IllegalStateException(String .format("Static aspect %s should not be handled by %s. It seems like the dispatcher chain is broken, check your %s", aspect, getClass().getSimpleName(), BindingContext.class.getSimpleName())); } @CheckForNull Object boundObject = getBoundObject(); String propertyAspectName = getPropertyAspectName(aspect); if (boundObject != null && hasReadMethod(propertyAspectName)) { PropertyAccessor<Object, V> accessor = (PropertyAccessor<Object, V>)getAccessor(propertyAspectName); return accessor.getPropertyValue(boundObject); } else { return fallbackDispatcher.pull(aspect); } } }
ReflectionPropertyDispatcher implements PropertyDispatcher { @Override @SuppressWarnings("unchecked") public <V> V pull(Aspect<V> aspect) { if (aspect.isValuePresent()) { throw new IllegalStateException(String .format("Static aspect %s should not be handled by %s. It seems like the dispatcher chain is broken, check your %s", aspect, getClass().getSimpleName(), BindingContext.class.getSimpleName())); } @CheckForNull Object boundObject = getBoundObject(); String propertyAspectName = getPropertyAspectName(aspect); if (boundObject != null && hasReadMethod(propertyAspectName)) { PropertyAccessor<Object, V> accessor = (PropertyAccessor<Object, V>)getAccessor(propertyAspectName); return accessor.getPropertyValue(boundObject); } else { return fallbackDispatcher.pull(aspect); } } ReflectionPropertyDispatcher(Supplier<?> boundObjectSupplier, String property,
            PropertyDispatcher fallbackDispatcher); }
ReflectionPropertyDispatcher implements PropertyDispatcher { @Override @SuppressWarnings("unchecked") public <V> V pull(Aspect<V> aspect) { if (aspect.isValuePresent()) { throw new IllegalStateException(String .format("Static aspect %s should not be handled by %s. It seems like the dispatcher chain is broken, check your %s", aspect, getClass().getSimpleName(), BindingContext.class.getSimpleName())); } @CheckForNull Object boundObject = getBoundObject(); String propertyAspectName = getPropertyAspectName(aspect); if (boundObject != null && hasReadMethod(propertyAspectName)) { PropertyAccessor<Object, V> accessor = (PropertyAccessor<Object, V>)getAccessor(propertyAspectName); return accessor.getPropertyValue(boundObject); } else { return fallbackDispatcher.pull(aspect); } } ReflectionPropertyDispatcher(Supplier<?> boundObjectSupplier, String property,
            PropertyDispatcher fallbackDispatcher); @Override String getProperty(); @CheckForNull @Override Object getBoundObject(); @Override Class<?> getValueClass(); @Override @SuppressWarnings("unchecked") V pull(Aspect<V> aspect); @Override void push(Aspect<V> aspect); @Override boolean isPushable(Aspect<V> aspect); @Override MessageList getMessages(MessageList messageList); @Override String toString(); }
ReflectionPropertyDispatcher implements PropertyDispatcher { @Override @SuppressWarnings("unchecked") public <V> V pull(Aspect<V> aspect) { if (aspect.isValuePresent()) { throw new IllegalStateException(String .format("Static aspect %s should not be handled by %s. It seems like the dispatcher chain is broken, check your %s", aspect, getClass().getSimpleName(), BindingContext.class.getSimpleName())); } @CheckForNull Object boundObject = getBoundObject(); String propertyAspectName = getPropertyAspectName(aspect); if (boundObject != null && hasReadMethod(propertyAspectName)) { PropertyAccessor<Object, V> accessor = (PropertyAccessor<Object, V>)getAccessor(propertyAspectName); return accessor.getPropertyValue(boundObject); } else { return fallbackDispatcher.pull(aspect); } } ReflectionPropertyDispatcher(Supplier<?> boundObjectSupplier, String property,
            PropertyDispatcher fallbackDispatcher); @Override String getProperty(); @CheckForNull @Override Object getBoundObject(); @Override Class<?> getValueClass(); @Override @SuppressWarnings("unchecked") V pull(Aspect<V> aspect); @Override void push(Aspect<V> aspect); @Override boolean isPushable(Aspect<V> aspect); @Override MessageList getMessages(MessageList messageList); @Override String toString();  }