Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
  * JBoss, Home of Professional Open Source
  * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual contributors
  * by the @authors tag. See the copyright.txt in the distribution for a
  * full listing of individual contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 package org.hibernate.validator.internal.engine;
 
 import java.util.List;
 import java.util.Map;
 
 
 import static org.hibernate.validator.internal.util.CollectionHelper.newArrayList;

Factory returning initialized Validator instances. This is Hibernate Validator default implementation of the ValidatorFactory interface.

Author(s):
Emmanuel Bernard
Hardy Ferentschik
Gunnar Morling
Kevin Pollet <kevin.pollet@serli.com> (C) 2011 SERLI
 
 public class ValidatorFactoryImpl implements HibernateValidatorFactory {
 
 	private static final Log log = LoggerFactory.make();
 
 	private final boolean failFast;
 
 	public ValidatorFactoryImpl(ConfigurationState configurationState) {
 		this. = configurationState.getMessageInterpolator();
 		this. = configurationState.getTraversableResolver();
 		ConstraintHelper constraintHelper = new ConstraintHelper();
 
 		List<MetaDataProvidermetaDataProviders = newArrayList();
 
 		// HV-302; don't load XmlMappingParser if not necessary
 		if ( !configurationState.getMappingStreams().isEmpty() ) {
 			metaDataProviders.add(
 							constraintHelperconfigurationState.getMappingStreams()
 					)
 			);
 		}
 
 		Map<StringStringproperties = configurationState.getProperties();
 
 		boolean tmpFailFast = false;
 		if ( configurationState instanceof ConfigurationImpl ) {
 			ConfigurationImpl hibernateSpecificConfig = (ConfigurationImplconfigurationState;
 
 			if ( hibernateSpecificConfig.getProgrammaticMappings().size() > 0 ) {
 				metaDataProviders.add(
 								constraintHelper,
 								hibernateSpecificConfig.getProgrammaticMappings()
 						)
 				);
 			}
 			// check whether fail fast is programmatically enabled
 			tmpFailFast = hibernateSpecificConfig.getFailFast();
 		}
 		tmpFailFast = checkPropertiesForFailFast(
 				propertiestmpFailFast
 		);
 		this. = tmpFailFast;
 		 = new BeanMetaDataManagerconstraintHelpermetaDataProviders );
 	}
 
	public Validator getValidator() {
	}
	}
	}
	}
	public <T> T unwrap(Class<T> type) {
		if ( HibernateValidatorFactory.class.equalstype ) ) {
			return type.castthis );
		}
	}
		);
	}
	private boolean checkPropertiesForFailFast(Map<StringStringpropertiesboolean programmaticConfiguredFailFast) {
		boolean failFast = programmaticConfiguredFailFast;
		String failFastPropValue = properties.get. );
		if ( failFastPropValue != null ) {
			boolean tmpFailFast = Boolean.valueOffailFastPropValue );
			if ( programmaticConfiguredFailFast && !tmpFailFast ) {
			}
			failFast = tmpFailFast;
		}
		return failFast;
	}
New to GrepCode? Check out our FAQ X