Home / Class/ Update Class — spring-boot Architecture

Update Class — spring-boot Architecture

Architecture documentation for the Update class in ImageArchive.java from the spring-boot codebase.

Entity Profile

Relationship Graph

Source Code

buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/ImageArchive.java lines 256–316

	public static final class Update {

		private final Image image;

		private ImageConfig config;

		private @Nullable Instant createDate;

		private @Nullable ImageReference tag;

		private final List<Layer> newLayers = new ArrayList<>();

		private Update(Image image) {
			this.image = image;
			this.config = image.getConfig();
		}

		private ImageArchive applyTo(IOConsumer<Update> update) throws IOException {
			update.accept(this);
			Instant createDate = (this.createDate != null) ? this.createDate : WINDOWS_EPOCH_PLUS_SECOND;
			return new ImageArchive(SharedJsonMapper.get(), this.config, createDate, this.tag, this.image.getOs(),
					this.image.getArchitecture(), this.image.getVariant(), this.image.getLayers(),
					Collections.unmodifiableList(this.newLayers));
		}

		/**
		 * Apply updates to the {@link ImageConfig}.
		 * @param update consumer to apply updates
		 */
		public void withUpdatedConfig(Consumer<ImageConfig.Update> update) {
			this.config = this.config.copy(update);
		}

		/**
		 * Add a new layer to the image archive.
		 * @param layer the layer to add
		 */
		public void withNewLayer(Layer layer) {
			Assert.notNull(layer, "'layer' must not be null");
			this.newLayers.add(layer);
		}

		/**
		 * Set the create date for the image archive.
		 * @param createDate the create date
		 */
		public void withCreateDate(Instant createDate) {
			Assert.notNull(createDate, "'createDate' must not be null");
			this.createDate = createDate;
		}

		/**
		 * Set the tag for the image archive.
		 * @param tag the tag
		 */
		public void withTag(ImageReference tag) {
			Assert.notNull(tag, "'tag' must not be null");
			this.tag = tag.inTaggedForm();
		}

	}

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free