@Test public void testGetDerivedValue() { Aspect<String> derived = Aspect.of("", LinkkiAspectDefinition.DERIVED_BY_LINKKI); when(uiAnnotationFallbackDispatcher.getProperty()).thenReturn("foo"); assertThat(pull("foo", derived), is("Foo")); }
@SuppressWarnings("unchecked") @Override public <T> T pull(Aspect<T> aspect) { if (aspect.isValuePresent()) { T staticValue = aspect.getValue(); Object boundObject = getBoundObject(); if (staticValue instanceof String && boundObject != null) { Class<?> pmoClass = getTypeForKey(boundObject); staticValue = (T)PmoNlsService.get() .getLabel(pmoClass, getProperty(), aspect.getName(), (String)staticValue); } if (LinkkiAspectDefinition.DERIVED_BY_LINKKI.equals(staticValue)) { return (T)StringUtils.capitalize(getProperty()); } return staticValue; } else { return super.pull(aspect); } }
StaticValueDispatcher extends AbstractPropertyDispatcherDecorator { @SuppressWarnings("unchecked") @Override public <T> T pull(Aspect<T> aspect) { if (aspect.isValuePresent()) { T staticValue = aspect.getValue(); Object boundObject = getBoundObject(); if (staticValue instanceof String && boundObject != null) { Class<?> pmoClass = getTypeForKey(boundObject); staticValue = (T)PmoNlsService.get() .getLabel(pmoClass, getProperty(), aspect.getName(), (String)staticValue); } if (LinkkiAspectDefinition.DERIVED_BY_LINKKI.equals(staticValue)) { return (T)StringUtils.capitalize(getProperty()); } return staticValue; } else { return super.pull(aspect); } } }
StaticValueDispatcher extends AbstractPropertyDispatcherDecorator { @SuppressWarnings("unchecked") @Override public <T> T pull(Aspect<T> aspect) { if (aspect.isValuePresent()) { T staticValue = aspect.getValue(); Object boundObject = getBoundObject(); if (staticValue instanceof String && boundObject != null) { Class<?> pmoClass = getTypeForKey(boundObject); staticValue = (T)PmoNlsService.get() .getLabel(pmoClass, getProperty(), aspect.getName(), (String)staticValue); } if (LinkkiAspectDefinition.DERIVED_BY_LINKKI.equals(staticValue)) { return (T)StringUtils.capitalize(getProperty()); } return staticValue; } else { return super.pull(aspect); } } StaticValueDispatcher(PropertyDispatcher wrappedDispatcher); }
StaticValueDispatcher extends AbstractPropertyDispatcherDecorator { @SuppressWarnings("unchecked") @Override public <T> T pull(Aspect<T> aspect) { if (aspect.isValuePresent()) { T staticValue = aspect.getValue(); Object boundObject = getBoundObject(); if (staticValue instanceof String && boundObject != null) { Class<?> pmoClass = getTypeForKey(boundObject); staticValue = (T)PmoNlsService.get() .getLabel(pmoClass, getProperty(), aspect.getName(), (String)staticValue); } if (LinkkiAspectDefinition.DERIVED_BY_LINKKI.equals(staticValue)) { return (T)StringUtils.capitalize(getProperty()); } return staticValue; } else { return super.pull(aspect); } } StaticValueDispatcher(PropertyDispatcher wrappedDispatcher); @SuppressWarnings("unchecked") @Override T pull(Aspect<T> aspect); }
StaticValueDispatcher extends AbstractPropertyDispatcherDecorator { @SuppressWarnings("unchecked") @Override public <T> T pull(Aspect<T> aspect) { if (aspect.isValuePresent()) { T staticValue = aspect.getValue(); Object boundObject = getBoundObject(); if (staticValue instanceof String && boundObject != null) { Class<?> pmoClass = getTypeForKey(boundObject); staticValue = (T)PmoNlsService.get() .getLabel(pmoClass, getProperty(), aspect.getName(), (String)staticValue); } if (LinkkiAspectDefinition.DERIVED_BY_LINKKI.equals(staticValue)) { return (T)StringUtils.capitalize(getProperty()); } return staticValue; } else { return super.pull(aspect); } } StaticValueDispatcher(PropertyDispatcher wrappedDispatcher); @SuppressWarnings("unchecked") @Override T pull(Aspect<T> aspect);  }