Record Class ContactCard.Parsed

java.lang.Object
java.lang.Record
it.auties.whatsapp.model.contact.ContactCard.Parsed
All Implemented Interfaces:
ContactCard
Enclosing interface:
ContactCard

public static record ContactCard.Parsed(Optional<String> version, Optional<String> name, Map<String,List<Jid>> phoneNumbers, Optional<String> businessName) extends Record implements ContactCard
A parsed representation of the vcard
  • Field Details

    • version

      private final Optional<String> version
      The field for the version record component.
    • name

      private final Optional<String> name
      The field for the name record component.
    • phoneNumbers

      private final Map<String,List<Jid>> phoneNumbers
      The field for the phoneNumbers record component.
    • businessName

      private final Optional<String> businessName
      The field for the businessName record component.
  • Constructor Details

    • Parsed

      public Parsed(Optional<String> version, Optional<String> name, Map<String,List<Jid>> phoneNumbers, Optional<String> businessName)
      Creates an instance of a Parsed record class.
      Parameters:
      version - the value for the version record component
      name - the value for the name record component
      phoneNumbers - the value for the phoneNumbers record component
      businessName - the value for the businessName record component
  • Method Details

    • getPhoneNumber

      public List<Jid> getPhoneNumber(Jid contact)
    • addPhoneNumber

      private void addPhoneNumber(ezvcard.VCard vcard, String type, Jid contact)
    • addPhoneNumber

      public void addPhoneNumber(Jid contact)
    • addPhoneNumber

      public void addPhoneNumber(String category, Jid contact)
    • toVcard

      public String toVcard()
      Converts this object in a valid vcard
      Specified by:
      toVcard in interface ContactCard
      Returns:
      a non-null String
    • 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.
    • version

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

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

      public Map<String,List<Jid>> phoneNumbers()
      Returns the value of the phoneNumbers record component.
      Returns:
      the value of the phoneNumbers record component
    • businessName

      public Optional<String> businessName()
      Returns the value of the businessName record component.
      Returns:
      the value of the businessName record component