@Test public void testCreateAspect_enabled() { EnabledAspectDefinition aspectDefinition = new EnabledAspectDefinition(EnabledType.ENABLED); Aspect<Boolean> createdAspect = aspectDefinition.createAspect(); assertThat(createdAspect.getName(), is(EnabledAspectDefinition.NAME)); assertThat(createdAspect.getValue(), is(true)); }
@Override public Aspect<Boolean> createAspect() { switch (enabledType) { case DISABLED: return Aspect.of(NAME, false); case DYNAMIC: return Aspect.of(NAME); case ENABLED: return Aspect.of(NAME, true); default: throw new IllegalStateException("Unknown enabled type: " + enabledType); } }
EnabledAspectDefinition extends ModelToUiAspectDefinition<Boolean> { @Override public Aspect<Boolean> createAspect() { switch (enabledType) { case DISABLED: return Aspect.of(NAME, false); case DYNAMIC: return Aspect.of(NAME); case ENABLED: return Aspect.of(NAME, true); default: throw new IllegalStateException("Unknown enabled type: " + enabledType); } } }
EnabledAspectDefinition extends ModelToUiAspectDefinition<Boolean> { @Override public Aspect<Boolean> createAspect() { switch (enabledType) { case DISABLED: return Aspect.of(NAME, false); case DYNAMIC: return Aspect.of(NAME); case ENABLED: return Aspect.of(NAME, true); default: throw new IllegalStateException("Unknown enabled type: " + enabledType); } } EnabledAspectDefinition(EnabledType enabledType); }
EnabledAspectDefinition extends ModelToUiAspectDefinition<Boolean> { @Override public Aspect<Boolean> createAspect() { switch (enabledType) { case DISABLED: return Aspect.of(NAME, false); case DYNAMIC: return Aspect.of(NAME); case ENABLED: return Aspect.of(NAME, true); default: throw new IllegalStateException("Unknown enabled type: " + enabledType); } } EnabledAspectDefinition(EnabledType enabledType); @Override Aspect<Boolean> createAspect(); @Override Consumer<Boolean> createComponentValueSetter(ComponentWrapper componentWrapper); }
EnabledAspectDefinition extends ModelToUiAspectDefinition<Boolean> { @Override public Aspect<Boolean> createAspect() { switch (enabledType) { case DISABLED: return Aspect.of(NAME, false); case DYNAMIC: return Aspect.of(NAME); case ENABLED: return Aspect.of(NAME, true); default: throw new IllegalStateException("Unknown enabled type: " + enabledType); } } EnabledAspectDefinition(EnabledType enabledType); @Override Aspect<Boolean> createAspect(); @Override Consumer<Boolean> createComponentValueSetter(ComponentWrapper componentWrapper); static final String NAME; }