com.hubspot.chrome.devtools.base.ChromeSessionInfo Maven / Gradle / Ivy
package com.hubspot.chrome.devtools.base;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import javax.annotation.Generated;
/**
* Immutable implementation of {@link ChromeSessionInfoIF}.
*
* Use the builder to create immutable instances:
* {@code ChromeSessionInfo.builder()}.
*/
@SuppressWarnings({"all"})
@Generated({"Immutables.generator", "ChromeSessionInfoIF"})
public final class ChromeSessionInfo implements ChromeSessionInfoIF {
private final String description;
private final String devtoolsFrontendUrl;
private final String id;
private final String title;
private final String type;
private final String url;
private final String webSocketDebuggerUrl;
private ChromeSessionInfo(
String description,
String devtoolsFrontendUrl,
String id,
String title,
String type,
String url,
String webSocketDebuggerUrl) {
this.description = description;
this.devtoolsFrontendUrl = devtoolsFrontendUrl;
this.id = id;
this.title = title;
this.type = type;
this.url = url;
this.webSocketDebuggerUrl = webSocketDebuggerUrl;
}
/**
* @return The value of the {@code description} attribute
*/
@JsonProperty("description")
@Override
public String getDescription() {
return description;
}
/**
* @return The value of the {@code devtoolsFrontendUrl} attribute
*/
@JsonProperty("devtoolsFrontendUrl")
@Override
public String getDevtoolsFrontendUrl() {
return devtoolsFrontendUrl;
}
/**
* @return The value of the {@code id} attribute
*/
@JsonProperty("id")
@Override
public String getId() {
return id;
}
/**
* @return The value of the {@code title} attribute
*/
@JsonProperty("title")
@Override
public String getTitle() {
return title;
}
/**
* @return The value of the {@code type} attribute
*/
@JsonProperty("type")
@Override
public String getType() {
return type;
}
/**
* @return The value of the {@code url} attribute
*/
@JsonProperty("url")
@Override
public String getUrl() {
return url;
}
/**
* @return The value of the {@code webSocketDebuggerUrl} attribute
*/
@JsonProperty("webSocketDebuggerUrl")
@Override
public String getWebSocketDebuggerUrl() {
return webSocketDebuggerUrl;
}
/**
* Copy the current immutable object by setting a value for the {@link ChromeSessionInfoIF#getDescription() description} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for description
* @return A modified copy of the {@code this} object
*/
public final ChromeSessionInfo withDescription(String value) {
if (this.description.equals(value)) return this;
String newValue = Objects.requireNonNull(value, "description");
return new ChromeSessionInfo(
newValue,
this.devtoolsFrontendUrl,
this.id,
this.title,
this.type,
this.url,
this.webSocketDebuggerUrl);
}
/**
* Copy the current immutable object by setting a value for the {@link ChromeSessionInfoIF#getDevtoolsFrontendUrl() devtoolsFrontendUrl} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for devtoolsFrontendUrl
* @return A modified copy of the {@code this} object
*/
public final ChromeSessionInfo withDevtoolsFrontendUrl(String value) {
if (this.devtoolsFrontendUrl.equals(value)) return this;
String newValue = Objects.requireNonNull(value, "devtoolsFrontendUrl");
return new ChromeSessionInfo(this.description, newValue, this.id, this.title, this.type, this.url, this.webSocketDebuggerUrl);
}
/**
* Copy the current immutable object by setting a value for the {@link ChromeSessionInfoIF#getId() id} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for id
* @return A modified copy of the {@code this} object
*/
public final ChromeSessionInfo withId(String value) {
if (this.id.equals(value)) return this;
String newValue = Objects.requireNonNull(value, "id");
return new ChromeSessionInfo(
this.description,
this.devtoolsFrontendUrl,
newValue,
this.title,
this.type,
this.url,
this.webSocketDebuggerUrl);
}
/**
* Copy the current immutable object by setting a value for the {@link ChromeSessionInfoIF#getTitle() title} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for title
* @return A modified copy of the {@code this} object
*/
public final ChromeSessionInfo withTitle(String value) {
if (this.title.equals(value)) return this;
String newValue = Objects.requireNonNull(value, "title");
return new ChromeSessionInfo(
this.description,
this.devtoolsFrontendUrl,
this.id,
newValue,
this.type,
this.url,
this.webSocketDebuggerUrl);
}
/**
* Copy the current immutable object by setting a value for the {@link ChromeSessionInfoIF#getType() type} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for type
* @return A modified copy of the {@code this} object
*/
public final ChromeSessionInfo withType(String value) {
if (this.type.equals(value)) return this;
String newValue = Objects.requireNonNull(value, "type");
return new ChromeSessionInfo(
this.description,
this.devtoolsFrontendUrl,
this.id,
this.title,
newValue,
this.url,
this.webSocketDebuggerUrl);
}
/**
* Copy the current immutable object by setting a value for the {@link ChromeSessionInfoIF#getUrl() url} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for url
* @return A modified copy of the {@code this} object
*/
public final ChromeSessionInfo withUrl(String value) {
if (this.url.equals(value)) return this;
String newValue = Objects.requireNonNull(value, "url");
return new ChromeSessionInfo(
this.description,
this.devtoolsFrontendUrl,
this.id,
this.title,
this.type,
newValue,
this.webSocketDebuggerUrl);
}
/**
* Copy the current immutable object by setting a value for the {@link ChromeSessionInfoIF#getWebSocketDebuggerUrl() webSocketDebuggerUrl} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for webSocketDebuggerUrl
* @return A modified copy of the {@code this} object
*/
public final ChromeSessionInfo withWebSocketDebuggerUrl(String value) {
if (this.webSocketDebuggerUrl.equals(value)) return this;
String newValue = Objects.requireNonNull(value, "webSocketDebuggerUrl");
return new ChromeSessionInfo(this.description, this.devtoolsFrontendUrl, this.id, this.title, this.type, this.url, newValue);
}
/**
* This instance is equal to all instances of {@code ChromeSessionInfo} that have equal attribute values.
* @return {@code true} if {@code this} is equal to {@code another} instance
*/
@Override
public boolean equals(Object another) {
if (this == another) return true;
return another instanceof ChromeSessionInfo
&& equalTo((ChromeSessionInfo) another);
}
private boolean equalTo(ChromeSessionInfo another) {
return description.equals(another.description)
&& devtoolsFrontendUrl.equals(another.devtoolsFrontendUrl)
&& id.equals(another.id)
&& title.equals(another.title)
&& type.equals(another.type)
&& url.equals(another.url)
&& webSocketDebuggerUrl.equals(another.webSocketDebuggerUrl);
}
/**
* Computes a hash code from attributes: {@code description}, {@code devtoolsFrontendUrl}, {@code id}, {@code title}, {@code type}, {@code url}, {@code webSocketDebuggerUrl}.
* @return hashCode value
*/
@Override
public int hashCode() {
int h = 5381;
h += (h << 5) + description.hashCode();
h += (h << 5) + devtoolsFrontendUrl.hashCode();
h += (h << 5) + id.hashCode();
h += (h << 5) + title.hashCode();
h += (h << 5) + type.hashCode();
h += (h << 5) + url.hashCode();
h += (h << 5) + webSocketDebuggerUrl.hashCode();
return h;
}
/**
* Prints the immutable value {@code ChromeSessionInfo} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return "ChromeSessionInfo{"
+ "description=" + description
+ ", devtoolsFrontendUrl=" + devtoolsFrontendUrl
+ ", id=" + id
+ ", title=" + title
+ ", type=" + type
+ ", url=" + url
+ ", webSocketDebuggerUrl=" + webSocketDebuggerUrl
+ "}";
}
/**
* Utility type used to correctly read immutable object from JSON representation.
* @deprecated Do not use this type directly, it exists only for the Jackson-binding infrastructure
*/
@Deprecated
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE)
static final class Json implements ChromeSessionInfoIF {
String description;
String devtoolsFrontendUrl;
String id;
String title;
String type;
String url;
String webSocketDebuggerUrl;
@JsonProperty("description")
public void setDescription(String description) {
this.description = description;
}
@JsonProperty("devtoolsFrontendUrl")
public void setDevtoolsFrontendUrl(String devtoolsFrontendUrl) {
this.devtoolsFrontendUrl = devtoolsFrontendUrl;
}
@JsonProperty("id")
public void setId(String id) {
this.id = id;
}
@JsonProperty("title")
public void setTitle(String title) {
this.title = title;
}
@JsonProperty("type")
public void setType(String type) {
this.type = type;
}
@JsonProperty("url")
public void setUrl(String url) {
this.url = url;
}
@JsonProperty("webSocketDebuggerUrl")
public void setWebSocketDebuggerUrl(String webSocketDebuggerUrl) {
this.webSocketDebuggerUrl = webSocketDebuggerUrl;
}
@Override
public String getDescription() { throw new UnsupportedOperationException(); }
@Override
public String getDevtoolsFrontendUrl() { throw new UnsupportedOperationException(); }
@Override
public String getId() { throw new UnsupportedOperationException(); }
@Override
public String getTitle() { throw new UnsupportedOperationException(); }
@Override
public String getType() { throw new UnsupportedOperationException(); }
@Override
public String getUrl() { throw new UnsupportedOperationException(); }
@Override
public String getWebSocketDebuggerUrl() { throw new UnsupportedOperationException(); }
}
/**
* @param json A JSON-bindable data structure
* @return An immutable value type
* @deprecated Do not use this method directly, it exists only for the Jackson-binding infrastructure
*/
@Deprecated
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
static ChromeSessionInfo fromJson(Json json) {
ChromeSessionInfo.Builder builder = ChromeSessionInfo.builder();
if (json.description != null) {
builder.setDescription(json.description);
}
if (json.devtoolsFrontendUrl != null) {
builder.setDevtoolsFrontendUrl(json.devtoolsFrontendUrl);
}
if (json.id != null) {
builder.setId(json.id);
}
if (json.title != null) {
builder.setTitle(json.title);
}
if (json.type != null) {
builder.setType(json.type);
}
if (json.url != null) {
builder.setUrl(json.url);
}
if (json.webSocketDebuggerUrl != null) {
builder.setWebSocketDebuggerUrl(json.webSocketDebuggerUrl);
}
return builder.build();
}
/**
* Creates an immutable copy of a {@link ChromeSessionInfoIF} value.
* Uses accessors to get values to initialize the new immutable instance.
* If an instance is already immutable, it is returned as is.
* @param instance The instance to copy
* @return A copied immutable ChromeSessionInfo instance
*/
public static ChromeSessionInfo copyOf(ChromeSessionInfoIF instance) {
if (instance instanceof ChromeSessionInfo) {
return (ChromeSessionInfo) instance;
}
return ChromeSessionInfo.builder()
.from(instance)
.build();
}
/**
* Creates a builder for {@link ChromeSessionInfo ChromeSessionInfo}.
* @return A new ChromeSessionInfo builder
*/
public static ChromeSessionInfo.Builder builder() {
return new ChromeSessionInfo.Builder();
}
/**
* Builds instances of type {@link ChromeSessionInfo ChromeSessionInfo}.
* Initialize attributes and then invoke the {@link #build()} method to create an
* immutable instance.
*
{@code Builder} is not thread-safe and generally should not be stored in a field or collection,
* but instead used immediately to create instances.
*/
public static final class Builder {
private static final long INIT_BIT_DESCRIPTION = 0x1L;
private static final long INIT_BIT_DEVTOOLS_FRONTEND_URL = 0x2L;
private static final long INIT_BIT_ID = 0x4L;
private static final long INIT_BIT_TITLE = 0x8L;
private static final long INIT_BIT_TYPE = 0x10L;
private static final long INIT_BIT_URL = 0x20L;
private static final long INIT_BIT_WEB_SOCKET_DEBUGGER_URL = 0x40L;
private long initBits = 0x7fL;
private String description;
private String devtoolsFrontendUrl;
private String id;
private String title;
private String type;
private String url;
private String webSocketDebuggerUrl;
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code ChromeSessionInfoIF} instance.
* Regular attribute values will be replaced with those from the given instance.
* Absent optional values will not replace present values.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
public final Builder from(ChromeSessionInfoIF instance) {
Objects.requireNonNull(instance, "instance");
setDescription(instance.getDescription());
setDevtoolsFrontendUrl(instance.getDevtoolsFrontendUrl());
setId(instance.getId());
setTitle(instance.getTitle());
setType(instance.getType());
setUrl(instance.getUrl());
setWebSocketDebuggerUrl(instance.getWebSocketDebuggerUrl());
return this;
}
/**
* Initializes the value for the {@link ChromeSessionInfoIF#getDescription() description} attribute.
* @param description The value for description
* @return {@code this} builder for use in a chained invocation
*/
public final Builder setDescription(String description) {
this.description = Objects.requireNonNull(description, "description");
initBits &= ~INIT_BIT_DESCRIPTION;
return this;
}
/**
* Initializes the value for the {@link ChromeSessionInfoIF#getDevtoolsFrontendUrl() devtoolsFrontendUrl} attribute.
* @param devtoolsFrontendUrl The value for devtoolsFrontendUrl
* @return {@code this} builder for use in a chained invocation
*/
public final Builder setDevtoolsFrontendUrl(String devtoolsFrontendUrl) {
this.devtoolsFrontendUrl = Objects.requireNonNull(devtoolsFrontendUrl, "devtoolsFrontendUrl");
initBits &= ~INIT_BIT_DEVTOOLS_FRONTEND_URL;
return this;
}
/**
* Initializes the value for the {@link ChromeSessionInfoIF#getId() id} attribute.
* @param id The value for id
* @return {@code this} builder for use in a chained invocation
*/
public final Builder setId(String id) {
this.id = Objects.requireNonNull(id, "id");
initBits &= ~INIT_BIT_ID;
return this;
}
/**
* Initializes the value for the {@link ChromeSessionInfoIF#getTitle() title} attribute.
* @param title The value for title
* @return {@code this} builder for use in a chained invocation
*/
public final Builder setTitle(String title) {
this.title = Objects.requireNonNull(title, "title");
initBits &= ~INIT_BIT_TITLE;
return this;
}
/**
* Initializes the value for the {@link ChromeSessionInfoIF#getType() type} attribute.
* @param type The value for type
* @return {@code this} builder for use in a chained invocation
*/
public final Builder setType(String type) {
this.type = Objects.requireNonNull(type, "type");
initBits &= ~INIT_BIT_TYPE;
return this;
}
/**
* Initializes the value for the {@link ChromeSessionInfoIF#getUrl() url} attribute.
* @param url The value for url
* @return {@code this} builder for use in a chained invocation
*/
public final Builder setUrl(String url) {
this.url = Objects.requireNonNull(url, "url");
initBits &= ~INIT_BIT_URL;
return this;
}
/**
* Initializes the value for the {@link ChromeSessionInfoIF#getWebSocketDebuggerUrl() webSocketDebuggerUrl} attribute.
* @param webSocketDebuggerUrl The value for webSocketDebuggerUrl
* @return {@code this} builder for use in a chained invocation
*/
public final Builder setWebSocketDebuggerUrl(String webSocketDebuggerUrl) {
this.webSocketDebuggerUrl = Objects.requireNonNull(webSocketDebuggerUrl, "webSocketDebuggerUrl");
initBits &= ~INIT_BIT_WEB_SOCKET_DEBUGGER_URL;
return this;
}
/**
* Builds a new {@link ChromeSessionInfo ChromeSessionInfo}.
* @return An immutable instance of ChromeSessionInfo
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public ChromeSessionInfo build() {
if (initBits != 0) {
throw new IllegalStateException(formatRequiredAttributesMessage());
}
return new ChromeSessionInfo(description, devtoolsFrontendUrl, id, title, type, url, webSocketDebuggerUrl);
}
private String formatRequiredAttributesMessage() {
List attributes = new ArrayList();
if ((initBits & INIT_BIT_DESCRIPTION) != 0) attributes.add("description");
if ((initBits & INIT_BIT_DEVTOOLS_FRONTEND_URL) != 0) attributes.add("devtoolsFrontendUrl");
if ((initBits & INIT_BIT_ID) != 0) attributes.add("id");
if ((initBits & INIT_BIT_TITLE) != 0) attributes.add("title");
if ((initBits & INIT_BIT_TYPE) != 0) attributes.add("type");
if ((initBits & INIT_BIT_URL) != 0) attributes.add("url");
if ((initBits & INIT_BIT_WEB_SOCKET_DEBUGGER_URL) != 0) attributes.add("webSocketDebuggerUrl");
return "Cannot build ChromeSessionInfo, some of required attributes are not set " + attributes;
}
}
}