it.auties.whatsapp.model.signal.session.SessionChain Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of whatsappweb4j Show documentation
Show all versions of whatsappweb4j Show documentation
Standalone fully-featured Whatsapp Web API for Java and Kotlin
The newest version!
package it.auties.whatsapp.model.signal.session;
import lombok.Builder;
import lombok.NonNull;
import lombok.extern.jackson.Jacksonized;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
@Builder
@Jacksonized
public record SessionChain(AtomicInteger counter, AtomicReference key,
ConcurrentHashMap messageKeys) {
public SessionChain(int counter, byte @NonNull [] key) {
this(new AtomicInteger(counter), new AtomicReference<>(key), new ConcurrentHashMap<>());
}
public boolean hasMessageKey(int counter) {
return messageKeys.containsKey(counter);
}
}