@Override public final ConfigurationImpl messageInterpolator(MessageInterpolator interpolator) { if ( LOG.isDebugEnabled() ) { if ( interpolator != null ) { LOG.debug( "Setting custom MessageInterpolator of type " + interpolator.getClass().getName() ); } } this.validationBootstrapParameters.setMessageInterpolator( interpolator ); return this; }
@Override public HibernateValidatorConfiguration clockProvider(ClockProvider clockProvider) { if ( LOG.isDebugEnabled() ) { if ( clockProvider != null ) { LOG.debug( "Setting custom ClockProvider of type " + clockProvider.getClass().getName() ); } } this.validationBootstrapParameters.setClockProvider( clockProvider ); return this; }
@Override public final ConfigurationImpl constraintValidatorFactory(ConstraintValidatorFactory constraintValidatorFactory) { if ( log.isDebugEnabled() ) { if ( constraintValidatorFactory != null ) { log.debug( "Setting custom ConstraintValidatorFactory of type " + constraintValidatorFactory.getClass() .getName() ); } } this.validationBootstrapParameters.setConstraintValidatorFactory( constraintValidatorFactory ); return this; }
@Override public final ConfigurationImpl constraintValidatorFactory(ConstraintValidatorFactory constraintValidatorFactory) { if ( LOG.isDebugEnabled() ) { if ( constraintValidatorFactory != null ) { LOG.debug( "Setting custom ConstraintValidatorFactory of type " + constraintValidatorFactory.getClass() .getName() ); } } this.validationBootstrapParameters.setConstraintValidatorFactory( constraintValidatorFactory ); return this; }
@Override public HibernateValidatorConfiguration parameterNameProvider(ParameterNameProvider parameterNameProvider) { if ( LOG.isDebugEnabled() ) { if ( parameterNameProvider != null ) { LOG.debug( "Setting custom ParameterNameProvider of type " + parameterNameProvider.getClass() .getName() ); } } this.validationBootstrapParameters.setParameterNameProvider( parameterNameProvider ); return this; }
@Override public final ConfigurationImpl traversableResolver(TraversableResolver resolver) { if ( LOG.isDebugEnabled() ) { if ( resolver != null ) { LOG.debug( "Setting custom TraversableResolver of type " + resolver.getClass().getName() ); } } this.validationBootstrapParameters.setTraversableResolver( resolver ); return this; }
@Override public HibernateValidatorConfiguration parameterNameProvider(ParameterNameProvider parameterNameProvider) { if ( log.isDebugEnabled() ) { if ( parameterNameProvider != null ) { log.debug( "Setting custom ParameterNameProvider of type " + parameterNameProvider.getClass() .getName() ); } } this.validationBootstrapParameters.setParameterNameProvider( parameterNameProvider ); return this; }
@Override public final ConfigurationImpl messageInterpolator(MessageInterpolator interpolator) { if ( log.isDebugEnabled() ) { if ( interpolator != null ) { log.debug( "Setting custom MessageInterpolator of type " + interpolator.getClass().getName() ); } } this.validationBootstrapParameters.setMessageInterpolator( interpolator ); return this; }
@Override public final ConfigurationImpl traversableResolver(TraversableResolver resolver) { if ( log.isDebugEnabled() ) { if ( resolver != null ) { log.debug( "Setting custom TraversableResolver of type " + resolver.getClass().getName() ); } } this.validationBootstrapParameters.setTraversableResolver( resolver ); return this; }
@Override public boolean areClassLevelConstraintsIgnoredFor(Class<?> clazz) { boolean ignoreAnnotation; if ( annotationIgnoresForClasses.containsKey( clazz ) ) { ignoreAnnotation = annotationIgnoresForClasses.get( clazz ); } else { ignoreAnnotation = areAllConstraintAnnotationsIgnoredFor( clazz ); } if ( LOG.isDebugEnabled() && ignoreAnnotation ) { LOG.debugf( "Class level annotation are getting ignored for %s.", clazz.getName() ); } return ignoreAnnotation; }
@Override public boolean areClassLevelConstraintsIgnoredFor(Class<?> clazz) { boolean ignoreAnnotation; if ( annotationIgnoresForClasses.containsKey( clazz ) ) { ignoreAnnotation = annotationIgnoresForClasses.get( clazz ); } else { ignoreAnnotation = areAllConstraintAnnotationsIgnoredFor( clazz ); } if ( log.isDebugEnabled() && ignoreAnnotation ) { log.debugf( "Class level annotation are getting ignored for %s.", clazz.getName() ); } return ignoreAnnotation; }
@Override protected void add(XMLEventReader xmlEventReader, XMLEvent xmlEvent) throws XMLStreamException { StartElement startElement = xmlEvent.asStartElement(); String name = readAttribute( startElement, NAME_QNAME ).get(); String value = readSingleElement( xmlEventReader ); if ( LOG.isDebugEnabled() ) { LOG.debugf( "Found property '%s' with value '%s' in validation.xml.", name, value ); } properties.put( name, value ); }
private CompositionType parseCompositionType(ConstraintHelper constraintHelper) { for ( Annotation declaredAnnotation : annotationDescriptor.getType().getDeclaredAnnotations() ) { Class<? extends Annotation> declaredAnnotationType = declaredAnnotation.annotationType(); if ( NON_COMPOSING_CONSTRAINT_ANNOTATIONS.contains( declaredAnnotationType.getName() ) ) { // ignore the usual suspects which will be in almost any constraint, but are no composing constraint continue; } if ( constraintHelper.isConstraintComposition( declaredAnnotationType ) ) { if ( LOG.isDebugEnabled() ) { LOG.debugf( "Adding Bool %s.", declaredAnnotationType.getName() ); } return ( (ConstraintComposition) declaredAnnotation ).value(); } } return CompositionType.AND; }
private CompositionType parseCompositionType(ConstraintHelper constraintHelper) { for ( Annotation declaredAnnotation : annotationType.getDeclaredAnnotations() ) { Class<? extends Annotation> declaredAnnotationType = declaredAnnotation.annotationType(); if ( NON_COMPOSING_CONSTRAINT_ANNOTATIONS.contains( declaredAnnotationType.getName() ) ) { // ignore the usual suspects which will be in almost any constraint, but are no composing constraint continue; } if ( constraintHelper.isConstraintComposition( declaredAnnotationType ) ) { if ( log.isDebugEnabled() ) { log.debugf( "Adding Bool %s.", declaredAnnotationType.getName() ); } return ( (ConstraintComposition) declaredAnnotation ).value(); } } return CompositionType.AND; }
@Override public HibernateValidatorConfiguration addValueExtractor(ValueExtractor<?> extractor) { Contracts.assertNotNull( extractor, MESSAGES.parameterMustNotBeNull( "extractor" ) ); ValueExtractorDescriptor descriptor = new ValueExtractorDescriptor( extractor ); ValueExtractorDescriptor previous = valueExtractorDescriptors.put( descriptor.getKey(), descriptor ); if ( previous != null ) { throw LOG.getValueExtractorForTypeAndTypeUseAlreadyPresentException( extractor, previous.getValueExtractor() ); } if ( LOG.isDebugEnabled() ) { LOG.debug( "Adding value extractor " + extractor ); } return this; }
private BootstrapConfiguration createBootstrapConfiguration(ValidationConfigType config) { Map<String, String> properties = new HashMap<String, String>(); for ( PropertyType property : config.getProperty() ) { if ( log.isDebugEnabled() ) { log.debugf( "Found property '%s' with value '%s' in validation.xml.", property.getName(), property.getValue() ); } properties.put( property.getName(), property.getValue() ); } ExecutableValidationType executableValidationType = config.getExecutableValidation(); EnumSet<ExecutableType> defaultValidatedExecutableTypes = executableValidationType == null ? getValidatedExecutableTypes( null ) : getValidatedExecutableTypes( executableValidationType.getDefaultValidatedExecutableTypes() ); boolean executableValidationEnabled = executableValidationType == null || executableValidationType.getEnabled(); return new BootstrapConfigurationImpl( config.getDefaultProvider(), config.getConstraintValidatorFactory(), config.getMessageInterpolator(), config.getTraversableResolver(), config.getParameterNameProvider(), defaultValidatedExecutableTypes, executableValidationEnabled, new HashSet<String>( config.getConstraintMapping() ), properties ); }
if ( LOG.isDebugEnabled() ) { logValidatorFactoryScopedConfiguration( validatorFactoryScopedContext );