View Javadoc

1   package com.atlassian.plugin;
2   
3   import java.io.Serializable;
4   import java.util.Comparator;
5   
6   /**
7    * Compares two plugins by their names
8    */
9   class PluginNameComparator implements Comparator, Serializable
10  {
11      static final long serialVersionUID = -2595168544386708474L;
12  
13      /**
14       * Gets names of the two given plugins and returns the result of their comparison
15       *
16       * @param o1 plugin to compare
17       * @param o2 plugin to compare
18       * @return result of plugin name comparison
19       */
20      public int compare(Object o1, Object o2)
21      {
22          Plugin p1 = (Plugin) o1;
23          Plugin p2 = (Plugin) o2;
24          return p1.getName().compareTo(p2.getName());
25      }
26  }