Record Class ListMessage

java.lang.Object
java.lang.Record
it.auties.whatsapp.model.message.button.ListMessage
All Implemented Interfaces:
it.auties.protobuf.model.ProtobufMessage, it.auties.protobuf.model.ProtobufObject, ButtonMessage, ContextualMessage, Message

public record ListMessage(String title, Optional<String> description, String button, ListMessage.Type listType, List<ButtonSection> sections, Optional<ProductListInfo> productListInfo, Optional<String> footer, Optional<ContextInfo> contextInfo) extends Record implements ContextualMessage, ButtonMessage
A model class that represents a message that contains a list of buttons or a list of products
  • Field Details

    • title

      private final String title
      The field for the title record component.
    • description

      private final Optional<String> description
      The field for the description record component.
    • button

      private final String button
      The field for the button record component.
    • listType

      private final ListMessage.Type listType
      The field for the listType record component.
    • sections

      private final List<ButtonSection> sections
      The field for the sections record component.
    • productListInfo

      private final Optional<ProductListInfo> productListInfo
      The field for the productListInfo record component.
    • contextInfo

      private final Optional<ContextInfo> contextInfo
      The field for the contextInfo record component.
  • Constructor Details

    • ListMessage

      public ListMessage(String title, Optional<String> description, String button, ListMessage.Type listType, List<ButtonSection> sections, Optional<ProductListInfo> productListInfo, Optional<String> footer, Optional<ContextInfo> contextInfo)
      Creates an instance of a ListMessage record class.
      Parameters:
      title - the value for the title record component
      description - the value for the description record component
      button - the value for the button record component
      listType - the value for the listType record component
      sections - the value for the sections record component
      productListInfo - the value for the productListInfo record component
      footer - the value for the footer record component
      contextInfo - the value for the contextInfo record component
  • Method Details

    • type

      public MessageType type()
      Description copied from interface: Message
      Return message type
      Specified by:
      type in interface Message
      Returns:
      a non-null message type
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • title

      public String title()
      Returns the value of the title record component.
      Returns:
      the value of the title record component
    • description

      public Optional<String> description()
      Returns the value of the description record component.
      Returns:
      the value of the description record component
    • button

      public String button()
      Returns the value of the button record component.
      Returns:
      the value of the button record component
    • listType

      public ListMessage.Type listType()
      Returns the value of the listType record component.
      Returns:
      the value of the listType record component
    • sections

      public List<ButtonSection> sections()
      Returns the value of the sections record component.
      Returns:
      the value of the sections record component
    • productListInfo

      public Optional<ProductListInfo> productListInfo()
      Returns the value of the productListInfo record component.
      Returns:
      the value of the productListInfo record component
    • footer

      public Optional<String> footer()
      Returns the value of the footer record component.
      Returns:
      the value of the footer record component
    • contextInfo

      public Optional<ContextInfo> contextInfo()
      Returns the value of the contextInfo record component.
      Specified by:
      contextInfo in interface ContextualMessage
      Returns:
      the value of the contextInfo record component