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 sinceInstant.EPOCH
An immutable model class that represents a mute
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe constants of this enumerated type describe the various types of mute aChatMutecan describe -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final longThe field for theendTimeStamprecord component.private static final ChatMuteMuted constantprivate static final longMuted flagprivate static final ChatMuteNot muted constantprivate static final longNot muted flag -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionend()Returns the date when this mute expires if the chat is muted and not indefinitelylongReturns the value of theendTimeStamprecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisMuted()Returns whether the chat associated with this object is muted or not.static ChatMutemuted()Constructs a new muted ChatMutestatic ChatMuteConstructs a new mute for a duration in endTimeStampstatic ChatMuteConstructs a new mute that lasts eight hoursstatic ChatMuteConstructs a new mute that lasts one weekstatic ChatMutenotMuted()Constructs a new not muted ChatMutestatic ChatMuteofProtobuf(long object) Do not use this method, reserved for protobuffinal StringtoString()Returns a string representation of this record class.type()Returns a non-null enum that describes the type of mute for this object
-
Field Details
-
endTimeStamp
private final long endTimeStampThe field for theendTimeStamprecord component. -
NOT_MUTED_FLAG
private static final long NOT_MUTED_FLAGNot muted flag- See Also:
-
MUTED_INDEFINITELY_FLAG
private static final long MUTED_INDEFINITELY_FLAGMuted flag- See Also:
-
NOT_MUTED
Not muted constant -
MUTED_INDEFINITELY
Muted constant
-
-
Constructor Details
-
ChatMute
public ChatMute(long endTimeStamp) Creates an instance of aChatMuterecord class.- Parameters:
endTimeStamp- the value for theendTimeStamprecord component
-
-
Method Details
-
notMuted
Constructs a new not muted ChatMute- Returns:
- a non-null mute
-
muted
Constructs a new muted ChatMute- Returns:
- a non-null mute
-
mutedForEightHours
Constructs a new mute that lasts eight hours- Returns:
- a non-null mute
-
ofProtobuf
Do not use this method, reserved for protobuf -
muted
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
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
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
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 theendTimeStamprecord component.- Returns:
- the value of the
endTimeStamprecord component
-
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. -
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. -
equals
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 '=='.
-