View Javadoc
1   /*
2   * Copyright 2018-2026 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.bremersee.exception.model;
18  
19  import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
20  import com.fasterxml.jackson.annotation.JsonInclude;
21  import com.fasterxml.jackson.annotation.JsonInclude.Include;
22  import com.fasterxml.jackson.annotation.JsonProperty;
23  //import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
24  //import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
25  import io.swagger.v3.oas.annotations.media.Schema;
26  import java.io.Serial;
27  import java.io.Serializable;
28  import java.util.List;
29  import lombok.Builder;
30  import lombok.EqualsAndHashCode;
31  import lombok.Getter;
32  import lombok.NoArgsConstructor;
33  import lombok.Setter;
34  import lombok.ToString;
35  import tools.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
36  import tools.jackson.dataformat.xml.annotation.JacksonXmlProperty;
37  
38  /**
39   * The handler where the exception occurred.
40   *
41   * @author Christian Bremer
42   */
43  @Schema(description = "The handler where the exception occurred.")
44  @JsonIgnoreProperties(ignoreUnknown = true)
45  @JsonInclude(Include.NON_EMPTY)
46  @EqualsAndHashCode
47  @ToString
48  @Getter
49  @Setter
50  @NoArgsConstructor
51  public class Handler implements Serializable {
52  
53    @Serial
54    private static final long serialVersionUID = 1L;
55  
56    /**
57     * The class name of the handler.
58     */
59    @Schema(description = "The class name of the handler.")
60    private String className;
61  
62    /**
63     * The method name of the handler.
64     */
65    @Schema(description = "The method name of the handler.")
66    private String methodName;
67  
68    /**
69     * The method parameters.
70     */
71    @JsonProperty("methodParameterTypes")
72    @JacksonXmlElementWrapper(localName = "methodParameterTypes")
73    @JacksonXmlProperty(localName = "methodParameterType")
74    @Schema(description = "The method parameters.")
75    private List<String> methodParameterTypes;
76  
77    /**
78     * Instantiates a new handler.
79     *
80     * @param className the class name
81     * @param methodName the method name
82     * @param methodParameterTypes the method parameter types
83     */
84    @Builder(toBuilder = true)
85    protected Handler(
86        String className,
87        String methodName,
88        List<String> methodParameterTypes) {
89      this.className = className;
90      this.methodName = methodName;
91      this.methodParameterTypes = methodParameterTypes;
92    }
93  
94  }
95