View Javadoc
1   /**
2    * Logback: the reliable, generic, fast and flexible logging framework.
3    * Copyright (C) 1999-2015, QOS.ch. All rights reserved.
4    *
5    * This program and the accompanying materials are dual-licensed under
6    * either the terms of the Eclipse Public License v1.0 as published by
7    * the Eclipse Foundation
8    *
9    *   or (per the licensee's choosing)
10   *
11   * under the terms of the GNU Lesser General Public License version 2.1
12   * as published by the Free Software Foundation.
13   */
14  package ch.qos.logback.classic.spi;
15  
16  import java.io.Serializable;
17  
18  public class ClassPackagingData implements Serializable {
19  
20      private static final long serialVersionUID = -804643281218337001L;
21      final String codeLocation;
22      final String version;
23      private final boolean exact;
24  
25      public ClassPackagingData(String codeLocation, String version) {
26          this.codeLocation = codeLocation;
27          this.version = version;
28          this.exact = true;
29      }
30  
31      public ClassPackagingData(String classLocation, String version, boolean exact) {
32          this.codeLocation = classLocation;
33          this.version = version;
34          this.exact = exact;
35      }
36  
37      public String getCodeLocation() {
38          return codeLocation;
39      }
40  
41      public String getVersion() {
42          return version;
43      }
44  
45      public boolean isExact() {
46          return exact;
47      }
48  
49      @Override
50      public int hashCode() {
51          final int PRIME = 31;
52          int result = 1;
53          result = PRIME * result + ((codeLocation == null) ? 0 : codeLocation.hashCode());
54          return result;
55      }
56  
57      @Override
58      public boolean equals(Object obj) {
59          if (this == obj)
60              return true;
61          if (obj == null)
62              return false;
63          if (getClass() != obj.getClass())
64              return false;
65          final ClassPackagingData other = (ClassPackagingData) obj;
66          if (codeLocation == null) {
67              if (other.codeLocation != null)
68                  return false;
69          } else if (!codeLocation.equals(other.codeLocation))
70              return false;
71          if (exact != other.exact)
72              return false;
73          if (version == null) {
74              if (other.version != null)
75                  return false;
76          } else if (!version.equals(other.version))
77              return false;
78          return true;
79      }
80  
81  }