Search in sources :

Example 1 with ExclusiveParametersModel

use of org.mule.runtime.api.meta.model.parameter.ExclusiveParametersModel 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));
    });
}
Also used : ExclusiveParametersDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ExclusiveParametersDeclaration) ExclusiveParametersModel(org.mule.runtime.api.meta.model.parameter.ExclusiveParametersModel) ImmutableExclusiveParametersModel(org.mule.runtime.extension.api.model.parameter.ImmutableExclusiveParametersModel) ParameterGroupDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ParameterGroupDeclaration) ExclusiveOptionalModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.ExclusiveOptionalModelProperty) ImmutableExclusiveParametersModel(org.mule.runtime.extension.api.model.parameter.ImmutableExclusiveParametersModel)

Aggregations

ExclusiveParametersDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.ExclusiveParametersDeclaration)1 ParameterGroupDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.ParameterGroupDeclaration)1 ExclusiveParametersModel (org.mule.runtime.api.meta.model.parameter.ExclusiveParametersModel)1 ImmutableExclusiveParametersModel (org.mule.runtime.extension.api.model.parameter.ImmutableExclusiveParametersModel)1 ExclusiveOptionalModelProperty (org.mule.runtime.module.extension.internal.loader.java.property.ExclusiveOptionalModelProperty)1