use of org.mule.runtime.api.meta.model.declaration.fluent.ExclusiveParametersDeclaration in project mule by mulesoft.
the class ExclusiveOptionalModelTestCase method exclusiveOptionals.
@Test
public void exclusiveOptionals() {
OperationDeclaration operation = getOperation(extensionDeclaration, "convinceAnimalKiller");
assertThat(operation.getParameterGroups(), hasSize(2));
ParameterGroupDeclaration group = operation.getParameterGroups().get(0);
assertThat(group.getName(), equalTo("arguments"));
assertThat(group.getExclusiveParameters(), hasSize(1));
ExclusiveParametersDeclaration exclusive = group.getExclusiveParameters().get(0);
assertThat(exclusive.isRequiresOne(), is(false));
assertThat(exclusive.getParameterNames(), containsInAnyOrder("argument1", "argument2", "argument3"));
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ExclusiveParametersDeclaration in project mule by mulesoft.
the class ParameterModelsLoaderDelegate method parseExclusiveOptional.
private void parseExclusiveOptional(ExtensionParameter extensionParameter, ParameterGroupDeclarer parameterGroupDeclarer, ParameterDeclarer parameter) {
ParameterGroupDeclaration groupDeclaration = (ParameterGroupDeclaration) parameterGroupDeclarer.getDeclaration();
List<ExclusiveParametersDeclaration> exclusiveParameters = groupDeclaration.getExclusiveParameters();
exclusiveParameters.stream().filter(group -> group.getParameterNames().contains(extensionParameter.getAlias())).findFirst().ifPresent(exclusiveParametersDeclaration -> {
ExclusiveParametersModel exclusiveParametersModel = new ImmutableExclusiveParametersModel(exclusiveParametersDeclaration.getParameterNames(), exclusiveParametersDeclaration.isRequiresOne());
parameter.withModelProperty(new ExclusiveOptionalModelProperty(exclusiveParametersModel));
});
}
Aggregations