Record Class ChatMute

java.lang.Object
java.lang.Record
it.auties.whatsapp.model.chat.ChatMute
Record Components:
endTimeStamp - the end date of the mute associated with this object stored as second since Instant.EPOCH
All Implemented Interfaces:
it.auties.protobuf.api.model.ProtobufMessage

public record ChatMute(long endTimeStamp) extends Record implements it.auties.protobuf.api.model.ProtobufMessage
An immutable model class that represents a mute
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    The constants of this enumerated type describe the various types of mute a ChatMute can describe
  • Constructor Summary

    Constructors
    Constructor
    Description
    ChatMute(long endTimeStamp)
    Creates an instance of a ChatMute record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    end()
    Returns the date when this mute expires if the chat is muted and not indefinitely
    long
    Returns the value of the endTimeStamp record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    Returns whether the chat associated with this object is muted or not.
    static ChatMute
    Constructs a new muted ChatMute
    static ChatMute
    muted(Long seconds)
    Constructs a new mute for a duration in endTimeStamp
    static ChatMute
    Constructs a new mute that lasts eight hours
    static ChatMute
    Constructs a new mute that lasts one week
    static ChatMute
    Constructs a new not muted ChatMute
    final String
    Returns a string representation of this record class.
    Returns a non-null enum that describes the type of mute for this object
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ChatMute

      public ChatMute(long endTimeStamp)
      Creates an instance of a ChatMute record class.
      Parameters:
      endTimeStamp - the value for the endTimeStamp record component
  • Method Details

    • notMuted

      public static ChatMute notMuted()
      Constructs a new not muted ChatMute
      Returns:
      a non-null mute
    • muted

      public static ChatMute muted()
      Constructs a new muted ChatMute
      Returns:
      a non-null mute
    • mutedForEightHours

      public static ChatMute mutedForEightHours()
      Constructs a new mute that lasts eight hours
      Returns:
      a non-null mute
    • mutedForOneWeek

      public static ChatMute mutedForOneWeek()
      Constructs a new mute that lasts one week
      Returns:
      a non-null mute
    • muted

      public static ChatMute muted(Long seconds)
      Constructs a new mute for a duration in endTimeStamp
      Parameters:
      seconds - can be null and is considered as not muted
      Returns:
      a non-null mute
    • isMuted

      public boolean isMuted()
      Returns whether the chat associated with this object is muted or not.
      Returns:
      true if the chat associated with this object is muted
    • type

      public ChatMute.Type type()
      Returns a non-null enum that describes the type of mute for this object
      Returns:
      a non-null enum that describes the type of mute for this object
    • end

      public Optional<ZonedDateTime> end()
      Returns the date when this mute expires if the chat is muted and not indefinitely
      Returns:
      a non-empty optional date if endTimeStamp > 0
    • value

      public Long value()
      Specified by:
      value in interface it.auties.protobuf.api.model.ProtobufMessage
    • 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 '=='.
      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.
    • endTimeStamp

      public long endTimeStamp()
      Returns the value of the endTimeStamp record component.
      Returns:
      the value of the endTimeStamp record component