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      public LoggerContextVO(LoggerContext lc) {
45          this.name = lc.getName();
46          this.propertyMap = lc.getCopyOfPropertyMap();
47          this.birthTime = lc.getBirthTime();
48      }
49  
50      public LoggerContextVO(String name, Map<String, String> propertyMap, long birthTime) {
51          this.name = name;
52          this.propertyMap = propertyMap;
53          this.birthTime = birthTime;
54      }
55  
56      public String getName() {
57          return name;
58      }
59  
60      public Map<String, String> getPropertyMap() {
61          return propertyMap;
62      }
63  
64      public long getBirthTime() {
65          return birthTime;
66      }
67  
68      @Override
69      public String toString() {
70          return "LoggerContextVO{" + "name='" + name + '\'' + ", propertyMap=" + propertyMap + ", birthTime=" + birthTime
71                  + '}';
72      }
73  
74      @Override
75      public boolean equals(Object o) {
76          if (this == o)
77              return true;
78          if (!(o instanceof LoggerContextVO))
79              return false;
80  
81          LoggerContextVO that = (LoggerContextVO) o;
82  
83          if (birthTime != that.birthTime)
84              return false;
85          if (name != null ? !name.equals(that.name) : that.name != null)
86              return false;
87          if (propertyMap != null ? !propertyMap.equals(that.propertyMap) : that.propertyMap != null)
88              return false;
89  
90          return true;
91      }
92  
93      @Override
94      public int hashCode() {
95          int result = name != null ? name.hashCode() : 0;
96          result = 31 * result + (propertyMap != null ? propertyMap.hashCode() : 0);
97          result = 31 * result + (int) (birthTime ^ (birthTime >>> 32));
98  
99          return result;
100     }
101 }