001// *************************************************************************************************************************** 002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * 003// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * 004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * 005// * with the License. You may obtain a copy of the License at * 006// * * 007// * http://www.apache.org/licenses/LICENSE-2.0 * 008// * * 009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * 010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * 011// * specific language governing permissions and limitations under the License. * 012// *************************************************************************************************************************** 013package org.apache.juneau.mstat; 014 015import java.util.*; 016 017import org.apache.juneau.annotation.*; 018 019/** 020 * Stores information about an exception. 021 */ 022@Bean(bpi="hash,exceptionClass,message,stackTrace,causedBy", fluentSetters=true) 023public class ExceptionInfo implements Cloneable { 024 025 private String hash; 026 private String exceptionClass; 027 private String message; 028 private List<StackTraceElement> stackTrace; 029 private ExceptionInfo causedBy; 030 031 /** 032 * TODO 033 * 034 * @return TODO 035 */ 036 public static ExceptionInfo create() { 037 return new ExceptionInfo(); 038 } 039 040 /** 041 * Returns an 8-byte hash of the stack trace. 042 * 043 * @return An 8-byte hash of the stack trace. 044 */ 045 public String getHash() { 046 return hash; 047 } 048 049 /** 050 * TODO 051 * 052 * @param value TODO 053 * @return This object (for method chaining). 054 */ 055 public ExceptionInfo hash(String value) { 056 this.hash = value; 057 return this; 058 } 059 060 /** 061 * Returns the simple class name of the exception. 062 * 063 * @return The simple class name of the exception, or <jk>null</jk> if not specified. 064 */ 065 public String getExceptionClass() { 066 return exceptionClass; 067 } 068 069 /** 070 * TODO 071 * 072 * @param value TODO 073 * @return This object (for method chaining). 074 */ 075 public ExceptionInfo exceptionClass(String value) { 076 this.exceptionClass = value; 077 return this; 078 } 079 080 /** 081 * TODO 082 * 083 * @return TODO 084 */ 085 public String getMessage() { 086 return message; 087 } 088 089 /** 090 * TODO 091 * 092 * @param value TODO 093 * @return This object (for method chaining). 094 */ 095 public ExceptionInfo message(String value) { 096 this.message = value; 097 return this; 098 } 099 100 101 /** 102 * TODO 103 * 104 * @return TODO 105 */ 106 public List<StackTraceElement> getStackTrace() { 107 return stackTrace; 108 } 109 110 /** 111 * TODO 112 * 113 * @param value TODO 114 * @return This object (for method chaining). 115 */ 116 public ExceptionInfo stackTrace(List<StackTraceElement> value) { 117 this.stackTrace = value; 118 return this; 119 } 120 121 122 /** 123 * TODO 124 * 125 * @return TODO 126 */ 127 public ExceptionInfo getCausedBy() { 128 return causedBy; 129 } 130 131 /** 132 * TODO 133 * 134 * @param value TODO 135 * @return This object (for method chaining). 136 */ 137 public ExceptionInfo causedBy(ExceptionInfo value) { 138 this.causedBy = value; 139 return this; 140 } 141}