@Test public void testCreateAspect_Dynamic() { CaptionAspectDefinition captionAspectDefinition = new CaptionAspectDefinition(CaptionType.DYNAMIC, "foo"); Aspect<String> aspect = captionAspectDefinition.createAspect(); assertThat(aspect.getName(), is(CaptionAspectDefinition.NAME)); assertThat(aspect.isValuePresent(), is(false)); }
@Override public Aspect<String> createAspect() { switch (captionType) { case AUTO: return StringUtils.isEmpty(staticCaption) ? Aspect.of(NAME) : Aspect.of(NAME, staticCaption); case DYNAMIC: return Aspect.of(NAME); case STATIC: return Aspect.of(NAME, staticCaption); case NONE: return Aspect.of(NAME, null); default: throw new IllegalArgumentException("CaptionType " + captionType + " is not supported."); } }
CaptionAspectDefinition extends ModelToUiAspectDefinition<String> { @Override public Aspect<String> createAspect() { switch (captionType) { case AUTO: return StringUtils.isEmpty(staticCaption) ? Aspect.of(NAME) : Aspect.of(NAME, staticCaption); case DYNAMIC: return Aspect.of(NAME); case STATIC: return Aspect.of(NAME, staticCaption); case NONE: return Aspect.of(NAME, null); default: throw new IllegalArgumentException("CaptionType " + captionType + " is not supported."); } } }
CaptionAspectDefinition extends ModelToUiAspectDefinition<String> { @Override public Aspect<String> createAspect() { switch (captionType) { case AUTO: return StringUtils.isEmpty(staticCaption) ? Aspect.of(NAME) : Aspect.of(NAME, staticCaption); case DYNAMIC: return Aspect.of(NAME); case STATIC: return Aspect.of(NAME, staticCaption); case NONE: return Aspect.of(NAME, null); default: throw new IllegalArgumentException("CaptionType " + captionType + " is not supported."); } } CaptionAspectDefinition(CaptionType captionType, String staticCaption); }
CaptionAspectDefinition extends ModelToUiAspectDefinition<String> { @Override public Aspect<String> createAspect() { switch (captionType) { case AUTO: return StringUtils.isEmpty(staticCaption) ? Aspect.of(NAME) : Aspect.of(NAME, staticCaption); case DYNAMIC: return Aspect.of(NAME); case STATIC: return Aspect.of(NAME, staticCaption); case NONE: return Aspect.of(NAME, null); default: throw new IllegalArgumentException("CaptionType " + captionType + " is not supported."); } } CaptionAspectDefinition(CaptionType captionType, String staticCaption); @Override Aspect<String> createAspect(); @Override Consumer<String> createComponentValueSetter(ComponentWrapper componentWrapper); @Override boolean supports(WrapperType type); }
CaptionAspectDefinition extends ModelToUiAspectDefinition<String> { @Override public Aspect<String> createAspect() { switch (captionType) { case AUTO: return StringUtils.isEmpty(staticCaption) ? Aspect.of(NAME) : Aspect.of(NAME, staticCaption); case DYNAMIC: return Aspect.of(NAME); case STATIC: return Aspect.of(NAME, staticCaption); case NONE: return Aspect.of(NAME, null); default: throw new IllegalArgumentException("CaptionType " + captionType + " is not supported."); } } CaptionAspectDefinition(CaptionType captionType, String staticCaption); @Override Aspect<String> createAspect(); @Override Consumer<String> createComponentValueSetter(ComponentWrapper componentWrapper); @Override boolean supports(WrapperType type); static final String NAME; }