forked from mtusi2026/mtusi2026lab2
87 lines
1.9 KiB
Java
87 lines
1.9 KiB
Java
package ru.mtusi.messenger.dto;
|
|
|
|
import java.util.Objects;
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
import ru.mtusi.messenger.dto.ErrorErrorDTO;
|
|
import jakarta.validation.Valid;
|
|
import jakarta.validation.constraints.*;
|
|
import io.swagger.v3.oas.annotations.media.Schema;
|
|
|
|
import java.util.*;
|
|
|
|
/**
|
|
* ErrorDTO
|
|
*/
|
|
|
|
public class ErrorDTO {
|
|
|
|
private ErrorErrorDTO error;
|
|
|
|
public ErrorDTO() {
|
|
super();
|
|
}
|
|
|
|
/**
|
|
* Constructor with only required parameters
|
|
*/
|
|
public ErrorDTO(ErrorErrorDTO error) {
|
|
this.error = error;
|
|
}
|
|
|
|
public ErrorDTO error(ErrorErrorDTO error) {
|
|
this.error = error;
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* Get error
|
|
* @return error
|
|
*/
|
|
@NotNull @Valid
|
|
@Schema(name = "error", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
@JsonProperty("error")
|
|
public ErrorErrorDTO getError() {
|
|
return error;
|
|
}
|
|
|
|
public void setError(ErrorErrorDTO error) {
|
|
this.error = error;
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object o) {
|
|
if (this == o) {
|
|
return true;
|
|
}
|
|
if (o == null || getClass() != o.getClass()) {
|
|
return false;
|
|
}
|
|
ErrorDTO errorDTO = (ErrorDTO) o;
|
|
return Objects.equals(this.error, errorDTO.error);
|
|
}
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
return Objects.hash(error);
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("class ErrorDTO {\n");
|
|
sb.append(" error: ").append(toIndentedString(error)).append("\n");
|
|
sb.append("}");
|
|
return sb.toString();
|
|
}
|
|
|
|
/**
|
|
* Convert the given object to string with each line indented by 4 spaces
|
|
* (except the first line).
|
|
*/
|
|
private String toIndentedString(Object o) {
|
|
if (o == null) {
|
|
return "null";
|
|
}
|
|
return o.toString().replace("\n", "\n ");
|
|
}
|
|
} |