forked from mtusi2026/mtusi2026lab3
init commit
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package ru.mtusi.messenger.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import org.hibernate.validator.constraints.CodePointLength;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Schema(name = "CreateMessage")
|
||||
public class CreateMessageDTO {
|
||||
|
||||
private String text;
|
||||
|
||||
public CreateMessageDTO() {}
|
||||
|
||||
public CreateMessageDTO text(String text) {
|
||||
this.text = text;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@CodePointLength(min = 1, max = 4000)
|
||||
@Schema(name = "text", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("text")
|
||||
public String getText() { return text; }
|
||||
|
||||
public void setText(String text) { this.text = text; }
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof CreateMessageDTO d)) return false;
|
||||
return Objects.equals(text, d.text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() { return Objects.hash(text); }
|
||||
}
|
||||
Reference in New Issue
Block a user