org.hibernate.validator.internal.engine.PredefinedScopeConfigurationImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-validator Show documentation
Show all versions of hibernate-validator Show documentation
JPMS Module-Info's for a few of the Jakarta Libraries. These will be removed as time goes by
/*
* Hibernate Validator, declare and validate application constraints
*
* License: Apache License, Version 2.0
* See the license.txt file in the root directory or .
*/
package org.hibernate.validator.internal.engine;
import static org.hibernate.validator.internal.util.logging.Messages.MESSAGES;
import java.util.Collections;
import java.util.Locale;
import java.util.Set;
import jakarta.validation.spi.BootstrapState;
import jakarta.validation.spi.ConfigurationState;
import jakarta.validation.spi.ValidationProvider;
import org.hibernate.validator.PredefinedScopeHibernateValidatorConfiguration;
import org.hibernate.validator.internal.util.CollectionHelper;
import org.hibernate.validator.internal.util.Contracts;
/**
* @author Guillaume Smet
*/
public class PredefinedScopeConfigurationImpl extends AbstractConfigurationImpl
implements PredefinedScopeHibernateValidatorConfiguration, ConfigurationState {
private Set builtinConstraints = Collections.emptySet();
private Set> beanClassesToInitialize;
public PredefinedScopeConfigurationImpl(BootstrapState state) {
super( state );
}
public PredefinedScopeConfigurationImpl(ValidationProvider> validationProvider) {
super( validationProvider );
}
@Override
public PredefinedScopeHibernateValidatorConfiguration builtinConstraints(Set constraints) {
this.builtinConstraints = CollectionHelper.toImmutableSet( constraints );
return thisAsT();
}
@Override
public PredefinedScopeHibernateValidatorConfiguration initializeBeanMetaData(Set> beanMetaDataToInitialize) {
beanClassesToInitialize = CollectionHelper.toImmutableSet( beanMetaDataToInitialize );
return thisAsT();
}
public Set getBuiltinConstraints() {
return builtinConstraints;
}
public Set> getBeanClassesToInitialize() {
return beanClassesToInitialize;
}
@Override
public PredefinedScopeHibernateValidatorConfiguration initializeLocales(Set localesToInitialize) {
Contracts.assertNotNull( localesToInitialize, MESSAGES.parameterMustNotBeNull( "localesToInitialize" ) );
locales( localesToInitialize );
return thisAsT();
}
@Override
protected boolean preloadResourceBundles() {
return true;
}
}