All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.takari.maven.plugins.plugin.Sorting Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version
package io.takari.maven.plugins.plugin;

import java.util.Collections;
import java.util.Comparator;
import java.util.List;

import io.takari.maven.plugins.plugin.model.MojoDescriptor;
import io.takari.maven.plugins.plugin.model.MojoParameter;
import io.takari.maven.plugins.plugin.model.MojoRequirement;

class Sorting {

  public static void sortDescriptors(List descriptors) {
    Collections.sort(descriptors, new Comparator() {
      @Override
      public int compare(MojoDescriptor p1, MojoDescriptor p2) {
        return p1.getImplementation().compareTo(p2.getImplementation());
      }
    });
  }

  public static void sortParameters(List parameters) {
    Collections.sort(parameters, new Comparator() {
      @Override
      public int compare(MojoParameter p1, MojoParameter p2) {
        return p1.getName().compareTo(p2.getName());
      }
    });
  }

  public static void sortRequirements(List requirements) {
    Collections.sort(requirements, new Comparator() {
      @Override
      public int compare(MojoRequirement p1, MojoRequirement p2) {
        return p1.getFieldName().compareTo(p2.getFieldName());
      }
    });
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy