com.relogiclabs.json.schema.exception.CommonException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of relogiclabs-json-schema Show documentation
Show all versions of relogiclabs-json-schema Show documentation
The New JSON Schema prioritizes simplicity, conciseness, and readability, making
it user-friendly and accessible without the need for extensive prior knowledge.
It offers efficient read-write facilities, precise JSON document definition
through various data types and functions, and extensibility to meet modern web
service diverse requirements.
package com.relogiclabs.json.schema.exception;
import com.relogiclabs.json.schema.message.ErrorDetail;
import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
public class CommonException extends RuntimeException {
@Getter private final String code;
private Map attributes;
public CommonException(String code, String message, Throwable cause) {
super(message, cause);
this.code = code;
}
public CommonException(String code, String message) {
this(code, message, null);
}
public CommonException(ErrorDetail detail, Throwable cause) {
this(detail.getCode(), detail.getMessage(), cause);
}
public CommonException(ErrorDetail detail) {
this(detail, null);
}
public String getAttribute(String name) {
if(attributes == null) return null;
return attributes.get(name);
}
public void setAttribute(String name, String value) {
if(attributes == null) attributes = new HashMap<>(5);
attributes.put(name, value);
}
}