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

org.openqa.selenium.devtools.v90.network.model.BlockedCookieWithReason Maven / Gradle / Ivy

package org.openqa.selenium.devtools.v90.network.model;

import org.openqa.selenium.Beta;
import org.openqa.selenium.json.JsonInput;

/**
 * A cookie with was not sent with a request with the corresponding reason.
 */
@org.openqa.selenium.Beta()
public class BlockedCookieWithReason {

    private final java.util.List blockedReasons;

    private final org.openqa.selenium.devtools.v90.network.model.Cookie cookie;

    public BlockedCookieWithReason(java.util.List blockedReasons, org.openqa.selenium.devtools.v90.network.model.Cookie cookie) {
        this.blockedReasons = java.util.Objects.requireNonNull(blockedReasons, "blockedReasons is required");
        this.cookie = java.util.Objects.requireNonNull(cookie, "cookie is required");
    }

    /**
     * The reason(s) the cookie was blocked.
     */
    public java.util.List getBlockedReasons() {
        return blockedReasons;
    }

    /**
     * The cookie object representing the cookie which was not sent.
     */
    public org.openqa.selenium.devtools.v90.network.model.Cookie getCookie() {
        return cookie;
    }

    private static BlockedCookieWithReason fromJson(JsonInput input) {
        java.util.List blockedReasons = null;
        org.openqa.selenium.devtools.v90.network.model.Cookie cookie = null;
        input.beginObject();
        while (input.hasNext()) {
            switch(input.nextName()) {
                case "blockedReasons":
                    blockedReasons = input.read(new com.google.common.reflect.TypeToken>() {
                    }.getType());
                    break;
                case "cookie":
                    cookie = input.read(org.openqa.selenium.devtools.v90.network.model.Cookie.class);
                    break;
                default:
                    input.skipValue();
                    break;
            }
        }
        input.endObject();
        return new BlockedCookieWithReason(blockedReasons, cookie);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy