Record Class Button

java.lang.Object
java.lang.Record
it.auties.whatsapp.model.button.base.Button
All Implemented Interfaces:
it.auties.protobuf.model.ProtobufMessage, it.auties.protobuf.model.ProtobufObject

public record Button(String id, Optional<ButtonText> bodyText, Optional<NativeFlowInfo> bodyNativeFlow, ButtonBody.Type bodyType) extends Record implements it.auties.protobuf.model.ProtobufMessage
A model class that represents a button
  • Field Details

    • id

      private final String id
      The field for the id record component.
    • bodyText

      private final Optional<ButtonText> bodyText
      The field for the bodyText record component.
    • bodyNativeFlow

      private final Optional<NativeFlowInfo> bodyNativeFlow
      The field for the bodyNativeFlow record component.
    • bodyType

      private final ButtonBody.Type bodyType
      The field for the bodyType record component.
  • Constructor Details

    • Button

      public Button(String id, Optional<ButtonText> bodyText, Optional<NativeFlowInfo> bodyNativeFlow, ButtonBody.Type bodyType)
      Creates an instance of a Button record class.
      Parameters:
      id - the value for the id record component
      bodyText - the value for the bodyText record component
      bodyNativeFlow - the value for the bodyNativeFlow record component
      bodyType - the value for the bodyType record component
  • Method Details

    • of

      public static Button of(ButtonBody body)
      Constructs a new button
      Parameters:
      body - the body of this button
      Returns:
      a non-null button
    • of

      public static Button of(String id, ButtonBody body)
      Constructs a new button
      Parameters:
      id - the non-null id of the button
      body - the body of this button
      Returns:
      a non-null button
    • body

      public Optional<? extends ButtonBody> body()
      Returns the body of this button
      Returns:
      an optional
    • 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.
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • bodyText

      public Optional<ButtonText> bodyText()
      Returns the value of the bodyText record component.
      Returns:
      the value of the bodyText record component
    • bodyNativeFlow

      public Optional<NativeFlowInfo> bodyNativeFlow()
      Returns the value of the bodyNativeFlow record component.
      Returns:
      the value of the bodyNativeFlow record component
    • bodyType

      public ButtonBody.Type bodyType()
      Returns the value of the bodyType record component.
      Returns:
      the value of the bodyType record component