Constructor getBindConstructor()

in spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindConstructorProvider.java [50:70]


	Constructor<?> getBindConstructor(Class<?> type, boolean deduceBindConstructor,
			boolean isNestedConstructorBinding) {
		if (type == null) {
			return null;
		}
		Constructor<?> constructor = findConstructorBindingAnnotatedConstructor(type);
		if (constructor != null) {
			return constructor;
		}
		boolean isConstructorBindingAnnotatedType = isConstructorBindingAnnotatedType(type);
		if (deduceBindConstructor || isNestedConstructorBinding || isConstructorBindingAnnotatedType) {
			constructor = deduceBindConstructor(type);
		}
		if (deduceBindConstructor && isConstructorBindingAnnotatedType && !isNestedConstructorBinding) {
			Assert.state(constructor != null,
					() -> "Unable to deduce constructor for @ConstructorBinding class " + type.getName());
			Assert.state(constructor.getParameterCount() > 0,
					() -> "Deduced no-args constructor for @ConstructorBinding class " + type.getName());
		}
		return constructor;
	}