Home / Class/ ContainerStatus Class — spring-boot Architecture

ContainerStatus Class — spring-boot Architecture

Architecture documentation for the ContainerStatus class in ContainerStatus.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/ContainerStatus.java lines 36–97

public class ContainerStatus extends MappedObject {

	private final int statusCode;

	private final @Nullable String waitingErrorMessage;

	ContainerStatus(int statusCode, @Nullable String waitingErrorMessage) {
		super(NullNode.getInstance(), MethodHandles.lookup());
		this.statusCode = statusCode;
		this.waitingErrorMessage = waitingErrorMessage;
	}

	ContainerStatus(JsonNode node) {
		super(node, MethodHandles.lookup());
		this.statusCode = extractStatusCode();
		this.waitingErrorMessage = valueAt("/Error/Message", String.class);
	}

	private Integer extractStatusCode() {
		Integer result = valueAt("/StatusCode", Integer.class);
		Assert.state(result != null, "'result' must not be null");
		return result;
	}

	/**
	 * Return the container exit status code.
	 * @return the exit status code
	 */
	public int getStatusCode() {
		return this.statusCode;
	}

	/**
	 * Return a message indicating an error waiting for a container to stop.
	 * @return the waiting error message
	 */
	public @Nullable String getWaitingErrorMessage() {
		return this.waitingErrorMessage;
	}

	/**
	 * Create a new {@link ContainerStatus} instance from the specified JSON content
	 * stream.
	 * @param content the JSON content stream
	 * @return a new {@link ContainerStatus} instance
	 * @throws IOException on IO error
	 */
	public static ContainerStatus of(InputStream content) throws IOException {
		return of(content, ContainerStatus::new);
	}

	/**
	 * Create a new {@link ContainerStatus} instance with the specified values.
	 * @param statusCode the status code
	 * @param errorMessage the error message
	 * @return a new {@link ContainerStatus} instance
	 */
	public static ContainerStatus of(int statusCode, @Nullable String errorMessage) {
		return new ContainerStatus(statusCode, errorMessage);
	}

}

Analyze Your Own Codebase

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

Try Supermodel Free