1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.logging.log4j.core.impl;
18
19 import java.io.Serializable;
20
21
22
23
24 public final class ExtendedClassInfo implements Serializable {
25
26 private static final long serialVersionUID = 1L;
27
28 private final boolean exact;
29
30 private final String location;
31
32 private final String version;
33
34
35
36
37
38
39
40
41 public ExtendedClassInfo(final boolean exact, final String location, final String version) {
42 super();
43 this.exact = exact;
44 this.location = location;
45 this.version = version;
46 }
47
48 @Override
49 public boolean equals(final Object obj) {
50 if (this == obj) {
51 return true;
52 }
53 if (obj == null) {
54 return false;
55 }
56 if (!(obj instanceof ExtendedClassInfo)) {
57 return false;
58 }
59 final ExtendedClassInfo other = (ExtendedClassInfo) obj;
60 if (this.exact != other.exact) {
61 return false;
62 }
63 if (this.location == null) {
64 if (other.location != null) {
65 return false;
66 }
67 } else if (!this.location.equals(other.location)) {
68 return false;
69 }
70 if (this.version == null) {
71 if (other.version != null) {
72 return false;
73 }
74 } else if (!this.version.equals(other.version)) {
75 return false;
76 }
77 return true;
78 }
79
80 public boolean getExact() {
81 return this.exact;
82 }
83
84 public String getLocation() {
85 return this.location;
86 }
87
88 public String getVersion() {
89 return this.version;
90 }
91
92 @Override
93 public int hashCode() {
94 final int prime = 31;
95 int result = 1;
96 result = prime * result + (this.exact ? 1231 : 1237);
97 result = prime * result + ((this.location == null) ? 0 : this.location.hashCode());
98 result = prime * result + ((this.version == null) ? 0 : this.version.hashCode());
99 return result;
100 }
101
102 @Override
103 public String toString() {
104 final StringBuilder sb = new StringBuilder();
105 if (!this.exact) {
106 sb.append('~');
107 }
108 sb.append('[');
109 sb.append(this.location);
110 sb.append(':');
111 sb.append(this.version);
112 sb.append(']');
113 return sb.toString();
114 }
115
116 }