1   /*
2    * Logback: the reliable, generic, fast and flexible logging framework.
3    * Copyright (C) 1999-2023, 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.classic.spi;
15  
16  import ch.qos.logback.classic.spi.IThrowableProxy;
17  import ch.qos.logback.classic.spi.StackTraceElementProxy;
18  import com.fasterxml.jackson.annotation.JsonAlias;
19  
20  import java.util.Arrays;
21  
22  /**
23   * Used in tests to represent a ThrowableProxy in a JSON-friendly way.
24   */
25  public class PubThrowableProxy implements IThrowableProxy {
26  
27      private String className;
28      private String message;
29      private int commonFramesCount;
30  
31      @JsonAlias("stepArray")
32      private StackTraceElementProxy[] stackTraceElementProxyArray;
33      private PubThrowableProxy cause;
34      private PubThrowableProxy[] suppressed;
35      private boolean cyclic;
36  
37      public String getClassName() {
38          return className;
39      }
40  
41      public void setClassName(String className) {
42          this.className = className;
43      }
44  
45      public String getMessage() {
46          return message;
47      }
48  
49      public void setMessage(String message) {
50          this.message = message;
51      }
52  
53      public int getCommonFrames() {
54          return commonFramesCount;
55      }
56  
57      public void setCommonFramesCount(int commonFramesCount) {
58          this.commonFramesCount = commonFramesCount;
59      }
60  
61      public StackTraceElementProxy[] getStackTraceElementProxyArray() {
62          return stackTraceElementProxyArray;
63      }
64  
65      public void setStackTraceElementProxyArray(StackTraceElementProxy[] stackTraceElementProxyArray) {
66          this.stackTraceElementProxyArray = stackTraceElementProxyArray;
67      }
68  
69      public PubThrowableProxy getCause() {
70          return cause;
71      }
72  
73      public void setCause(PubThrowableProxy cause) {
74          this.cause = cause;
75      }
76  
77      public PubThrowableProxy[] getSuppressed() {
78          return suppressed;
79      }
80  
81      public void setSuppressed(PubThrowableProxy[] suppressed) {
82          this.suppressed = suppressed;
83      }
84  
85      public boolean isCyclic() {
86          return cyclic;
87      }
88  
89      public void setCyclic(boolean cyclic) {
90          this.cyclic = cyclic;
91      }
92  
93      @Override
94      public String toString() {
95          return "PubThrowableProxy{" + "className='" + className + '\'' + ", message='" + message + '\''
96                  + ", commonFramesCount=" + commonFramesCount + ", stackTraceElementProxyArray=" + Arrays.toString(
97                  stackTraceElementProxyArray) + ", cause=" + cause + ", suppressed=" + Arrays.toString(suppressed)
98                  + ", cyclic=" + cyclic + '}';
99      }
100 }