Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
  * JBoss, Home of Professional Open Source
  * Copyright 2009, 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.metadata.core;
 
 import java.util.List;
 import java.util.Map;
 
 
 import static org.hibernate.validator.internal.util.CollectionHelper.newHashMap;

An AnnotationProcessingOptions instance keeps track of annotations which should be ignored as configuration source. The main validation source for Bean Validation is annotation and alternate configuration sources use this class to override/ignore existing annotations.

Author(s):
Hardy Ferentschik
 
 public class AnnotationProcessingOptions {
 
 	private static final Log log = LoggerFactory.make();

Keeps track whether the 'ignore-annotations' flag is set on bean level in the xml configuration. If 'ignore-annotations' is not specified true is the default.
 
 	private final Map<Class<?>, BooleanignoreAnnotationDefaults = newHashMap();

Keeps track of explicitly excluded members (fields and properties) for a given class. If a member appears in the list mapped to a given class 'ignore-annotations' was explicitly set to true in the configuration for this class.
 
Keeps track of explicitly excluded class level constraints.
 
 
 	public void ignoreAnnotationConstraintForClass(Class<?> clazzBoolean b) {
 		if ( b == null ) {
 		}
 		else {
 			.putclazzb );
 		}
 	}
 
 	public boolean areConstraintAnnotationsIgnored(Class<?> clazz) {
 	}
 
 		Class<?> beanClass = member.getDeclaringClass();
 		if ( .getbeanClass ) == null ) {
 			List<MembertmpList = new ArrayList<Member>();
 			tmpList.addmember );
 			.putbeanClasstmpList );
 		}
 		else {
 			.getbeanClass ).addmember );
 		}
 	}
 
 		boolean ignoreAnnotation;
 		Class<?> clazz = member.getDeclaringClass();
 		List<MemberignoreAnnotationForMembers = .getclazz );
 		if ( ignoreAnnotationForMembers == null || !ignoreAnnotationForMembers.containsmember ) ) {
 			ignoreAnnotation = areConstraintAnnotationsIgnoredclazz );
 		}
 		else {
 			ignoreAnnotation = ignoreAnnotationForMembers.containsmember );
 		}
 		if ( ignoreAnnotation ) {
 			logMessagememberclazz );
 		}
 		return ignoreAnnotation;
 	}
 
	public void ignoreClassLevelConstraintAnnotations(Class<?> clazzboolean b) {
	}
	public boolean areClassLevelConstraintAnnotationsIgnored(Class<?> clazz) {
		boolean ignoreAnnotation;
			ignoreAnnotation = .getclazz );
		}
		else {
			ignoreAnnotation = areConstraintAnnotationsIgnoredclazz );
		}
		if ( .isDebugEnabled() && ignoreAnnotation ) {
			.debugf"Class level annotation are getting ignored for %s."clazz.getName() );
		}
		return ignoreAnnotation;
	}
	public void merge(AnnotationProcessingOptions annotationProcessingOptions) {
		this..putAllannotationProcessingOptions.ignoreAnnotationDefaults );
				.putAllannotationProcessingOptions.propertyConstraintAnnotationIgnores );
				.putAllannotationProcessingOptions.classConstraintAnnotationIgnores );
	}
	private void logMessage(Member memberClass<?> clazz) {
		if ( .isDebugEnabled() ) {
			String type;
			if ( member instanceof Field ) {
				type = "Field";
			}
			else {
				type = "Property";
			}
					"%s level annotations are getting ignored for %s.%s.",
					type,
					clazz.getName(),
					member.getName()
			);
		}
	}
New to GrepCode? Check out our FAQ X