From 6f4515487872703569786ea18572a4699f7ca5a7 Mon Sep 17 00:00:00 2001 From: Struchkov Mark Date: Sun, 19 Mar 2023 21:54:27 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=BF=D1=80=D0=BE=D1=81=D1=82=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/keyboard/InlineKeyBoard.java | 13 +++++++++---- .../domain/keyboard/button/ContactButton.java | 12 +++++++----- .../domain/keyboard/button/UrlButton.java | 18 ++++++++---------- .../domain/keyboard/button/WebAppButton.java | 18 ++++++++---------- 4 files changed, 32 insertions(+), 29 deletions(-) diff --git a/telegram-domain/telegram-domain-main/src/main/java/dev/struchkov/godfather/telegram/domain/keyboard/InlineKeyBoard.java b/telegram-domain/telegram-domain-main/src/main/java/dev/struchkov/godfather/telegram/domain/keyboard/InlineKeyBoard.java index 2b17924..41b5689 100644 --- a/telegram-domain/telegram-domain-main/src/main/java/dev/struchkov/godfather/telegram/domain/keyboard/InlineKeyBoard.java +++ b/telegram-domain/telegram-domain-main/src/main/java/dev/struchkov/godfather/telegram/domain/keyboard/InlineKeyBoard.java @@ -3,12 +3,18 @@ package dev.struchkov.godfather.telegram.domain.keyboard; import dev.struchkov.godfather.main.domain.keyboard.KeyBoard; import dev.struchkov.godfather.main.domain.keyboard.KeyBoardButton; import dev.struchkov.godfather.main.domain.keyboard.KeyBoardLine; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; import java.util.ArrayList; import java.util.List; import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine; +@Getter +@Setter +@NoArgsConstructor public class InlineKeyBoard implements KeyBoard { public static final String TYPE = "INLINE"; @@ -39,15 +45,13 @@ public class InlineKeyBoard implements KeyBoard { return builder().line(simpleLine(buttons)).build(); } - public List getLines() { - return lines; - } - + @Override public String getType() { return TYPE; } public static final class Builder { + private List lines = new ArrayList<>(); private Builder() { @@ -66,6 +70,7 @@ public class InlineKeyBoard implements KeyBoard { public InlineKeyBoard build() { return new InlineKeyBoard(this); } + } } diff --git a/telegram-domain/telegram-domain-main/src/main/java/dev/struchkov/godfather/telegram/domain/keyboard/button/ContactButton.java b/telegram-domain/telegram-domain-main/src/main/java/dev/struchkov/godfather/telegram/domain/keyboard/button/ContactButton.java index 73d3594..324525c 100644 --- a/telegram-domain/telegram-domain-main/src/main/java/dev/struchkov/godfather/telegram/domain/keyboard/button/ContactButton.java +++ b/telegram-domain/telegram-domain-main/src/main/java/dev/struchkov/godfather/telegram/domain/keyboard/button/ContactButton.java @@ -1,6 +1,9 @@ package dev.struchkov.godfather.telegram.domain.keyboard.button; import dev.struchkov.godfather.main.domain.keyboard.KeyBoardButton; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; import static dev.struchkov.haiti.utils.Inspector.Utils.nullPointer; import static dev.struchkov.haiti.utils.Inspector.isNotNull; @@ -8,11 +11,14 @@ import static dev.struchkov.haiti.utils.Inspector.isNotNull; /** * Запрашивает у пользователя его контактный номер. */ +@Getter +@Setter +@NoArgsConstructor public class ContactButton implements KeyBoardButton { public static final String TYPE = "CONTACT"; - private final String label; + private String label; private ContactButton(String label) { this.label = label; @@ -23,10 +29,6 @@ public class ContactButton implements KeyBoardButton { return new ContactButton(label); } - public String getLabel() { - return label; - } - @Override public String getType() { return TYPE; diff --git a/telegram-domain/telegram-domain-main/src/main/java/dev/struchkov/godfather/telegram/domain/keyboard/button/UrlButton.java b/telegram-domain/telegram-domain-main/src/main/java/dev/struchkov/godfather/telegram/domain/keyboard/button/UrlButton.java index fafdab4..e05c049 100644 --- a/telegram-domain/telegram-domain-main/src/main/java/dev/struchkov/godfather/telegram/domain/keyboard/button/UrlButton.java +++ b/telegram-domain/telegram-domain-main/src/main/java/dev/struchkov/godfather/telegram/domain/keyboard/button/UrlButton.java @@ -1,15 +1,21 @@ package dev.struchkov.godfather.telegram.domain.keyboard.button; import dev.struchkov.godfather.main.domain.keyboard.KeyBoardButton; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; import static dev.struchkov.haiti.utils.Inspector.isNotNull; +@Getter +@Setter +@NoArgsConstructor public class UrlButton implements KeyBoardButton { public static final String TYPE = "URL"; - private final String label; - private final String url; + private String label; + private String url; public UrlButton(String label, String url) { this.label = label; @@ -26,12 +32,4 @@ public class UrlButton implements KeyBoardButton { return TYPE; } - public String getLabel() { - return label; - } - - public String getUrl() { - return url; - } - } diff --git a/telegram-domain/telegram-domain-main/src/main/java/dev/struchkov/godfather/telegram/domain/keyboard/button/WebAppButton.java b/telegram-domain/telegram-domain-main/src/main/java/dev/struchkov/godfather/telegram/domain/keyboard/button/WebAppButton.java index 78e9404..181178c 100644 --- a/telegram-domain/telegram-domain-main/src/main/java/dev/struchkov/godfather/telegram/domain/keyboard/button/WebAppButton.java +++ b/telegram-domain/telegram-domain-main/src/main/java/dev/struchkov/godfather/telegram/domain/keyboard/button/WebAppButton.java @@ -1,15 +1,21 @@ package dev.struchkov.godfather.telegram.domain.keyboard.button; import dev.struchkov.godfather.main.domain.keyboard.KeyBoardButton; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; import static dev.struchkov.haiti.utils.Inspector.isNotNull; +@Getter +@Setter +@NoArgsConstructor public class WebAppButton implements KeyBoardButton { public static final String TYPE = "WEB_APP"; - private final String label; - private final String url; + private String label; + private String url; private WebAppButton(String label, String url) { this.label = label; @@ -21,14 +27,6 @@ public class WebAppButton implements KeyBoardButton { return new WebAppButton(label, url); } - public String getUrl() { - return url; - } - - public String getLabel() { - return label; - } - @Override public String getType() { return TYPE;