private <T> boolean mainConstraintNeedsEvaluation(ValidationContext<T> executionContext, Set<ConstraintViolation<T>> constraintViolations) { // we are dealing with a composing constraint with no validator for the main constraint if ( !descriptor.getComposingConstraints().isEmpty() && descriptor.getMatchingConstraintValidatorClasses() .isEmpty() ) { return false; } // report as single violation and there is already a violation if ( descriptor.isReportAsSingleViolation() && descriptor.getCompositionType() == AND && !constraintViolations.isEmpty() ) { return false; } // explicit fail fast mode if ( executionContext.isFailFastModeEnabled() && !constraintViolations.isEmpty() ) { return false; } return true; }
/** * @return {@code} true if the current constraint should be reported as single violation, {@code false otherwise}. * When using negation, we only report the single top-level violation, as * it is hard, especially for ALL_FALSE to give meaningful reports */ private boolean reportAsSingleViolation() { return getDescriptor().isReportAsSingleViolation() || getDescriptor().getCompositionType() == ALL_FALSE; }
private <T> boolean mainConstraintNeedsEvaluation(ValidationContext<T> executionContext, Set<ConstraintViolation<T>> constraintViolations) { // we are dealing with a composing constraint with no validator for the main constraint if ( !descriptor.getComposingConstraints().isEmpty() && descriptor.getMatchingConstraintValidatorDescriptors().isEmpty() ) { return false; } if ( constraintViolations.isEmpty() ) { return true; } // report as single violation and there is already a violation if ( descriptor.isReportAsSingleViolation() && descriptor.getCompositionType() == AND ) { return false; } // explicit fail fast mode if ( executionContext.isFailFastModeEnabled() ) { return false; } return true; }
/** * @return {@code} true if the current constraint should be reported as single violation, {@code false otherwise}. * When using negation, we only report the single top-level violation, as * it is hard, especially for ALL_FALSE to give meaningful reports */ private boolean reportAsSingleViolation() { return getDescriptor().isReportAsSingleViolation() || getDescriptor().getCompositionType() == ALL_FALSE; }
compositionResult.setAllTrue( false ); if ( descriptor.getCompositionType() == AND && ( executionContext.isFailFastModeEnabled() || descriptor.isReportAsSingleViolation() ) ) { break;
compositionResult.setAllTrue( false ); if ( descriptor.getCompositionType() == AND && ( executionContext.isFailFastModeEnabled() || descriptor.isReportAsSingleViolation() ) ) { break;