Home / Class/ ProgressDetail Class — spring-boot Architecture

ProgressDetail Class — spring-boot Architecture

Architecture documentation for the ProgressDetail class in ProgressUpdateEvent.java from the spring-boot codebase.

Entity Profile

Source Code

buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/ProgressUpdateEvent.java lines 71–100

	public static class ProgressDetail {

		private final @Nullable Long current;

		private final @Nullable Long total;

		@JsonCreator
		public ProgressDetail(@Nullable Long current, @Nullable Long total) {
			this.current = current;
			this.total = total;
		}

		/**
		 * Return the progress as a percentage.
		 * @return the progress percentage
		 * @since 3.3.7
		 */
		public int asPercentage() {
			if (this.total == null || this.current == null) {
				return 0;
			}
			int percentage = (int) ((100.0 / this.total) * this.current);
			return (percentage < 0) ? 0 : Math.min(percentage, 100);
		}

		private static boolean isEmpty(@Nullable ProgressDetail progressDetail) {
			return progressDetail == null || progressDetail.current == null || progressDetail.total == null;
		}

	}

Analyze Your Own Codebase

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

Try Supermodel Free