Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * JBoss, Home of Professional Open Source
  * Copyright 2011, 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
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.
 package org.hibernate.validator.ap.util;
 import java.util.Map;
Provides access to the processor options supported by the Hibernate Validator annotation processor.

Gunnar Morling
 public class Configuration {

The name of the processor option for setting the diagnostic kind to be used when reporting errors during annotation processing.
 	public static final String DIAGNOSTIC_KIND_PROCESSOR_OPTION = "diagnosticKind";

The name of the processor option for activating verbose message reporting.
 	public static final String VERBOSE_PROCESSOR_OPTION = "verbose";

The name of the processor option for allowing constraints at methods other than getter methods.
 	public static final String METHOD_CONSTRAINTS_SUPPORTED_PROCESSOR_OPTION = "methodConstraintsSupported";

The diagnostic kind to be used if no or an invalid kind is given as processor option.
 	public static final Kind DEFAULT_DIAGNOSTIC_KIND = .;
 	private final Kind diagnosticKind;
 	private final boolean verbose;
 	private final boolean methodConstraintsSupported;
 	public Configuration(Map<StringStringoptionsMessager messager) {
 		this. = getDiagnosticKindOptionoptionsmessager );
 		this. = getVerboseOptionoptionsmessager );

Returns the diagnosticKind to be used when reporting failing constraint checks.
 	public Kind getDiagnosticKind() {
 		return ;

Whether logging information shall be put out in a verbose way or not.
 	public boolean isVerbose() {
 		return ;

Whether method constraints are allowed at any method (true) or only getter methods (false).
 	public boolean methodConstraintsSupported() {

Retrieves the diagnostic kind to be used for error messages. If given in processor options, it will be taken from there, otherwise the default value will be returned.
 	private Kind getDiagnosticKindOption(Map<StringStringoptionsMessager messager) {
 		String diagnosticKindFromOptions = options.get );
 		if ( diagnosticKindFromOptions != null ) {
 			try {
				return Kind.valueOfdiagnosticKindFromOptions );
			catch ( IllegalArgumentException e ) {
						., MessageFormat.format(
						"The given value {0} is no valid diagnostic kind. {1} will be used.",

Retrieves the value for the "verbose" property from the options.
	private boolean getVerboseOption(Map<StringStringoptionsMessager messager) {
		boolean theValue = Boolean.parseBooleanoptions.get ) );
		if ( theValue ) {
					., MessageFormat.format(
					"Verbose reporting is activated. Some processing information will be displayed using diagnostic kind {0}.",
		return theValue;

Retrieves the value for the "methodConstraintsSupported" property from the options.
	private boolean getMethodConstraintsSupportedOption(Map<StringStringoptions) {
		String methodConstraintsSupported = options.get );
		//allow method constraints by default
		if ( methodConstraintsSupported == null ) {
			return true;
		return Boolean.parseBooleanmethodConstraintsSupported );
New to GrepCode? Check out our FAQ X