View Javadoc

    1   /*
    2    * This file is part of dependency-check-core.
    3    *
    4    * Dependency-check-core is free software: you can redistribute it and/or modify it
    5    * under the terms of the GNU General Public License as published by the Free
    6    * Software Foundation, either version 3 of the License, or (at your option) any
    7    * later version.
    8    *
    9    * Dependency-check-core is distributed in the hope that it will be useful, but
    10   * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11   * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    12   * details.
    13   *
    14   * You should have received a copy of the GNU General Public License along with
    15   * dependency-check-core. If not, see http://www.gnu.org/licenses/.
    16   *
    17   * Copyright (c) 2012 Jeremy Long. All Rights Reserved.
    18   */
    19  package org.owasp.dependencycheck.dependency;
    20
    21  import java.io.Serializable;
    22  import java.util.Comparator;
    23
    24  /**
    25   * Comparator for Vulnerability objects.
    26   *
    27   * @author Jeremy Long (jeremy.long@owasp.org)
    28   */
    29  public class VulnerabilityComparator implements Comparator<Vulnerability>, Serializable {
    30
    31      /**
    32       * The serial version UID.
    33       */
    34      private static final long serialVersionUID = 1L;
    35
    36      /**
    37       * Implements the comparison of vulnerabilities.
    38       *
    39       * @param o1 a vulnerability
    40       * @param o2 a second vulnerability
    41       * @return the comparison
    42       */
    43      public int compare(Vulnerability o1, Vulnerability o2) {
    44          return o2.getName().compareTo(o1.getName());
    45      }
    46  }