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

com.hubspot.chrome.devtools.client.core.network.Cookie Maven / Gradle / Ivy

There is a newer version: 94.0.4606.61
Show newest version
package com.hubspot.chrome.devtools.client.core.network;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * Cookie object
 */
public final class Cookie {
  private String name;

  private String value;

  private String domain;

  private String path;

  private Number expires;

  private Integer size;

  private Boolean httpOnly;

  private Boolean secure;

  private Boolean session;

  private CookieSameSite sameSite;

  @JsonCreator
  public Cookie(@JsonProperty("name") String name, @JsonProperty("value") String value,
      @JsonProperty("domain") String domain, @JsonProperty("path") String path,
      @JsonProperty("expires") Number expires, @JsonProperty("size") Integer size,
      @JsonProperty("httpOnly") Boolean httpOnly, @JsonProperty("secure") Boolean secure,
      @JsonProperty("session") Boolean session, @JsonProperty("sameSite") CookieSameSite sameSite) {
    this.name = name;
    this.value = value;
    this.domain = domain;
    this.path = path;
    this.expires = expires;
    this.size = size;
    this.httpOnly = httpOnly;
    this.secure = secure;
    this.session = session;
    this.sameSite = sameSite;
  }

  public String getName() {
    return name;
  }

  public String getValue() {
    return value;
  }

  public String getDomain() {
    return domain;
  }

  public String getPath() {
    return path;
  }

  public Number getExpires() {
    return expires;
  }

  public Integer getSize() {
    return size;
  }

  public Boolean getHttpOnly() {
    return httpOnly;
  }

  public Boolean getSecure() {
    return secure;
  }

  public Boolean getSession() {
    return session;
  }

  public CookieSameSite getSameSite() {
    return sameSite;
  }

  public static Cookie.Builder builder() {
    return new Cookie.Builder();
  }

  public static final class Builder {
    private String name;

    private String value;

    private String domain;

    private String path;

    private Number expires;

    private Integer size;

    private Boolean httpOnly;

    private Boolean secure;

    private Boolean session;

    private CookieSameSite sameSite;

    private Builder() {
    }

    public Cookie.Builder setName(String name) {
      this.name = name;
      return this;
    }

    public Cookie.Builder setValue(String value) {
      this.value = value;
      return this;
    }

    public Cookie.Builder setDomain(String domain) {
      this.domain = domain;
      return this;
    }

    public Cookie.Builder setPath(String path) {
      this.path = path;
      return this;
    }

    public Cookie.Builder setExpires(Number expires) {
      this.expires = expires;
      return this;
    }

    public Cookie.Builder setSize(Integer size) {
      this.size = size;
      return this;
    }

    public Cookie.Builder setHttpOnly(Boolean httpOnly) {
      this.httpOnly = httpOnly;
      return this;
    }

    public Cookie.Builder setSecure(Boolean secure) {
      this.secure = secure;
      return this;
    }

    public Cookie.Builder setSession(Boolean session) {
      this.session = session;
      return this;
    }

    public Cookie.Builder setSameSite(CookieSameSite sameSite) {
      this.sameSite = sameSite;
      return this;
    }

    public Cookie build() {
      return new Cookie(name, value, domain, path, expires, size, httpOnly, secure, session, sameSite);
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy