Search in sources :

Example 1 with ParameterModelComparator

use of org.mule.runtime.extension.api.util.ParameterModelComparator in project mule by mulesoft.

the class SchemaBuilder method getSortedParameterModels.

/**
 * Sorts the given {@code parameterModels} so that infrastructure ones are firsts and the rest maintain their relative order. If
 * more than one infrastructure parameter is found, the subgroup is sorted alphabetically.
 * <p>
 * The {@link InfrastructureParameterModelProperty} is used to identify those parameters which are infrastructure
 *
 * @param parameterModels a {@link Collection} of {@link ParameterModel parameter models}
 * @return a sorted {@link List}
 */
private List<ParameterModel> getSortedParameterModels(Collection<ParameterModel> parameterModels) {
    List<ParameterModel> sortedParameters = new ArrayList<>(parameterModels);
    sortedParameters.sort(new ParameterModelComparator(true));
    return sortedParameters;
}
Also used : ParameterModel(org.mule.runtime.api.meta.model.parameter.ParameterModel) ParameterModelComparator(org.mule.runtime.extension.api.util.ParameterModelComparator) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 ParameterModel (org.mule.runtime.api.meta.model.parameter.ParameterModel)1 ParameterModelComparator (org.mule.runtime.extension.api.util.ParameterModelComparator)1