use of org.mule.runtime.app.declaration.api.fluent.ParameterizedElementDeclarer in project mule by mulesoft.
the class DefaultXmlArtifactDeclarationLoader method declareChildParameters.
private void declareChildParameters(ParameterizedModel model, DslElementSyntax modelDsl, List<ConfigLine> children, ParameterizedElementDeclarer declarer) {
model.getParameterGroupModels().forEach(group -> {
if (group.isShowInDsl()) {
modelDsl.getChild(group.getName()).ifPresent(groupDsl -> children.stream().filter(c -> c.getIdentifier().equals(groupDsl.getElementName())).findFirst().ifPresent(groupConfig -> declareInlineGroup(group, groupDsl, groupConfig, declarer)));
} else {
ParameterGroupElementDeclarer groupDeclarer = newParameterGroup(group.getName());
group.getParameterModels().forEach(param -> modelDsl.getChild(param.getName()).ifPresent(paramDsl -> {
if (isInfrastructure(param)) {
handleInfrastructure(param, children, declarer);
} else {
children.stream().filter(c -> c.getIdentifier().equals(paramDsl.getElementName())).findFirst().ifPresent(paramConfig -> param.getType().accept(getParameterDeclarerVisitor(paramConfig, paramDsl, value -> groupDeclarer.withParameter(param.getName(), value))));
}
}));
if (!groupDeclarer.getDeclaration().getParameters().isEmpty()) {
declarer.withParameterGroup(groupDeclarer.getDeclaration());
}
}
});
}
Aggregations