View Javadoc
1   /**
2    * Logback: the reliable, generic, fast and flexible logging framework.
3    * Copyright (C) 1999-2022, 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.core.model;
15  
16  import java.util.Objects;
17  
18  public class TimestampModel extends NamedModel {
19  
20      private static final long serialVersionUID = 2096655273673863306L;
21  
22      public static final String CONTEXT_BIRTH = "contextBirth";
23  
24      String datePattern;
25      String timeReference;
26      String scopeStr;
27  
28      @Override
29      protected TimestampModel makeNewInstance() {
30          return new TimestampModel();
31      }
32      
33      @Override
34      protected void mirror(Model that) {
35          TimestampModel actual = (TimestampModel) that;
36          super.mirror(actual);
37          this.datePattern = actual.datePattern;
38          this.timeReference = actual.timeReference;
39          this.scopeStr = actual.scopeStr;
40      }
41      
42      public String getKey() {
43          return getName();
44      }
45  
46      public void setKey(String key) {
47          this.setName(key);
48      }
49  
50      public String getDatePattern() {
51          return datePattern;
52      }
53  
54      public void setDatePattern(String datePattern) {
55          this.datePattern = datePattern;
56      }
57  
58      public String getTimeReference() {
59          return timeReference;
60      }
61  
62      public void setTimeReference(String timeReference) {
63          this.timeReference = timeReference;
64      }
65  
66      public String getScopeStr() {
67          return scopeStr;
68      }
69  
70      public void setScopeStr(String scopeStr) {
71          this.scopeStr = scopeStr;
72      }
73  
74      @Override
75      public int hashCode() {
76          final int prime = 31;
77          int result = super.hashCode();
78          result = prime * result + Objects.hash(datePattern, scopeStr, timeReference);
79          return result;
80      }
81  
82      @Override
83      public boolean equals(Object obj) {
84          if (this == obj)
85              return true;
86          if (!super.equals(obj))
87              return false;
88          if (getClass() != obj.getClass())
89              return false;
90          TimestampModel other = (TimestampModel) obj;
91          return Objects.equals(datePattern, other.datePattern) && Objects.equals(scopeStr, other.scopeStr)
92                  && Objects.equals(timeReference, other.timeReference);
93      }
94  
95      
96  }