@Test public void testPull_Class() { MockUi.setLocale(Locale.GERMANY); IpsPropertyDispatcher ipsPropertyDispatcher = new IpsPropertyDispatcher( pmo::getIpsObject, "", standardDispatcherChain("")); String string = ipsPropertyDispatcher.pull(Aspect.of("", LinkkiAspectDefinition.DERIVED_BY_LINKKI)); assertThat(string, is("Ein Testobjekt")); MockUi.setLocale(Locale.ENGLISH); string = ipsPropertyDispatcher.pull(Aspect.of("", LinkkiAspectDefinition.DERIVED_BY_LINKKI)); assertThat(string, is("A test object")); }
@Override public <T> T pull(Aspect<T> aspect) { if (aspect.isValuePresent()) { T staticValue = aspect.getValue(); if (LinkkiAspectDefinition.DERIVED_BY_LINKKI.equals(staticValue)) { @SuppressWarnings("unchecked") T label = (T)findModelElement() .map(this::getLabel) .orElseGet(() -> (String)super.pull(aspect)); return label; } } return super.pull(aspect); }
IpsPropertyDispatcher extends AbstractPropertyDispatcherDecorator { @Override public <T> T pull(Aspect<T> aspect) { if (aspect.isValuePresent()) { T staticValue = aspect.getValue(); if (LinkkiAspectDefinition.DERIVED_BY_LINKKI.equals(staticValue)) { @SuppressWarnings("unchecked") T label = (T)findModelElement() .map(this::getLabel) .orElseGet(() -> (String)super.pull(aspect)); return label; } } return super.pull(aspect); } }
IpsPropertyDispatcher extends AbstractPropertyDispatcherDecorator { @Override public <T> T pull(Aspect<T> aspect) { if (aspect.isValuePresent()) { T staticValue = aspect.getValue(); if (LinkkiAspectDefinition.DERIVED_BY_LINKKI.equals(staticValue)) { @SuppressWarnings("unchecked") T label = (T)findModelElement() .map(this::getLabel) .orElseGet(() -> (String)super.pull(aspect)); return label; } } return super.pull(aspect); } IpsPropertyDispatcher(Supplier<?> modelObjectSupplier, String modelAttribute,
            PropertyDispatcher wrappedDispatcher); }
IpsPropertyDispatcher extends AbstractPropertyDispatcherDecorator { @Override public <T> T pull(Aspect<T> aspect) { if (aspect.isValuePresent()) { T staticValue = aspect.getValue(); if (LinkkiAspectDefinition.DERIVED_BY_LINKKI.equals(staticValue)) { @SuppressWarnings("unchecked") T label = (T)findModelElement() .map(this::getLabel) .orElseGet(() -> (String)super.pull(aspect)); return label; } } return super.pull(aspect); } IpsPropertyDispatcher(Supplier<?> modelObjectSupplier, String modelAttribute,
            PropertyDispatcher wrappedDispatcher); @Override T pull(Aspect<T> aspect); static PropertyDispatcher createIpsPropertyDispatcher(Object pmo,
            BoundProperty boundProperty,
            PropertyDispatcher standardDispatchers); }
IpsPropertyDispatcher extends AbstractPropertyDispatcherDecorator { @Override public <T> T pull(Aspect<T> aspect) { if (aspect.isValuePresent()) { T staticValue = aspect.getValue(); if (LinkkiAspectDefinition.DERIVED_BY_LINKKI.equals(staticValue)) { @SuppressWarnings("unchecked") T label = (T)findModelElement() .map(this::getLabel) .orElseGet(() -> (String)super.pull(aspect)); return label; } } return super.pull(aspect); } IpsPropertyDispatcher(Supplier<?> modelObjectSupplier, String modelAttribute,
            PropertyDispatcher wrappedDispatcher); @Override T pull(Aspect<T> aspect); static PropertyDispatcher createIpsPropertyDispatcher(Object pmo,
            BoundProperty boundProperty,
            PropertyDispatcher standardDispatchers);  }