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

public record ChatMute(long endTimeStamp) extends Record
An immutable model class that represents a mute
  • Field Details

    • endTimeStamp

      private final long endTimeStamp
      The field for the endTimeStamp record component.
    • NOT_MUTED_FLAG

      private static final long NOT_MUTED_FLAG
      Not muted flag
      See Also:
    • MUTED_INDEFINITELY_FLAG

      private static final long MUTED_INDEFINITELY_FLAG
      Muted flag
      See Also:
    • NOT_MUTED

      private static final ChatMute NOT_MUTED
      Not muted constant
    • MUTED_INDEFINITELY

      private static final ChatMute MUTED_INDEFINITELY
      Muted constant
  • 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
    • ofProtobuf

      public static ChatMute ofProtobuf(long object)
      Do not use this method, reserved for protobuf
    • 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
    • mutedForOneWeek

      public static ChatMute mutedForOneWeek()
      Constructs a new mute that lasts one week
      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
    • endTimeStamp

      public long endTimeStamp()
      Returns the value of the endTimeStamp record component.
      Returns:
      the value of the endTimeStamp record component
    • 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.