Home / Class/ Immutable Class — spring-boot Architecture

Immutable Class — spring-boot Architecture

Architecture documentation for the Immutable class in PropertyMapperTests.java from the spring-boot codebase.

Entity Profile

Source Code

core/spring-boot/src/test/java/org/springframework/boot/context/properties/PropertyMapperTests.java lines 365–396

	static class Immutable {

		private final String name;

		private final @Nullable Integer age;

		final boolean withAgeCalled;

		Immutable(String name, @Nullable Integer age) {
			this(name, age, false);
		}

		private Immutable(String name, @Nullable Integer age, boolean withAgeCalled) {
			this.name = name;
			this.age = age;
			this.withAgeCalled = withAgeCalled;
		}

		Immutable withAge(@Nullable Integer age) {
			return new Immutable(this.name, age, true);
		}

		@Override
		public String toString() {
			return "%s %s".formatted(this.name, this.age);
		}

		static Immutable of(String name) {
			return new Immutable(name, null);
		}

	}

Analyze Your Own Codebase

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

Try Supermodel Free