1
2
3
4
5
6
7
8
9
10
11
12
13
14 package ch.qos.logback.classic.spi;
15
16 import java.io.Serializable;
17
18 public class StackTraceElementProxy implements Serializable {
19
20 private static final long serialVersionUID = -2374374378980555982L;
21
22 final StackTraceElement ste;
23
24
25 transient private String steAsString;
26
27 @Deprecated
28 ClassPackagingData classPackagingData;
29
30 public StackTraceElementProxy(StackTraceElement ste) {
31 if (ste == null) {
32 throw new IllegalArgumentException("ste cannot be null");
33 }
34 this.ste = ste;
35 }
36
37 public String getSTEAsString() {
38 if (steAsString == null) {
39 steAsString = "at " + ste.toString();
40 }
41 return steAsString;
42 }
43
44 public StackTraceElement getStackTraceElement() {
45 return ste;
46 }
47
48 public void setClassPackagingData(ClassPackagingData cpd) {
49 if (this.classPackagingData != null) {
50 throw new IllegalStateException("Packaging data has been already set");
51 }
52 this.classPackagingData = cpd;
53 }
54
55 public ClassPackagingData getClassPackagingData() {
56 return classPackagingData;
57 }
58
59 @Override
60 public int hashCode() {
61 return ste.hashCode();
62 }
63
64 @Override
65 public boolean equals(Object obj) {
66 if (this == obj)
67 return true;
68 if (obj == null)
69 return false;
70 if (getClass() != obj.getClass())
71 return false;
72 final StackTraceElementProxy other = (StackTraceElementProxy) obj;
73
74 if (!ste.equals(other.ste)) {
75 return false;
76 }
77 if (classPackagingData == null) {
78 if (other.classPackagingData != null) {
79 return false;
80 }
81 } else if (!classPackagingData.equals(other.classPackagingData)) {
82 return false;
83 }
84 return true;
85 }
86
87 @Override
88 public String toString() {
89 return getSTEAsString();
90 }
91 }