Новая логика создания юнитов - МегаБилдер

Новая логика валидации данных от пользователя
Продолжаю внедрять ломбок
This commit is contained in:
Mark Struchkov 2019-07-12 17:15:14 +03:00
parent ad9a47d837
commit c3997008a5

View File

@ -1,7 +1,9 @@
package org.sadtech.social.core.domain; package org.sadtech.social.core.domain;
import lombok.Builder;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.Getter; import lombok.Getter;
import lombok.Setter;
import lombok.ToString; import lombok.ToString;
import org.sadtech.social.core.domain.content.attachment.GeoCoordinate; import org.sadtech.social.core.domain.content.attachment.GeoCoordinate;
import org.sadtech.social.core.domain.keyboard.KeyBoard; import org.sadtech.social.core.domain.keyboard.KeyBoard;
@ -15,13 +17,15 @@ import org.sadtech.social.core.utils.Description;
@EqualsAndHashCode @EqualsAndHashCode
@ToString @ToString
@Getter @Getter
@Builder(toBuilder = true)
public class BoxAnswer { public class BoxAnswer {
@Setter
@Description("Обычное текстовое сообщение") @Description("Обычное текстовое сообщение")
private String message; private String message;
@Description("Клавиатура - меню") @Description("Клавиатура - меню")
private KeyBoard keyboard; private KeyBoard keyBoard;
@Description("Географические координаты") @Description("Географические координаты")
private GeoCoordinate coordinates; private GeoCoordinate coordinates;
@ -29,59 +33,4 @@ public class BoxAnswer {
@Description("Идентификатор стикера") @Description("Идентификатор стикера")
private Integer stickerId; private Integer stickerId;
private BoxAnswer() {
}
private BoxAnswer(BoxAnswer target) {
if (target != null) {
this.message = target.getMessage();
this.keyboard = target.getKeyboard();
this.coordinates = target.getCoordinates();
this.stickerId = target.getStickerId();
}
}
public void setMessage(String message) {
this.message = message;
}
public BoxAnswer prototype() {
return new BoxAnswer(this);
}
public static Builder builder() {
return new BoxAnswer().new Builder();
}
public class Builder {
private Builder() {
}
public Builder message(String message) {
BoxAnswer.this.message = message;
return this;
}
public Builder keyBoard(KeyBoard keyBoard) {
BoxAnswer.this.keyboard = keyBoard;
return this;
}
public Builder coordinate(Float lat, Float aLong) {
BoxAnswer.this.coordinates = new GeoCoordinate(lat, aLong);
return this;
}
public Builder steckerId(Integer stickerId) {
BoxAnswer.this.stickerId = stickerId;
return this;
}
public BoxAnswer build() {
return BoxAnswer.this;
}
}
} }