본문 바로가기

카테고리 없음

[Hibernate] fail-fast

ValidatorImpl 에 아래와 같은 메서드이름이 있다.

패키지: org.hibernate.validator.internal.engine

shouldFailFast

public class ValidatorImpl implements Validator, ExecutableValidator {
	private boolean shouldFailFast(ValidationContext<?> validationContext) {
		return validationContext.isFailFastModeEnabled() && !validationContext.getFailingConstraints().isEmpty();
	}

@NotBlank

at jakarta.validation:jakarta.validation-api:2.0.2

ValueExtractorHelper

NotBlankValidator

at org.hibernate.validator:hibernate-validator:6.0.18.Final

public class NotBlankValidator implements ConstraintValidator<NotBlank, CharSequence> {
	@Override
	public boolean isValid(CharSequence charSequence, ConstraintValidatorContext constraintValidatorContext) {
		if ( charSequence == null ) {
			return false;
		}

		return charSequence.toString().trim().length() > 0;
	}
}