org.mandas.docker.client.messages.ImmutableImageInfo Maven / Gradle / Ivy
package org.mandas.docker.client.messages;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import org.mandas.docker.Nullable;
/**
* Immutable implementation of {@link ImageInfo}.
*
* Use the builder to create immutable instances:
* {@code ImmutableImageInfo.builder()}.
*/
@SuppressWarnings({"all", "deprecation", "removal"})
final class ImmutableImageInfo implements ImageInfo {
private final String id;
private final String parent;
private final String comment;
private final Date created;
private final String container;
private final ContainerConfig containerConfig;
private final String dockerVersion;
private final String author;
private final ContainerConfig config;
private final String architecture;
private final String os;
private final Long size;
private final Long virtualSize;
private final @Nullable RootFs rootFs;
private ImmutableImageInfo(ImmutableImageInfo.Builder builder) {
this.id = builder.id;
this.parent = builder.parent;
this.comment = builder.comment;
this.created = builder.created;
this.container = builder.container;
this.containerConfig = builder.containerConfig;
this.dockerVersion = builder.dockerVersion;
this.author = builder.author;
this.config = builder.config;
this.architecture = builder.architecture;
this.os = builder.os;
this.size = builder.size;
this.rootFs = builder.rootFs;
this.virtualSize = builder.virtualSize != null
? builder.virtualSize
: Objects.requireNonNull(ImageInfo.super.virtualSize(), "virtualSize");
}
private ImmutableImageInfo(
String id,
String parent,
String comment,
Date created,
String container,
ContainerConfig containerConfig,
String dockerVersion,
String author,
ContainerConfig config,
String architecture,
String os,
Long size,
Long virtualSize,
@Nullable RootFs rootFs) {
this.id = id;
this.parent = parent;
this.comment = comment;
this.created = created;
this.container = container;
this.containerConfig = containerConfig;
this.dockerVersion = dockerVersion;
this.author = author;
this.config = config;
this.architecture = architecture;
this.os = os;
this.size = size;
this.virtualSize = virtualSize;
this.rootFs = rootFs;
}
/**
* @return The value of the {@code id} attribute
*/
@JsonProperty("Id")
@Override
public String id() {
return id;
}
/**
* @return The value of the {@code parent} attribute
*/
@JsonProperty("Parent")
@Override
public String parent() {
return parent;
}
/**
* @return The value of the {@code comment} attribute
*/
@JsonProperty("Comment")
@Override
public String comment() {
return comment;
}
/**
* @return The value of the {@code created} attribute
*/
@JsonProperty("Created")
@Override
public Date created() {
return created;
}
/**
* @return The value of the {@code container} attribute
*/
@JsonProperty("Container")
@Deprecated
@Override
public String container() {
return container;
}
/**
* @return The value of the {@code containerConfig} attribute
*/
@JsonProperty("ContainerConfig")
@Deprecated
@Override
public ContainerConfig containerConfig() {
return containerConfig;
}
/**
* @return The value of the {@code dockerVersion} attribute
*/
@JsonProperty("DockerVersion")
@Override
public String dockerVersion() {
return dockerVersion;
}
/**
* @return The value of the {@code author} attribute
*/
@JsonProperty("Author")
@Override
public String author() {
return author;
}
/**
* @return The value of the {@code config} attribute
*/
@JsonProperty("Config")
@Override
public ContainerConfig config() {
return config;
}
/**
* @return The value of the {@code architecture} attribute
*/
@JsonProperty("Architecture")
@Override
public String architecture() {
return architecture;
}
/**
* @return The value of the {@code os} attribute
*/
@JsonProperty("Os")
@Override
public String os() {
return os;
}
/**
* @return The value of the {@code size} attribute
*/
@JsonProperty("Size")
@Override
public Long size() {
return size;
}
/**
* @return The value of the {@code virtualSize} attribute
*/
@JsonProperty("VirtualSize")
@Deprecated
@Override
public Long virtualSize() {
return virtualSize;
}
/**
* @return The value of the {@code rootFs} attribute
*/
@JsonProperty("RootFS")
@Override
public @Nullable RootFs rootFs() {
return rootFs;
}
/**
* Copy the current immutable object by setting a value for the {@link ImageInfo#id() 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 ImmutableImageInfo withId(String value) {
String newValue = Objects.requireNonNull(value, "id");
if (this.id.equals(newValue)) return this;
return new ImmutableImageInfo(
newValue,
this.parent,
this.comment,
this.created,
this.container,
this.containerConfig,
this.dockerVersion,
this.author,
this.config,
this.architecture,
this.os,
this.size,
this.virtualSize,
this.rootFs);
}
/**
* Copy the current immutable object by setting a value for the {@link ImageInfo#parent() parent} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for parent
* @return A modified copy of the {@code this} object
*/
public final ImmutableImageInfo withParent(String value) {
String newValue = Objects.requireNonNull(value, "parent");
if (this.parent.equals(newValue)) return this;
return new ImmutableImageInfo(
this.id,
newValue,
this.comment,
this.created,
this.container,
this.containerConfig,
this.dockerVersion,
this.author,
this.config,
this.architecture,
this.os,
this.size,
this.virtualSize,
this.rootFs);
}
/**
* Copy the current immutable object by setting a value for the {@link ImageInfo#comment() comment} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for comment
* @return A modified copy of the {@code this} object
*/
public final ImmutableImageInfo withComment(String value) {
String newValue = Objects.requireNonNull(value, "comment");
if (this.comment.equals(newValue)) return this;
return new ImmutableImageInfo(
this.id,
this.parent,
newValue,
this.created,
this.container,
this.containerConfig,
this.dockerVersion,
this.author,
this.config,
this.architecture,
this.os,
this.size,
this.virtualSize,
this.rootFs);
}
/**
* Copy the current immutable object by setting a value for the {@link ImageInfo#created() created} attribute.
* A shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param value A new value for created
* @return A modified copy of the {@code this} object
*/
public final ImmutableImageInfo withCreated(Date value) {
if (this.created == value) return this;
Date newValue = Objects.requireNonNull(value, "created");
return new ImmutableImageInfo(
this.id,
this.parent,
this.comment,
newValue,
this.container,
this.containerConfig,
this.dockerVersion,
this.author,
this.config,
this.architecture,
this.os,
this.size,
this.virtualSize,
this.rootFs);
}
/**
* Copy the current immutable object by setting a value for the {@link ImageInfo#container() container} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for container
* @return A modified copy of the {@code this} object
*/
@Deprecated
public final ImmutableImageInfo withContainer(String value) {
String newValue = Objects.requireNonNull(value, "container");
if (this.container.equals(newValue)) return this;
return new ImmutableImageInfo(
this.id,
this.parent,
this.comment,
this.created,
newValue,
this.containerConfig,
this.dockerVersion,
this.author,
this.config,
this.architecture,
this.os,
this.size,
this.virtualSize,
this.rootFs);
}
/**
* Copy the current immutable object by setting a value for the {@link ImageInfo#containerConfig() containerConfig} attribute.
* A shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param value A new value for containerConfig
* @return A modified copy of the {@code this} object
*/
@Deprecated
public final ImmutableImageInfo withContainerConfig(ContainerConfig value) {
if (this.containerConfig == value) return this;
ContainerConfig newValue = Objects.requireNonNull(value, "containerConfig");
return new ImmutableImageInfo(
this.id,
this.parent,
this.comment,
this.created,
this.container,
newValue,
this.dockerVersion,
this.author,
this.config,
this.architecture,
this.os,
this.size,
this.virtualSize,
this.rootFs);
}
/**
* Copy the current immutable object by setting a value for the {@link ImageInfo#dockerVersion() dockerVersion} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for dockerVersion
* @return A modified copy of the {@code this} object
*/
public final ImmutableImageInfo withDockerVersion(String value) {
String newValue = Objects.requireNonNull(value, "dockerVersion");
if (this.dockerVersion.equals(newValue)) return this;
return new ImmutableImageInfo(
this.id,
this.parent,
this.comment,
this.created,
this.container,
this.containerConfig,
newValue,
this.author,
this.config,
this.architecture,
this.os,
this.size,
this.virtualSize,
this.rootFs);
}
/**
* Copy the current immutable object by setting a value for the {@link ImageInfo#author() author} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for author
* @return A modified copy of the {@code this} object
*/
public final ImmutableImageInfo withAuthor(String value) {
String newValue = Objects.requireNonNull(value, "author");
if (this.author.equals(newValue)) return this;
return new ImmutableImageInfo(
this.id,
this.parent,
this.comment,
this.created,
this.container,
this.containerConfig,
this.dockerVersion,
newValue,
this.config,
this.architecture,
this.os,
this.size,
this.virtualSize,
this.rootFs);
}
/**
* Copy the current immutable object by setting a value for the {@link ImageInfo#config() config} attribute.
* A shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param value A new value for config
* @return A modified copy of the {@code this} object
*/
public final ImmutableImageInfo withConfig(ContainerConfig value) {
if (this.config == value) return this;
ContainerConfig newValue = Objects.requireNonNull(value, "config");
return new ImmutableImageInfo(
this.id,
this.parent,
this.comment,
this.created,
this.container,
this.containerConfig,
this.dockerVersion,
this.author,
newValue,
this.architecture,
this.os,
this.size,
this.virtualSize,
this.rootFs);
}
/**
* Copy the current immutable object by setting a value for the {@link ImageInfo#architecture() architecture} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for architecture
* @return A modified copy of the {@code this} object
*/
public final ImmutableImageInfo withArchitecture(String value) {
String newValue = Objects.requireNonNull(value, "architecture");
if (this.architecture.equals(newValue)) return this;
return new ImmutableImageInfo(
this.id,
this.parent,
this.comment,
this.created,
this.container,
this.containerConfig,
this.dockerVersion,
this.author,
this.config,
newValue,
this.os,
this.size,
this.virtualSize,
this.rootFs);
}
/**
* Copy the current immutable object by setting a value for the {@link ImageInfo#os() os} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for os
* @return A modified copy of the {@code this} object
*/
public final ImmutableImageInfo withOs(String value) {
String newValue = Objects.requireNonNull(value, "os");
if (this.os.equals(newValue)) return this;
return new ImmutableImageInfo(
this.id,
this.parent,
this.comment,
this.created,
this.container,
this.containerConfig,
this.dockerVersion,
this.author,
this.config,
this.architecture,
newValue,
this.size,
this.virtualSize,
this.rootFs);
}
/**
* Copy the current immutable object by setting a value for the {@link ImageInfo#size() size} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for size
* @return A modified copy of the {@code this} object
*/
public final ImmutableImageInfo withSize(Long value) {
Long newValue = Objects.requireNonNull(value, "size");
if (this.size.equals(newValue)) return this;
return new ImmutableImageInfo(
this.id,
this.parent,
this.comment,
this.created,
this.container,
this.containerConfig,
this.dockerVersion,
this.author,
this.config,
this.architecture,
this.os,
newValue,
this.virtualSize,
this.rootFs);
}
/**
* Copy the current immutable object by setting a value for the {@link ImageInfo#virtualSize() virtualSize} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for virtualSize
* @return A modified copy of the {@code this} object
*/
@Deprecated
public final ImmutableImageInfo withVirtualSize(Long value) {
Long newValue = Objects.requireNonNull(value, "virtualSize");
if (this.virtualSize.equals(newValue)) return this;
return new ImmutableImageInfo(
this.id,
this.parent,
this.comment,
this.created,
this.container,
this.containerConfig,
this.dockerVersion,
this.author,
this.config,
this.architecture,
this.os,
this.size,
newValue,
this.rootFs);
}
/**
* Copy the current immutable object by setting a value for the {@link ImageInfo#rootFs() rootFs} attribute.
* A shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param value A new value for rootFs (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableImageInfo withRootFs(@Nullable RootFs value) {
if (this.rootFs == value) return this;
return new ImmutableImageInfo(
this.id,
this.parent,
this.comment,
this.created,
this.container,
this.containerConfig,
this.dockerVersion,
this.author,
this.config,
this.architecture,
this.os,
this.size,
this.virtualSize,
value);
}
/**
* This instance is equal to all instances of {@code ImmutableImageInfo} 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 ImmutableImageInfo
&& equalTo(0, (ImmutableImageInfo) another);
}
private boolean equalTo(int synthetic, ImmutableImageInfo another) {
return id.equals(another.id)
&& parent.equals(another.parent)
&& comment.equals(another.comment)
&& created.equals(another.created)
&& container.equals(another.container)
&& containerConfig.equals(another.containerConfig)
&& dockerVersion.equals(another.dockerVersion)
&& author.equals(another.author)
&& config.equals(another.config)
&& architecture.equals(another.architecture)
&& os.equals(another.os)
&& size.equals(another.size)
&& virtualSize.equals(another.virtualSize)
&& Objects.equals(rootFs, another.rootFs);
}
/**
* Computes a hash code from attributes: {@code id}, {@code parent}, {@code comment}, {@code created}, {@code container}, {@code containerConfig}, {@code dockerVersion}, {@code author}, {@code config}, {@code architecture}, {@code os}, {@code size}, {@code virtualSize}, {@code rootFs}.
* @return hashCode value
*/
@Override
public int hashCode() {
int h = 5381;
h += (h << 5) + id.hashCode();
h += (h << 5) + parent.hashCode();
h += (h << 5) + comment.hashCode();
h += (h << 5) + created.hashCode();
h += (h << 5) + container.hashCode();
h += (h << 5) + containerConfig.hashCode();
h += (h << 5) + dockerVersion.hashCode();
h += (h << 5) + author.hashCode();
h += (h << 5) + config.hashCode();
h += (h << 5) + architecture.hashCode();
h += (h << 5) + os.hashCode();
h += (h << 5) + size.hashCode();
h += (h << 5) + virtualSize.hashCode();
h += (h << 5) + Objects.hashCode(rootFs);
return h;
}
/**
* Prints the immutable value {@code ImageInfo} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return "ImageInfo{"
+ "id=" + id
+ ", parent=" + parent
+ ", comment=" + comment
+ ", created=" + created
+ ", container=" + container
+ ", containerConfig=" + containerConfig
+ ", dockerVersion=" + dockerVersion
+ ", author=" + author
+ ", config=" + config
+ ", architecture=" + architecture
+ ", os=" + os
+ ", size=" + size
+ ", virtualSize=" + virtualSize
+ ", rootFs=" + rootFs
+ "}";
}
/**
* Creates an immutable copy of a {@link ImageInfo} 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 ImageInfo instance
*/
public static ImmutableImageInfo copyOf(ImageInfo instance) {
if (instance instanceof ImmutableImageInfo) {
return (ImmutableImageInfo) instance;
}
return ImmutableImageInfo.builder()
.from(instance)
.build();
}
/**
* Creates a builder for {@link ImmutableImageInfo ImmutableImageInfo}.
*
* ImmutableImageInfo.builder()
* .id(String) // required {@link ImageInfo#id() id}
* .parent(String) // required {@link ImageInfo#parent() parent}
* .comment(String) // required {@link ImageInfo#comment() comment}
* .created(Date) // required {@link ImageInfo#created() created}
* .container(String) // required {@link ImageInfo#container() container}
* .containerConfig(org.mandas.docker.client.messages.ContainerConfig) // required {@link ImageInfo#containerConfig() containerConfig}
* .dockerVersion(String) // required {@link ImageInfo#dockerVersion() dockerVersion}
* .author(String) // required {@link ImageInfo#author() author}
* .config(org.mandas.docker.client.messages.ContainerConfig) // required {@link ImageInfo#config() config}
* .architecture(String) // required {@link ImageInfo#architecture() architecture}
* .os(String) // required {@link ImageInfo#os() os}
* .size(Long) // required {@link ImageInfo#size() size}
* .virtualSize(Long) // optional {@link ImageInfo#virtualSize() virtualSize}
* .rootFs(org.mandas.docker.client.messages.RootFs | null) // nullable {@link ImageInfo#rootFs() rootFs}
* .build();
*
* @return A new ImmutableImageInfo builder
*/
public static ImmutableImageInfo.Builder builder() {
return new ImmutableImageInfo.Builder();
}
/**
* Builds instances of type {@link ImmutableImageInfo ImmutableImageInfo}.
* 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.
*/
static final class Builder {
private static final long INIT_BIT_ID = 0x1L;
private static final long INIT_BIT_PARENT = 0x2L;
private static final long INIT_BIT_COMMENT = 0x4L;
private static final long INIT_BIT_CREATED = 0x8L;
private static final long INIT_BIT_CONTAINER = 0x10L;
private static final long INIT_BIT_CONTAINER_CONFIG = 0x20L;
private static final long INIT_BIT_DOCKER_VERSION = 0x40L;
private static final long INIT_BIT_AUTHOR = 0x80L;
private static final long INIT_BIT_CONFIG = 0x100L;
private static final long INIT_BIT_ARCHITECTURE = 0x200L;
private static final long INIT_BIT_OS = 0x400L;
private static final long INIT_BIT_SIZE = 0x800L;
private long initBits = 0xfffL;
private String id;
private String parent;
private String comment;
private Date created;
private String container;
private ContainerConfig containerConfig;
private String dockerVersion;
private String author;
private ContainerConfig config;
private String architecture;
private String os;
private Long size;
private Long virtualSize;
private RootFs rootFs;
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code ImageInfo} 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(ImageInfo instance) {
Objects.requireNonNull(instance, "instance");
id(instance.id());
parent(instance.parent());
comment(instance.comment());
created(instance.created());
container(instance.container());
containerConfig(instance.containerConfig());
dockerVersion(instance.dockerVersion());
author(instance.author());
config(instance.config());
architecture(instance.architecture());
os(instance.os());
size(instance.size());
virtualSize(instance.virtualSize());
@Nullable RootFs rootFsValue = instance.rootFs();
if (rootFsValue != null) {
rootFs(rootFsValue);
}
return this;
}
/**
* Initializes the value for the {@link ImageInfo#id() id} attribute.
* @param id The value for id
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("Id")
public final Builder id(String id) {
this.id = Objects.requireNonNull(id, "id");
initBits &= ~INIT_BIT_ID;
return this;
}
/**
* Initializes the value for the {@link ImageInfo#parent() parent} attribute.
* @param parent The value for parent
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("Parent")
public final Builder parent(String parent) {
this.parent = Objects.requireNonNull(parent, "parent");
initBits &= ~INIT_BIT_PARENT;
return this;
}
/**
* Initializes the value for the {@link ImageInfo#comment() comment} attribute.
* @param comment The value for comment
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("Comment")
public final Builder comment(String comment) {
this.comment = Objects.requireNonNull(comment, "comment");
initBits &= ~INIT_BIT_COMMENT;
return this;
}
/**
* Initializes the value for the {@link ImageInfo#created() created} attribute.
* @param created The value for created
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("Created")
public final Builder created(Date created) {
this.created = Objects.requireNonNull(created, "created");
initBits &= ~INIT_BIT_CREATED;
return this;
}
/**
* Initializes the value for the {@link ImageInfo#container() container} attribute.
* @param container The value for container
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("Container")
@Deprecated
public final Builder container(String container) {
this.container = Objects.requireNonNull(container, "container");
initBits &= ~INIT_BIT_CONTAINER;
return this;
}
/**
* Initializes the value for the {@link ImageInfo#containerConfig() containerConfig} attribute.
* @param containerConfig The value for containerConfig
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("ContainerConfig")
@Deprecated
public final Builder containerConfig(ContainerConfig containerConfig) {
this.containerConfig = Objects.requireNonNull(containerConfig, "containerConfig");
initBits &= ~INIT_BIT_CONTAINER_CONFIG;
return this;
}
/**
* Initializes the value for the {@link ImageInfo#dockerVersion() dockerVersion} attribute.
* @param dockerVersion The value for dockerVersion
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("DockerVersion")
public final Builder dockerVersion(String dockerVersion) {
this.dockerVersion = Objects.requireNonNull(dockerVersion, "dockerVersion");
initBits &= ~INIT_BIT_DOCKER_VERSION;
return this;
}
/**
* Initializes the value for the {@link ImageInfo#author() author} attribute.
* @param author The value for author
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("Author")
public final Builder author(String author) {
this.author = Objects.requireNonNull(author, "author");
initBits &= ~INIT_BIT_AUTHOR;
return this;
}
/**
* Initializes the value for the {@link ImageInfo#config() config} attribute.
* @param config The value for config
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("Config")
public final Builder config(ContainerConfig config) {
this.config = Objects.requireNonNull(config, "config");
initBits &= ~INIT_BIT_CONFIG;
return this;
}
/**
* Initializes the value for the {@link ImageInfo#architecture() architecture} attribute.
* @param architecture The value for architecture
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("Architecture")
public final Builder architecture(String architecture) {
this.architecture = Objects.requireNonNull(architecture, "architecture");
initBits &= ~INIT_BIT_ARCHITECTURE;
return this;
}
/**
* Initializes the value for the {@link ImageInfo#os() os} attribute.
* @param os The value for os
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("Os")
public final Builder os(String os) {
this.os = Objects.requireNonNull(os, "os");
initBits &= ~INIT_BIT_OS;
return this;
}
/**
* Initializes the value for the {@link ImageInfo#size() size} attribute.
* @param size The value for size
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("Size")
public final Builder size(Long size) {
this.size = Objects.requireNonNull(size, "size");
initBits &= ~INIT_BIT_SIZE;
return this;
}
/**
* Initializes the value for the {@link ImageInfo#virtualSize() virtualSize} attribute.
*
If not set, this attribute will have a default value as returned by the initializer of {@link ImageInfo#virtualSize() virtualSize}.
* @param virtualSize The value for virtualSize
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("VirtualSize")
@Deprecated
public final Builder virtualSize(Long virtualSize) {
this.virtualSize = Objects.requireNonNull(virtualSize, "virtualSize");
return this;
}
/**
* Initializes the value for the {@link ImageInfo#rootFs() rootFs} attribute.
* @param rootFs The value for rootFs (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("RootFS")
public final Builder rootFs(@Nullable RootFs rootFs) {
this.rootFs = rootFs;
return this;
}
/**
* Builds a new {@link ImmutableImageInfo ImmutableImageInfo}.
* @return An immutable instance of ImageInfo
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public ImmutableImageInfo build() {
if (initBits != 0) {
throw new IllegalStateException(formatRequiredAttributesMessage());
}
return new ImmutableImageInfo(this);
}
private String formatRequiredAttributesMessage() {
List attributes = new ArrayList<>();
if ((initBits & INIT_BIT_ID) != 0) attributes.add("id");
if ((initBits & INIT_BIT_PARENT) != 0) attributes.add("parent");
if ((initBits & INIT_BIT_COMMENT) != 0) attributes.add("comment");
if ((initBits & INIT_BIT_CREATED) != 0) attributes.add("created");
if ((initBits & INIT_BIT_CONTAINER) != 0) attributes.add("container");
if ((initBits & INIT_BIT_CONTAINER_CONFIG) != 0) attributes.add("containerConfig");
if ((initBits & INIT_BIT_DOCKER_VERSION) != 0) attributes.add("dockerVersion");
if ((initBits & INIT_BIT_AUTHOR) != 0) attributes.add("author");
if ((initBits & INIT_BIT_CONFIG) != 0) attributes.add("config");
if ((initBits & INIT_BIT_ARCHITECTURE) != 0) attributes.add("architecture");
if ((initBits & INIT_BIT_OS) != 0) attributes.add("os");
if ((initBits & INIT_BIT_SIZE) != 0) attributes.add("size");
return "Cannot build ImageInfo, some of required attributes are not set " + attributes;
}
}
}