@Override protected void onSource(SourceDeclaration source) { extractType(source).ifPresent(type -> { if (type.isAssignableTo(PollingSource.class)) { source.setRunsOnPrimaryNodeOnly(true); ParameterDeclaration parameter = new ParameterDeclaration(SCHEDULING_STRATEGY_PARAMETER_NAME); parameter.setDescription(SCHEDULING_STRATEGY_PARAMETER_DESCRIPTION); parameter.setRequired(true); parameter.setType(loader.load(Scheduler.class), false); parameter.setExpressionSupport(NOT_SUPPORTED); parameter.addModelProperty(new InfrastructureParameterModelProperty(10)); parameter.addModelProperty(new QNameModelProperty(new QName(CORE_NAMESPACE, SCHEDULING_STRATEGY_ELEMENT_IDENTIFIER, CORE_PREFIX))); parameter.setDslConfiguration(ParameterDslConfiguration.builder() .allowsInlineDefinition(true) .allowsReferences(false) .allowTopLevelDefinition(false) .build()); thereArePollingSources.set(true); source.getParameterGroup(DEFAULT_GROUP_NAME).addParameter(parameter); } }); } }.walk(extensionDeclarer.getDeclaration());
declaration.setDslConfiguration(builder.build());
@Override protected void onSource(SourceDeclaration source) { extractType(source).ifPresent(type -> { if (type.isAssignableTo(PollingSource.class)) { source.setRunsOnPrimaryNodeOnly(true); ParameterDeclaration parameter = new ParameterDeclaration(SCHEDULING_STRATEGY_PARAMETER_NAME); parameter.setDescription(SCHEDULING_STRATEGY_PARAMETER_DESCRIPTION); parameter.setRequired(true); parameter.setType(loader.load(Scheduler.class), false); parameter.setExpressionSupport(NOT_SUPPORTED); parameter.addModelProperty(new InfrastructureParameterModelProperty(10)); parameter.addModelProperty(new QNameModelProperty(new QName(CORE_NAMESPACE, SCHEDULING_STRATEGY_ELEMENT_IDENTIFIER, CORE_PREFIX))); parameter.setDslConfiguration(ParameterDslConfiguration.builder() .allowsInlineDefinition(true) .allowsReferences(false) .allowTopLevelDefinition(false) .build()); thereArePollingSources.set(true); source.getParameterGroup(DEFAULT_GROUP_NAME).addParameter(parameter); } }); } }.walk(extensionDeclarer.getDeclaration());