All Downloads are FREE. Search and download functionalities are using the official Maven repository.

it.auties.whatsapp.model.privacy.PrivacySettingEntry Maven / Gradle / Ivy

There is a newer version: 2.7.2
Show newest version
package it.auties.whatsapp.model.privacy;

import it.auties.whatsapp.model.contact.ContactJid;
import lombok.NonNull;

import java.util.List;

/**
 * A model that represents a privacy setting entry
 *
 * @param type the non-null type
 * @param value the non-null value
 * @param excluded the non-null list of excluded contacts if {@link PrivacySettingEntry#value} == {@link PrivacySettingValue#CONTACTS_EXCEPT}
 */
public record PrivacySettingEntry(@NonNull PrivacySettingType type, @NonNull PrivacySettingValue value, List excluded) {
    /**
     * Canonical constructor
     */
    public PrivacySettingEntry(@NonNull PrivacySettingType type, @NonNull PrivacySettingValue value, List excluded) {
        this.type = type;
        this.value = value;
        this.excluded = excluded == null ? List.of() : excluded;
    }

    /**
     * Checks if {@link PrivacySettingEntry#value} == {@link PrivacySettingValue#CONTACTS_EXCEPT}
     *
     * @return a boolean
     */
    private boolean hasExcluded(){
        return value == PrivacySettingValue.CONTACTS_EXCEPT;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy