Home / Class/ JavaBeanBinding Class — spring-boot Architecture

JavaBeanBinding Class — spring-boot Architecture

Architecture documentation for the JavaBeanBinding class in BindableRuntimeHintsRegistrarTests.java from the spring-boot codebase.

Entity Profile

Relationship Graph

Source Code

core/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BindableRuntimeHintsRegistrarTests.java lines 809–852

	private static final class JavaBeanBinding implements Consumer<TypeHint> {

		private final Class<?> type;

		private Constructor<?> constructor;

		private List<String> expectedMethods = Collections.emptyList();

		private List<String> expectedFields = Collections.emptyList();

		private JavaBeanBinding(Class<?> type) {
			this.type = type;
			this.constructor = this.type.getDeclaredConstructors()[0];
		}

		@Override
		public void accept(TypeHint entry) {
			assertThat(entry.getType()).isEqualTo(TypeReference.of(this.type));
			assertThat(entry.constructors()).singleElement().satisfies(match(this.constructor));
			assertThat(entry.getMemberCategories()).isEmpty();
			assertThat(entry.methods()).as("Methods requiring reflection")
				.extracting(ExecutableHint::getName)
				.containsExactlyInAnyOrderElementsOf(this.expectedMethods);
			assertThat(entry.fields()).as("Fields requiring reflection")
				.extracting(FieldHint::getName)
				.containsExactlyInAnyOrderElementsOf(this.expectedFields);
		}

		private JavaBeanBinding constructor(Constructor<?> constructor) {
			this.constructor = constructor;
			return this;
		}

		private JavaBeanBinding methods(String... methods) {
			this.expectedMethods = List.of(methods);
			return this;
		}

		private JavaBeanBinding fields(String... fields) {
			this.expectedFields = List.of(fields);
			return this;
		}

	}

Domain

Analyze Your Own Codebase

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

Try Supermodel Free