diff --git a/telegram-domain/telegram-domain-main/src/main/java/dev/struchkov/godfather/telegram/domain/attachment/ButtonClickAttachment.java b/telegram-domain/telegram-domain-main/src/main/java/dev/struchkov/godfather/telegram/domain/attachment/ButtonClickAttachment.java index f66e453..a8e904f 100644 --- a/telegram-domain/telegram-domain-main/src/main/java/dev/struchkov/godfather/telegram/domain/attachment/ButtonClickAttachment.java +++ b/telegram-domain/telegram-domain-main/src/main/java/dev/struchkov/godfather/telegram/domain/attachment/ButtonClickAttachment.java @@ -1,5 +1,6 @@ package dev.struchkov.godfather.telegram.domain.attachment; +import com.fasterxml.jackson.annotation.JsonIgnore; import dev.struchkov.godfather.main.domain.content.Attachment; import lombok.Getter; import lombok.Setter; @@ -21,29 +22,34 @@ public class ButtonClickAttachment extends Attachment { */ private String messageId; private String rawCallBackData; + private Map args = new HashMap<>(); public ButtonClickAttachment() { super(TelegramAttachmentType.BUTTON_CLICK.name()); } + @JsonIgnore public void addClickArg(String type, String value) { isNotNull(type, value); args.put(type, ButtonArg.buttonArg(type, value)); } + @JsonIgnore public Optional getArgByType(String type) { isNotNull(type); return Optional.ofNullable(args.get(type)); } + @JsonIgnore + public Collection getClickArgs() { + return args.values(); + } + + @JsonIgnore public ButtonArg getArgByTypeOrThrow(String type) { isNotNull(type); return Optional.of(args.get(type)).orElseThrow(notFoundException("Аргумент типа {0} не найден.", type)); } - public Collection getClickArgs() { - return args.values(); - } - }