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 import java.util.Map;
18
19 import ch.qos.logback.classic.LoggerContext;
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 public class LoggerContextVO implements Serializable {
37
38 private static final long serialVersionUID = 5488023392483144387L;
39
40 protected String name;
41 protected Map<String, String> propertyMap;
42 protected long birthTime;
43
44
45
46
47
48
49 public LoggerContextVO() {}
50
51 public LoggerContextVO(LoggerContext lc) {
52 this.name = lc.getName();
53 this.propertyMap = lc.getCopyOfPropertyMap();
54 this.birthTime = lc.getBirthTime();
55 }
56
57 public LoggerContextVO(String name, Map<String, String> propertyMap, long birthTime) {
58 this.name = name;
59 this.propertyMap = propertyMap;
60 this.birthTime = birthTime;
61 }
62
63 public String getName() {
64 return name;
65 }
66
67 public Map<String, String> getPropertyMap() {
68 return propertyMap;
69 }
70
71 public long getBirthTime() {
72 return birthTime;
73 }
74
75 @Override
76 public String toString() {
77 return "LoggerContextVO{" + "name='" + name + '\'' + ", propertyMap=" + propertyMap + ", birthTime=" + birthTime
78 + '}';
79 }
80
81 @Override
82 public boolean equals(Object o) {
83 if (this == o)
84 return true;
85 if (!(o instanceof LoggerContextVO))
86 return false;
87
88 LoggerContextVO that = (LoggerContextVO) o;
89
90 if (birthTime != that.birthTime)
91 return false;
92 if (name != null ? !name.equals(that.name) : that.name != null)
93 return false;
94 if (propertyMap != null ? !propertyMap.equals(that.propertyMap) : that.propertyMap != null)
95 return false;
96
97 return true;
98 }
99
100 @Override
101 public int hashCode() {
102 int result = name != null ? name.hashCode() : 0;
103 result = 31 * result + (propertyMap != null ? propertyMap.hashCode() : 0);
104 result = 31 * result + (int) (birthTime ^ (birthTime >>> 32));
105
106 return result;
107 }
108 }