[SCM] Hibernate Validator branch, upstream, updated. upstream/4.0.2.GA-1-g3c8f948

Miguel Landaeta miguel at miguel.cc
Wed Oct 12 19:10:00 UTC 2011


The following commit has been merged in the upstream branch:
commit 3c8f9485b5ce9500f66360cd4fdb368f83a8adec
Author: Miguel Landaeta <miguel at miguel.cc>
Date:   Wed Oct 12 14:34:38 2011 -0430

    import upstream version 4.1.0.Final

diff --git a/hibernate-validator-annotation-processor/pom.xml b/hibernate-validator-annotation-processor/pom.xml
new file mode 100644
index 0000000..6f2fdef
--- /dev/null
+++ b/hibernate-validator-annotation-processor/pom.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <artifactId>hibernate-validator-parent</artifactId>
+        <groupId>org.hibernate</groupId>
+        <version>4.1.0.Final</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <groupId>org.hibernate</groupId>
+    <artifactId>hibernate-validator-annotation-processor</artifactId>
+    <name>Hibernate Validator Annotation Processor</name>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <compilerArgument>-proc:none</compilerArgument>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copy</id>
+                        <phase>generate-test-sources</phase>
+                        <goals>
+                            <goal>copy</goal>
+                        </goals>
+                        <configuration>
+                            <stripVersion>true</stripVersion>
+                            <artifactItems>
+                                <artifactItem>
+                                    <groupId>javax.validation</groupId>
+                                    <artifactId>validation-api</artifactId>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${project.build.directory}/lib</outputDirectory>
+                                </artifactItem>
+                            </artifactItems>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <systemProperties>
+                        <property>
+                            <name>testSourceBaseDir</name>
+                            <value>${basedir}/src/test/java</value>
+                        </property>
+                        <!-- 
+                        	Used to specify the class path for the JavaCompiler in tests. For some reason 
+							this is not required within eclipse. The JavaCompiler there has access to all dependencies
+							of the program by default.
+							TODO GM: find a better way to solve this issue
+						 -->
+                        <property>
+                            <name>pathToBeanValidationApiJar</name>
+                            <value>${project.build.directory}/lib/validation-api.jar</value>
+                        </property>
+                    </systemProperties>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+    <dependencies>
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-validator</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+            <classifier>jdk15</classifier>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/ConstraintAnnotationVisitor.java b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/ConstraintAnnotationVisitor.java
new file mode 100644
index 0000000..40db754
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/ConstraintAnnotationVisitor.java
@@ -0,0 +1,224 @@
+// $Id: ConstraintAnnotationVisitor.java 19524 2010-05-15 15:50:33Z gunnar.morling $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap;
+
+import java.util.List;
+import java.util.Set;
+import javax.annotation.processing.Messager;
+import javax.annotation.processing.ProcessingEnvironment;
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementVisitor;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.VariableElement;
+import javax.lang.model.util.ElementKindVisitor6;
+import javax.tools.Diagnostic.Kind;
+
+import org.hibernate.validator.ap.checks.ConstraintCheck;
+import org.hibernate.validator.ap.checks.ConstraintCheckError;
+import org.hibernate.validator.ap.checks.ConstraintCheckFactory;
+import org.hibernate.validator.ap.checks.ConstraintChecks;
+import org.hibernate.validator.ap.util.AnnotationApiHelper;
+import org.hibernate.validator.ap.util.ConstraintHelper;
+import org.hibernate.validator.ap.util.MessagerAdapter;
+
+/**
+ * An {@link ElementVisitor} that visits annotated elements (type declarations,
+ * methods and fields) and applies different {@link ConstraintCheck}s to them.
+ * Each {@link ConstraintCheckError} occurred will be reported using the
+ * {@link Messager} API.
+ *
+ * @author Gunnar Morling.
+ */
+final class ConstraintAnnotationVisitor extends ElementKindVisitor6<Void, List<AnnotationMirror>> {
+
+	private final MessagerAdapter messager;
+
+	private final ConstraintCheckFactory constraintCheckFactory;
+
+	private final boolean verbose;
+
+	public ConstraintAnnotationVisitor(
+			ProcessingEnvironment processingEnvironment, MessagerAdapter messager, boolean verbose) {
+
+		this.messager = messager;
+		this.verbose = verbose;
+
+		AnnotationApiHelper annotationApiHelper = new AnnotationApiHelper(
+				processingEnvironment.getElementUtils(), processingEnvironment.getTypeUtils()
+		);
+
+		ConstraintHelper constraintHelper = new ConstraintHelper(
+				processingEnvironment.getElementUtils(), processingEnvironment.getTypeUtils(), annotationApiHelper
+		);
+
+		constraintCheckFactory = new ConstraintCheckFactory( constraintHelper );
+	}
+
+	/**
+	 * <p>
+	 * Checks whether the given annotations are correctly specified at the given
+	 * method. The following checks are performed:
+	 * </p>
+	 * <ul>
+	 * <li>
+	 * Constraint annotations may only be given at non-static, JavaBeans getter
+	 * methods which's return type is supported by the constraints.</li>
+	 * <li>
+	 * The <code>@Valid</code> annotation may only be given at non-static,
+	 * non-primitive JavaBeans getter methods.</li>
+	 * </ul>
+	 */
+	@Override
+	public Void visitExecutableAsMethod(ExecutableElement method,
+										List<AnnotationMirror> mirrors) {
+
+		checkConstraints( method, mirrors );
+
+		return null;
+	}
+
+	/**
+	 * <p>
+	 * Checks whether the given annotations are correctly specified at the given
+	 * field. The following checks are performed:
+	 * </p>
+	 * <ul>
+	 * <li>
+	 * Constraint annotations may only be given at non-static fields which's
+	 * type is supported by the constraints.</li>
+	 * <li>
+	 * The <code>@Valid</code> annotation may only be given at non-static,
+	 * non-primitive fields.</li>
+	 * </ul>
+	 */
+	@Override
+	public Void visitVariableAsField(VariableElement annotatedField, List<AnnotationMirror> mirrors) {
+
+		checkConstraints( annotatedField, mirrors );
+
+		return null;
+	}
+
+	/**
+	 * <p>
+	 * Checks whether the given annotations are correctly specified at the given
+	 * annotation type declaration. The following checks are performed:
+	 * </p>
+	 * <ul>
+	 * <li>
+	 * The only annotation types allowed to be annotated with other constraint
+	 * annotations are composed constraint annotation type declarations.</li>
+	 * </ul>
+	 */
+	@Override
+	public Void visitTypeAsAnnotationType(TypeElement annotationType,
+										  List<AnnotationMirror> mirrors) {
+
+		checkConstraints( annotationType, mirrors );
+
+		return null;
+	}
+
+	/**
+	 * <p>
+	 * Checks whether the given annotations are correctly specified at the given
+	 * class type declaration. The following checks are performed:
+	 * </p>
+	 * <ul>
+	 * <li>
+	 * Constraint annotations may at types supported by the constraints.</li>
+	 * <li>
+	 * </ul>
+	 */
+	@Override
+	public Void visitTypeAsClass(TypeElement e, List<AnnotationMirror> p) {
+
+		checkConstraints( e, p );
+		return null;
+	}
+
+	/**
+	 * <p>
+	 * Checks whether the given annotations are correctly specified at the given
+	 * enum type declaration. The following checks are performed:
+	 * </p>
+	 * <ul>
+	 * <li>
+	 * Constraint annotations may at types supported by the constraints.</li>
+	 * <li>
+	 * </ul>
+	 */
+	@Override
+	public Void visitTypeAsEnum(TypeElement e, List<AnnotationMirror> p) {
+
+		checkConstraints( e, p );
+		return null;
+	}
+
+	/**
+	 * <p>
+	 * Checks whether the given annotations are correctly specified at the given
+	 * interface type declaration. The following checks are performed:
+	 * </p>
+	 * <ul>
+	 * <li>
+	 * Constraint annotations may at types supported by the constraints.</li>
+	 * <li>
+	 * </ul>
+	 */
+	@Override
+	public Void visitTypeAsInterface(TypeElement e, List<AnnotationMirror> p) {
+
+		checkConstraints( e, p );
+		return null;
+	}
+
+	/**
+	 * Retrieves the checks required for the given element and annotations,
+	 * executes them and reports all occurred errors.
+	 *
+	 * @param annotatedElement The element to check.
+	 * @param mirrors The annotations to check.
+	 */
+	private void checkConstraints(Element annotatedElement, List<AnnotationMirror> mirrors) {
+
+		for ( AnnotationMirror oneAnnotationMirror : mirrors ) {
+
+			try {
+
+				ConstraintChecks constraintChecks = constraintCheckFactory.getConstraintChecks(
+						annotatedElement, oneAnnotationMirror
+				);
+				Set<ConstraintCheckError> errors = constraintChecks.execute( annotatedElement, oneAnnotationMirror );
+				messager.reportErrors( errors );
+			}
+			//HV-293: if single constraints can't be properly checked, report this and
+			//proceed with next constraints
+			catch ( Exception e ) {
+
+				if ( verbose ) {
+					messager.getDelegate()
+							.printMessage( Kind.NOTE, e.getMessage(), annotatedElement, oneAnnotationMirror );
+				}
+			}
+		}
+	}
+
+}
diff --git a/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/ConstraintValidationProcessor.java b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/ConstraintValidationProcessor.java
new file mode 100644
index 0000000..38f6a36
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/ConstraintValidationProcessor.java
@@ -0,0 +1,182 @@
+// $Id: ConstraintValidationProcessor.java 19524 2010-05-15 15:50:33Z gunnar.morling $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap;
+
+import java.text.MessageFormat;
+import java.util.List;
+import java.util.Set;
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.ProcessingEnvironment;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.annotation.processing.SupportedOptions;
+import javax.annotation.processing.SupportedSourceVersion;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementVisitor;
+import javax.lang.model.element.TypeElement;
+import javax.tools.Diagnostic.Kind;
+
+import org.hibernate.validator.ap.util.AnnotationApiHelper;
+import org.hibernate.validator.ap.util.MessagerAdapter;
+
+/**
+ * An annotation processor for checking <a
+ * href="http://jcp.org/en/jsr/detail?id=303">Bean Validation</a> constraints.
+ * The processor supports the following options:
+ * <ul>
+ * <li><code>diagnosticKind</code>: the severity with which any occurred problems
+ * shall be reported. Must be given in form of the string representation of a
+ * value from {@link javax.tools.Diagnostic.Kind}, e.g.
+ * "diagnosticKind=WARNING". Default is Kind.ERROR.</li>
+ * <li>TODO GM: validationMode: whether spec compliance shall be checked
+ * strictly or loosely (e.g. by allowing validators for parametrized types)</li>
+ * </ul>
+ *
+ * @author Hardy Ferentschik
+ * @author Gunnar Morling
+ */
+ at SupportedAnnotationTypes("*")
+ at SupportedSourceVersion(SourceVersion.RELEASE_6)
+ at SupportedOptions({
+		ConstraintValidationProcessor.DIAGNOSTIC_KIND_PROCESSOR_OPTION_NAME,
+		ConstraintValidationProcessor.VERBOSE_PROCESSOR_OPTION_NAME
+})
+public class ConstraintValidationProcessor extends AbstractProcessor {
+
+	/**
+	 * The name of the processor option for setting the diagnostic kind to be
+	 * used when reporting errors during annotation processing.
+	 */
+	public final static String DIAGNOSTIC_KIND_PROCESSOR_OPTION_NAME = "diagnosticKind";
+
+	/**
+	 * The name of the processor option for activating verbose message reporting.
+	 */
+	public final static String VERBOSE_PROCESSOR_OPTION_NAME = "verbose";
+
+	/**
+	 * The diagnostic kind to be used if no or an invalid kind is given as processor option.
+	 */
+	public final static Kind DEFAULT_DIAGNOSTIC_KIND = Kind.ERROR;
+	/**
+	 * Whether this processor claims all processed annotations exclusively or not.
+	 */
+	private static final boolean ANNOTATIONS_CLAIMED_EXCLUSIVELY = false;
+
+	/**
+	 * The messager to be used for error reports.
+	 */
+	private MessagerAdapter messager;
+
+	/**
+	 * Whether logging information shall be put out in a verbose way or not.
+	 */
+	private boolean verbose;
+
+	@Override
+	public synchronized void init(ProcessingEnvironment processingEnv) {
+
+		super.init( processingEnv );
+
+		this.verbose = isVerbose();
+		messager = new MessagerAdapter( processingEnv.getMessager(), getDiagnosticKind() );
+	}
+
+	@Override
+	public boolean process(
+			final Set<? extends TypeElement> annotations,
+			final RoundEnvironment roundEnvironment) {
+
+		AnnotationApiHelper typeHelper = new AnnotationApiHelper(
+				processingEnv.getElementUtils(), processingEnv.getTypeUtils()
+		);
+
+		ElementVisitor<Void, List<AnnotationMirror>> visitor = new ConstraintAnnotationVisitor(
+				processingEnv, messager, verbose
+		);
+
+		for ( TypeElement oneAnnotation : annotations ) {
+
+			Set<? extends Element> elementsWithConstraintAnnotation =
+					roundEnvironment.getElementsAnnotatedWith( oneAnnotation );
+
+			for ( Element oneAnnotatedElement : elementsWithConstraintAnnotation ) {
+
+				List<AnnotationMirror> mirrorsOfCurrentAnnotation =
+						typeHelper.filterByType( oneAnnotatedElement.getAnnotationMirrors(), oneAnnotation.asType() );
+
+				oneAnnotatedElement.accept( visitor, mirrorsOfCurrentAnnotation );
+			}
+		}
+
+		return ANNOTATIONS_CLAIMED_EXCLUSIVELY;
+	}
+
+	/**
+	 * 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 Kind.ERROR will be returned.
+	 *
+	 * @return The diagnostic kind to be used for error messages.
+	 */
+	private Kind getDiagnosticKind() {
+
+		String diagnosticKindFromOptions = processingEnv.getOptions()
+				.get( DIAGNOSTIC_KIND_PROCESSOR_OPTION_NAME );
+
+		if ( diagnosticKindFromOptions != null ) {
+			try {
+				return Kind.valueOf( diagnosticKindFromOptions );
+			}
+			catch ( IllegalArgumentException e ) {
+				super.processingEnv.getMessager().printMessage(
+						Kind.WARNING, MessageFormat.format(
+								"The given value {0} is no valid diagnostic kind. {1} will be used.",
+								diagnosticKindFromOptions,
+								DEFAULT_DIAGNOSTIC_KIND
+						)
+				);
+			}
+		}
+
+		return DEFAULT_DIAGNOSTIC_KIND;
+	}
+
+	/**
+	 * Retrieves the value for the "verbose" property from the options.
+	 *
+	 * @return The value for the "verbose" property.
+	 */
+	private boolean isVerbose() {
+
+		boolean theValue = Boolean.parseBoolean( processingEnv.getOptions().get( VERBOSE_PROCESSOR_OPTION_NAME ) );
+
+		if ( theValue ) {
+			super.processingEnv.getMessager().printMessage(
+					Kind.NOTE, MessageFormat.format(
+							"Verbose reporting is activated. Some processing information will be displayed using diagnostic kind {0}.",
+							Kind.NOTE
+					)
+			);
+		}
+
+		return theValue;
+	}
+
+}
diff --git a/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/AbstractConstraintCheck.java b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/AbstractConstraintCheck.java
new file mode 100644
index 0000000..e7e0951
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/AbstractConstraintCheck.java
@@ -0,0 +1,67 @@
+// $Id: AbstractConstraintCheck.java 19310 2010-04-27 22:51:17Z gunnar.morling $
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, 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.ap.checks;
+
+import java.util.Collections;
+import java.util.Set;
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.VariableElement;
+
+/**
+ * <p>
+ * Abstract base class for {@link ConstraintCheck} implementations. Concrete
+ * checks should only override those check methods applicable for their
+ * supported element types.
+ * </p>
+ * <p>
+ * For instance would a check ensuring that constraint annotations are only
+ * given at non-static fields or methods only override <code>checkField()</code>
+ * and <code>checkMethod()</code>.
+ * </p>
+ * <p>
+ * All check methods not overridden will return an empty list.
+ * </p>
+ *
+ * @author Gunnar Morling
+ */
+public class AbstractConstraintCheck implements ConstraintCheck {
+
+	public Set<ConstraintCheckError> checkField(VariableElement element, AnnotationMirror annotation) {
+
+		return Collections.emptySet();
+	}
+
+	public Set<ConstraintCheckError> checkMethod(ExecutableElement element, AnnotationMirror annotation) {
+
+		return Collections.emptySet();
+	}
+
+	public Set<ConstraintCheckError> checkAnnotationType(TypeElement element,
+														 AnnotationMirror annotation) {
+
+		return Collections.emptySet();
+	}
+
+	public Set<ConstraintCheckError> checkNonAnnotationType(
+			TypeElement element, AnnotationMirror annotation) {
+
+		return Collections.emptySet();
+	}
+}
diff --git a/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/AnnotationTypeCheck.java b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/AnnotationTypeCheck.java
new file mode 100644
index 0000000..bfab0ad
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/AnnotationTypeCheck.java
@@ -0,0 +1,60 @@
+// $Id: AnnotationTypeCheck.java 19310 2010-04-27 22:51:17Z gunnar.morling $
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, 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.ap.checks;
+
+import java.util.Collections;
+import java.util.Set;
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.TypeElement;
+
+import org.hibernate.validator.ap.util.CollectionHelper;
+import org.hibernate.validator.ap.util.ConstraintHelper;
+
+/**
+ * Checks, that only constraint annotation types are annotated with other
+ * constraint annotations ("constraint composition"), but not non-constraint
+ * annotations.
+ *
+ * @author Gunnar Morling
+ */
+public class AnnotationTypeCheck extends AbstractConstraintCheck {
+
+	private final ConstraintHelper constraintHelper;
+
+	public AnnotationTypeCheck(ConstraintHelper constraintHelper) {
+		this.constraintHelper = constraintHelper;
+	}
+
+	@Override
+	public Set<ConstraintCheckError> checkAnnotationType(TypeElement element,
+														 AnnotationMirror annotation) {
+
+		if ( !constraintHelper.isConstraintAnnotation( element ) ) {
+
+			return CollectionHelper.asSet(
+					new ConstraintCheckError(
+							element, annotation, "ONLY_CONSTRAINT_ANNOTATIONS_MAY_BE_ANNOTATED"
+					)
+			);
+		}
+
+		return Collections.emptySet();
+	}
+
+
+}
diff --git a/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/ConstraintCheck.java b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/ConstraintCheck.java
new file mode 100644
index 0000000..9ffea67
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/ConstraintCheck.java
@@ -0,0 +1,99 @@
+// $Id: ConstraintCheck.java 19310 2010-04-27 22:51:17Z gunnar.morling $
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, 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.ap.checks;
+
+import java.util.Set;
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.VariableElement;
+
+/**
+ * <p>
+ * Implementations represent checks, which determine whether a given constraint
+ * annotation is allowed at a given element.
+ * </p>
+ * <p>
+ * Implementations should be derived from {@link AbstractConstraintCheck} in
+ * order to implement only those check methods applicable for the element kinds
+ * supported by the check.
+ * </p>
+ *
+ * @author Gunnar Morling
+ */
+public interface ConstraintCheck {
+
+	/**
+	 * Checks, whether the given annotation is allowed at the given field.
+	 *
+	 * @param element An annotated field.
+	 * @param annotation An annotation at that field.
+	 *
+	 * @return A set with errors, that describe, why the given annotation is
+	 *         not allowed at the given element. In case no errors occur (the
+	 *         given annotation is allowed at the given element), an empty set
+	 *         must be returned.
+	 */
+	Set<ConstraintCheckError> checkField(VariableElement element,
+										 AnnotationMirror annotation);
+
+	/**
+	 * Checks, whether the given annotation is allowed at the given method.
+	 *
+	 * @param element An annotated method.
+	 * @param annotation An annotation at that method.
+	 *
+	 * @return A set with errors, that describe, why the given annotation is
+	 *         not allowed at the given element. In case no errors occur (the
+	 *         given annotation is allowed at the given element), an empty set
+	 *         must be returned.
+	 */
+	Set<ConstraintCheckError> checkMethod(ExecutableElement element,
+										  AnnotationMirror annotation);
+
+	/**
+	 * Checks, whether the given annotation is allowed at the given annotation
+	 * type declaration.
+	 *
+	 * @param element An annotated annotation type declaration.
+	 * @param annotation An annotation at that annotation type.
+	 *
+	 * @return A set with errors, that describe, why the given annotation is
+	 *         not allowed at the given element. In case no errors occur (the
+	 *         given annotation is allowed at the given element), an empty set
+	 *         must be returned.
+	 */
+	Set<ConstraintCheckError> checkAnnotationType(TypeElement element,
+												  AnnotationMirror annotation);
+
+	/**
+	 * Checks, whether the given annotation is allowed at the given type
+	 * declaration (class, interface, enum).
+	 *
+	 * @param element An annotated type declaration.
+	 * @param annotation An annotation at that type.
+	 *
+	 * @return A set with errors, that describe, why the given annotation is
+	 *         not allowed at the given element. In case no errors occur (the
+	 *         given annotation is allowed at the given element), an empty set
+	 *         must be returned.
+	 */
+	Set<ConstraintCheckError> checkNonAnnotationType(TypeElement element,
+													 AnnotationMirror annotation);
+
+}
diff --git a/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/ConstraintCheckError.java b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/ConstraintCheckError.java
new file mode 100644
index 0000000..79bace2
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/ConstraintCheckError.java
@@ -0,0 +1,143 @@
+// $Id: ConstraintCheckError.java 19310 2010-04-27 22:51:17Z gunnar.morling $
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, 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.ap.checks;
+
+import java.text.MessageFormat;
+import java.util.Arrays;
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.Element;
+
+/**
+ * The result of the execution of a {@link ConstraintCheck}. Comprises
+ * information about the location at which the error occurred and a message
+ * describing the occured error.
+ *
+ * @author Gunnar Morling
+ */
+public class ConstraintCheckError {
+
+	private final Element element;
+
+	private final AnnotationMirror annotationMirror;
+
+	private final String messageKey;
+
+	private final Object[] messageParameters;
+
+	/**
+	 * Creates a new ConstraintCheckError.
+	 *
+	 * @param element The element at which the error occurred.
+	 * @param annotationMirror The annotation that causes the error.
+	 * @param messageKey A key for retrieving an error message template from the bundle
+	 * <p/>
+	 * <code>org.hibernate.validator.ap.ValidationProcessorMessages.</code>
+	 * @param messageParameters An array with values to put into the error message template
+	 * using {@link MessageFormat}. The number of elements must match
+	 * the number of place holders in the message template.
+	 */
+	public ConstraintCheckError(Element element,
+								AnnotationMirror annotationMirror, String messageKey, Object... messageParameters) {
+
+		this.element = element;
+		this.annotationMirror = annotationMirror;
+		this.messageKey = messageKey;
+		this.messageParameters = messageParameters;
+	}
+
+	public Element getElement() {
+		return element;
+	}
+
+	public AnnotationMirror getAnnotationMirror() {
+		return annotationMirror;
+	}
+
+	public String getMessageKey() {
+		return messageKey;
+	}
+
+	public Object[] getMessageParameters() {
+		return messageParameters;
+	}
+
+	@Override
+	public String toString() {
+		return "ConstraintCheckError [annotationMirror=" + annotationMirror
+				+ ", element=" + element + ", messageKey=" + messageKey
+				+ ", messageParameters=" + Arrays.toString( messageParameters )
+				+ "]";
+	}
+
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime
+				* result
+				+ ( ( annotationMirror == null ) ? 0 : annotationMirror.hashCode() );
+		result = prime * result + ( ( element == null ) ? 0 : element.hashCode() );
+		result = prime * result
+				+ ( ( messageKey == null ) ? 0 : messageKey.hashCode() );
+		result = prime * result + Arrays.hashCode( messageParameters );
+		return result;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if ( this == obj ) {
+			return true;
+		}
+		if ( obj == null ) {
+			return false;
+		}
+		if ( getClass() != obj.getClass() ) {
+			return false;
+		}
+		ConstraintCheckError other = ( ConstraintCheckError ) obj;
+		if ( annotationMirror == null ) {
+			if ( other.annotationMirror != null ) {
+				return false;
+			}
+		}
+		else if ( !annotationMirror.equals( other.annotationMirror ) ) {
+			return false;
+		}
+		if ( element == null ) {
+			if ( other.element != null ) {
+				return false;
+			}
+		}
+		else if ( !element.equals( other.element ) ) {
+			return false;
+		}
+		if ( messageKey == null ) {
+			if ( other.messageKey != null ) {
+				return false;
+			}
+		}
+		else if ( !messageKey.equals( other.messageKey ) ) {
+			return false;
+		}
+		if ( !Arrays.equals( messageParameters, other.messageParameters ) ) {
+			return false;
+		}
+		return true;
+	}
+
+}
diff --git a/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/ConstraintCheckFactory.java b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/ConstraintCheckFactory.java
new file mode 100644
index 0000000..ff71481
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/ConstraintCheckFactory.java
@@ -0,0 +1,150 @@
+// $Id: ConstraintCheckFactory.java 19323 2010-04-29 18:37:41Z gunnar.morling $
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, 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.ap.checks;
+
+import java.util.Map;
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.Element;
+
+import org.hibernate.validator.ap.util.CollectionHelper;
+import org.hibernate.validator.ap.util.ConstraintHelper;
+import org.hibernate.validator.ap.util.ConstraintHelper.AnnotationType;
+
+/**
+ * A factory in charge of determining the {@link ConstraintCheck}s required for
+ * the validation of annotations at given elements.
+ *
+ * @author Gunnar Morling
+ */
+public class ConstraintCheckFactory {
+
+	/**
+	 * Holds the checks to be executed for field elements.
+	 */
+	private final Map<AnnotationType, ConstraintChecks> fieldChecks;
+
+	/**
+	 * Holds the checks to be executed for method elements.
+	 */
+	private final Map<AnnotationType, ConstraintChecks> methodChecks;
+
+	/**
+	 * Holds the checks to be executed for annotation type declarations.
+	 */
+	private final Map<AnnotationType, ConstraintChecks> annotationTypeChecks;
+
+	/**
+	 * Holds the checks to be executed for class/interface/enum declarations.
+	 */
+	private final Map<AnnotationType, ConstraintChecks> nonAnnotationTypeChecks;
+
+	private ConstraintHelper constraintHelper;
+
+	private final static SingleValuedChecks NULL_CHECKS = new SingleValuedChecks();
+
+	public ConstraintCheckFactory(ConstraintHelper constraintHelper) {
+
+		this.constraintHelper = constraintHelper;
+
+		fieldChecks = CollectionHelper.newHashMap();
+		fieldChecks.put(
+				AnnotationType.CONSTRAINT_ANNOTATION,
+				new SingleValuedChecks( new StaticCheck(), new TypeCheck( constraintHelper ) )
+		);
+		fieldChecks.put(
+				AnnotationType.MULTI_VALUED_CONSTRAINT_ANNOTATION,
+				new MultiValuedChecks( constraintHelper, new StaticCheck(), new TypeCheck( constraintHelper ) )
+		);
+		fieldChecks.put(
+				AnnotationType.GRAPH_VALIDATION_ANNOTATION,
+				new SingleValuedChecks( new StaticCheck(), new PrimitiveCheck() )
+		);
+		fieldChecks.put( AnnotationType.NO_CONSTRAINT_ANNOTATION, NULL_CHECKS );
+
+		methodChecks = CollectionHelper.newHashMap();
+		methodChecks.put(
+				AnnotationType.CONSTRAINT_ANNOTATION,
+				new SingleValuedChecks( new GetterCheck(), new StaticCheck(), new TypeCheck( constraintHelper ) )
+		);
+		methodChecks.put(
+				AnnotationType.MULTI_VALUED_CONSTRAINT_ANNOTATION, new MultiValuedChecks(
+						constraintHelper, new GetterCheck(), new StaticCheck(), new TypeCheck( constraintHelper )
+				)
+		);
+		methodChecks.put(
+				AnnotationType.GRAPH_VALIDATION_ANNOTATION,
+				new SingleValuedChecks( new GetterCheck(), new StaticCheck(), new PrimitiveCheck() )
+		);
+		methodChecks.put( AnnotationType.NO_CONSTRAINT_ANNOTATION, NULL_CHECKS );
+
+		annotationTypeChecks = CollectionHelper.newHashMap();
+		annotationTypeChecks.put(
+				AnnotationType.CONSTRAINT_ANNOTATION,
+				new SingleValuedChecks( new AnnotationTypeCheck( constraintHelper ) )
+		);
+		annotationTypeChecks.put(
+				AnnotationType.MULTI_VALUED_CONSTRAINT_ANNOTATION,
+				new MultiValuedChecks( constraintHelper, new AnnotationTypeCheck( constraintHelper ) )
+		);
+		annotationTypeChecks.put( AnnotationType.NO_CONSTRAINT_ANNOTATION, NULL_CHECKS );
+
+		nonAnnotationTypeChecks = CollectionHelper.newHashMap();
+		nonAnnotationTypeChecks.put(
+				AnnotationType.CONSTRAINT_ANNOTATION, new SingleValuedChecks( new TypeCheck( constraintHelper ) )
+		);
+		nonAnnotationTypeChecks.put(
+				AnnotationType.MULTI_VALUED_CONSTRAINT_ANNOTATION,
+				new MultiValuedChecks( constraintHelper, new TypeCheck( constraintHelper ) )
+		);
+		nonAnnotationTypeChecks.put( AnnotationType.NO_CONSTRAINT_ANNOTATION, NULL_CHECKS );
+	}
+
+	/**
+	 * Returns those checks that have to be performed to validate the given
+	 * annotation at the given element. In case no checks have to be performed
+	 * (e.g. because the given annotation is no constraint annotation) an empty
+	 * {@link ConstraintChecks} instance will be returned. It's therefore always
+	 * safe to operate on the returned object.
+	 *
+	 * @param annotatedElement An annotated element, e.g. a type declaration or a method.
+	 * @param annotation An annotation.
+	 *
+	 * @return The checks to be performed to validate the given annotation at
+	 *         the given element.
+	 */
+	public ConstraintChecks getConstraintChecks(Element annotatedElement, AnnotationMirror annotation) {
+
+		AnnotationType annotationType = constraintHelper.getAnnotationType( annotation );
+
+		switch ( annotatedElement.getKind() ) {
+			case FIELD:
+				return fieldChecks.get( annotationType );
+			case METHOD:
+				return methodChecks.get( annotationType );
+			case ANNOTATION_TYPE:
+				return annotationTypeChecks.get( annotationType );
+			case CLASS:
+			case INTERFACE:
+			case ENUM:
+				return nonAnnotationTypeChecks.get( annotationType );
+			default:
+				return NULL_CHECKS;
+		}
+	}
+
+}
diff --git a/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/ConstraintChecks.java b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/ConstraintChecks.java
new file mode 100644
index 0000000..f8ff5e3
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/ConstraintChecks.java
@@ -0,0 +1,45 @@
+// $Id: ConstraintChecks.java 19310 2010-04-27 22:51:17Z gunnar.morling $
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, 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.ap.checks;
+
+import java.util.Set;
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.Element;
+
+/**
+ * Represents an ordered set of {@link ConstraintCheck}s with the ability
+ * to execute these checks against given elements and their annotations.
+ *
+ * @author Gunnar Morling
+ */
+public interface ConstraintChecks {
+
+	/**
+	 * Executes the checks contained within this set against the given element
+	 * and annotation.
+	 *
+	 * @param element An annotated element.
+	 * @param annotation The annotation to check.
+	 *
+	 * @return A set with errors. Will be empty in case all checks passed
+	 *         successfully.
+	 */
+	Set<ConstraintCheckError> execute(Element element,
+									  AnnotationMirror annotation);
+
+}
\ No newline at end of file
diff --git a/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/GetterCheck.java b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/GetterCheck.java
new file mode 100644
index 0000000..09dbca4
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/GetterCheck.java
@@ -0,0 +1,67 @@
+// $Id: GetterCheck.java 19323 2010-04-29 18:37:41Z gunnar.morling $
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, 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.ap.checks;
+
+import java.util.Collections;
+import java.util.Set;
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.type.TypeKind;
+
+import org.hibernate.validator.ap.util.CollectionHelper;
+
+/**
+ * Checks whether a given element is a valid getter method.
+ *
+ * @author Gunnar Morling
+ */
+public class GetterCheck extends AbstractConstraintCheck {
+	public Set<ConstraintCheckError> checkMethod(ExecutableElement element,
+												 AnnotationMirror annotation) {
+
+		if ( !isGetterMethod( element ) ) {
+			return CollectionHelper.asSet(
+					new ConstraintCheckError(
+							element, annotation, "ONLY_GETTERS_MAY_BE_ANNOTATED"
+					)
+			);
+		}
+
+		return Collections.emptySet();
+	}
+
+	private boolean isGetterMethod(ExecutableElement method) {
+
+		return isJavaBeanGetterName( method.getSimpleName().toString() )
+				&& !hasParameters( method ) && hasReturnValue( method );
+	}
+
+	private boolean hasReturnValue(ExecutableElement method) {
+		return method.getReturnType().getKind() != TypeKind.VOID;
+	}
+
+	private boolean hasParameters(ExecutableElement method) {
+		return !method.getParameters().isEmpty();
+	}
+
+	private boolean isJavaBeanGetterName(String methodName) {
+		return methodName.startsWith( "is" ) || methodName.startsWith( "has" ) || methodName.startsWith( "get" );
+	}
+
+}
+
diff --git a/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/MultiValuedChecks.java b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/MultiValuedChecks.java
new file mode 100644
index 0000000..c9e33b9
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/MultiValuedChecks.java
@@ -0,0 +1,67 @@
+// $Id: MultiValuedChecks.java 19310 2010-04-27 22:51:17Z gunnar.morling $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.checks;
+
+import java.util.Set;
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.Element;
+
+import org.hibernate.validator.ap.util.CollectionHelper;
+import org.hibernate.validator.ap.util.ConstraintHelper;
+
+/**
+ * A {@link ConstraintChecks} implementation, that executed the contained checks
+ * against all parts of given multi-valued annotations.
+ *
+ * @author Gunnar Morling
+ */
+public class MultiValuedChecks implements ConstraintChecks {
+
+	private final ConstraintHelper constraintHelper;
+
+	private final SingleValuedChecks delegate;
+
+	/**
+	 * Creates a new MultiValuedChecks.
+	 *
+	 * @param constraintHelper Helper for handling multi-valued constraints.
+	 * @param checks The checks to execute.
+	 */
+	public MultiValuedChecks(ConstraintHelper constraintHelper,
+							 ConstraintCheck... checks) {
+
+		this.constraintHelper = constraintHelper;
+		this.delegate = new SingleValuedChecks( checks );
+	}
+
+	public Set<ConstraintCheckError> execute(Element element,
+											 AnnotationMirror annotation) {
+
+		Set<ConstraintCheckError> theValue = CollectionHelper.newHashSet();
+
+		//execute the checks on each element of the multi-valued constraint
+		for ( AnnotationMirror onePartOfMultiValuedConstraint :
+				constraintHelper.getPartsOfMultiValuedConstraint( annotation ) ) {
+
+			theValue.addAll( delegate.execute( element, onePartOfMultiValuedConstraint ) );
+		}
+
+		return theValue;
+	}
+
+}
diff --git a/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/PrimitiveCheck.java b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/PrimitiveCheck.java
new file mode 100644
index 0000000..53ecbb5
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/PrimitiveCheck.java
@@ -0,0 +1,69 @@
+// $Id: PrimitiveCheck.java 19310 2010-04-27 22:51:17Z gunnar.morling $
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, 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.ap.checks;
+
+import java.util.Collections;
+import java.util.Set;
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.VariableElement;
+import javax.lang.model.type.TypeMirror;
+
+import org.hibernate.validator.ap.util.CollectionHelper;
+
+/**
+ * Validates that the given element is not of a primitive type. Applies to
+ * fields and methods (the return type is evaluated).
+ *
+ * @author Gunnar Morling
+ */
+public class PrimitiveCheck extends AbstractConstraintCheck {
+
+	@Override
+	public Set<ConstraintCheckError> checkField(VariableElement element,
+												AnnotationMirror annotation) {
+
+		return checkInternal( element, annotation, element.asType(), "ATVALID_NOT_ALLOWED_AT_PRIMITIVE_FIELD" );
+	}
+
+	@Override
+	public Set<ConstraintCheckError> checkMethod(ExecutableElement element,
+												 AnnotationMirror annotation) {
+
+		return checkInternal(
+				element, annotation, element.getReturnType(), "ATVALID_NOT_ALLOWED_AT_METHOD_RETURNING_PRIMITIVE_TYPE"
+		);
+	}
+
+	private Set<ConstraintCheckError> checkInternal(Element element,
+													AnnotationMirror annotation, TypeMirror type, String messageKey) {
+
+		if ( type.getKind().isPrimitive() ) {
+
+			return CollectionHelper.asSet(
+					new ConstraintCheckError(
+							element, annotation, messageKey
+					)
+			);
+		}
+
+		return Collections.emptySet();
+	}
+
+}
diff --git a/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/SingleValuedChecks.java b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/SingleValuedChecks.java
new file mode 100644
index 0000000..0c0b909
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/SingleValuedChecks.java
@@ -0,0 +1,92 @@
+// $Id: SingleValuedChecks.java 19310 2010-04-27 22:51:17Z gunnar.morling $
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, 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.ap.checks;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementKind;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.VariableElement;
+
+import org.hibernate.validator.ap.util.CollectionHelper;
+
+/**
+ * A {@link ConstraintChecks} implementation that simply executes all
+ * contained checks against given elements and annotations.
+ *
+ * @author Gunnar Morling
+ */
+public class SingleValuedChecks implements ConstraintChecks {
+
+	//TODO GM: the "ordered set" character is currently ensured by adding
+	//each check only once in ConstraintCheckFactory. Should this be a real set?
+	private final List<ConstraintCheck> checks;
+
+	/**
+	 * Creates a new SingleValuedChecks.
+	 *
+	 * @param checks The checks to execute.
+	 */
+	public SingleValuedChecks(ConstraintCheck... checks) {
+
+		if ( checks == null ) {
+			this.checks = Collections.emptyList();
+		}
+		else {
+			this.checks = Arrays.asList( checks );
+		}
+	}
+
+	public Set<ConstraintCheckError> execute(Element element, AnnotationMirror annotation) {
+
+		Set<ConstraintCheckError> theValue = CollectionHelper.newHashSet();
+
+		//for each check execute the check method appropriate for the kind of
+		//the given element
+		for ( ConstraintCheck oneCheck : checks ) {
+
+			if ( element.getKind() == ElementKind.FIELD ) {
+				theValue.addAll( oneCheck.checkField( ( VariableElement ) element, annotation ) );
+			}
+			else if ( element.getKind() == ElementKind.METHOD ) {
+				theValue.addAll( oneCheck.checkMethod( ( ExecutableElement ) element, annotation ) );
+			}
+			else if ( element.getKind() == ElementKind.ANNOTATION_TYPE ) {
+				theValue.addAll( oneCheck.checkAnnotationType( ( TypeElement ) element, annotation ) );
+			}
+			else if (
+					element.getKind() == ElementKind.CLASS ||
+							element.getKind() == ElementKind.INTERFACE ||
+							element.getKind() == ElementKind.ENUM ) {
+
+				theValue.addAll( oneCheck.checkNonAnnotationType( ( TypeElement ) element, annotation ) );
+			}
+
+			if ( !theValue.isEmpty() ) {
+				return theValue;
+			}
+		}
+
+		return theValue;
+	}
+}
diff --git a/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/StaticCheck.java b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/StaticCheck.java
new file mode 100644
index 0000000..e89a119
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/StaticCheck.java
@@ -0,0 +1,64 @@
+// $Id: StaticCheck.java 19310 2010-04-27 22:51:17Z gunnar.morling $
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, 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.ap.checks;
+
+import java.util.Collections;
+import java.util.Set;
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.Modifier;
+import javax.lang.model.element.VariableElement;
+
+import org.hibernate.validator.ap.util.CollectionHelper;
+
+/**
+ * Checks, that the given element is not a static element. Applies to fields
+ * and methods.
+ *
+ * @author Gunnar Morling
+ */
+public class StaticCheck extends AbstractConstraintCheck {
+
+	@Override
+	public Set<ConstraintCheckError> checkField(VariableElement element, AnnotationMirror annotation) {
+
+		return checkInternal( element, annotation, "STATIC_FIELDS_MAY_NOT_BE_ANNOTATED" );
+	}
+
+	@Override
+	public Set<ConstraintCheckError> checkMethod(ExecutableElement element, AnnotationMirror annotation) {
+
+		return checkInternal( element, annotation, "STATIC_METHODS_MAY_NOT_BE_ANNOTATED" );
+	}
+
+	private Set<ConstraintCheckError> checkInternal(Element element,
+													AnnotationMirror annotation, String messageKey) {
+		if ( isStaticElement( element ) ) {
+
+			return CollectionHelper.asSet( new ConstraintCheckError( element, annotation, messageKey ) );
+		}
+
+		return Collections.emptySet();
+	}
+
+	private boolean isStaticElement(Element element) {
+		return element.getModifiers().contains( Modifier.STATIC );
+	}
+
+}
diff --git a/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/TypeCheck.java b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/TypeCheck.java
new file mode 100644
index 0000000..e3eabfc
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/checks/TypeCheck.java
@@ -0,0 +1,87 @@
+// $Id: TypeCheck.java 19310 2010-04-27 22:51:17Z gunnar.morling $
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, 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.ap.checks;
+
+import java.util.Collections;
+import java.util.Set;
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.VariableElement;
+import javax.lang.model.type.TypeMirror;
+
+import org.hibernate.validator.ap.util.CollectionHelper;
+import org.hibernate.validator.ap.util.ConstraintHelper;
+import org.hibernate.validator.ap.util.ConstraintHelper.ConstraintCheckResult;
+
+/**
+ * Checks, that constraint annotations are only specified at elements
+ * of a type supported by the constraints. Applies to fields, methods and
+ * non-annotation type declarations.
+ *
+ * @author Gunnar Morling
+ */
+public class TypeCheck extends AbstractConstraintCheck {
+
+	private ConstraintHelper constraintHelper;
+
+	public TypeCheck(ConstraintHelper constraintHelper) {
+		this.constraintHelper = constraintHelper;
+	}
+
+	@Override
+	public Set<ConstraintCheckError> checkField(VariableElement element,
+												AnnotationMirror annotation) {
+
+		return checkInternal( element, annotation, element.asType(), "NOT_SUPPORTED_TYPE" );
+	}
+
+	@Override
+	public Set<ConstraintCheckError> checkMethod(ExecutableElement element,
+												 AnnotationMirror annotation) {
+
+		return checkInternal( element, annotation, element.getReturnType(), "NOT_SUPPORTED_RETURN_TYPE" );
+	}
+
+	@Override
+	public Set<ConstraintCheckError> checkNonAnnotationType(
+			TypeElement element, AnnotationMirror annotation) {
+
+		return checkInternal( element, annotation, element.asType(), "NOT_SUPPORTED_TYPE" );
+	}
+
+	private Set<ConstraintCheckError> checkInternal(Element element,
+													AnnotationMirror annotation, TypeMirror type, String messageKey) {
+
+		if ( constraintHelper.checkConstraint(
+				annotation.getAnnotationType(), type
+		) != ConstraintCheckResult.ALLOWED ) {
+
+			return CollectionHelper.asSet(
+					new ConstraintCheckError(
+							element, annotation, messageKey,
+							annotation.getAnnotationType().asElement().getSimpleName()
+					)
+			);
+		}
+
+		return Collections.emptySet();
+	}
+
+}
diff --git a/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/util/AnnotationApiHelper.java b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/util/AnnotationApiHelper.java
new file mode 100644
index 0000000..a446dda
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/util/AnnotationApiHelper.java
@@ -0,0 +1,271 @@
+// $Id: AnnotationApiHelper.java 18897 2010-02-25 19:12:35Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.util;
+
+import java.lang.annotation.Annotation;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.AnnotationValue;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.type.TypeKind;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.util.Elements;
+import javax.lang.model.util.SimpleAnnotationValueVisitor6;
+import javax.lang.model.util.Types;
+
+/**
+ * A helper class providing some useful methods to work with types
+ * from the JSR-269-API.
+ *
+ * @author Gunnar Morling
+ */
+public class AnnotationApiHelper {
+
+	private Elements elementUtils;
+
+	private Types typeUtils;
+
+	private final Map<Class<?>, TypeMirror> primitiveMirrors;
+
+	public AnnotationApiHelper(Elements elementUtils, Types typeUtils) {
+
+		this.elementUtils = elementUtils;
+		this.typeUtils = typeUtils;
+
+		Map<Class<?>, TypeMirror> tempPrimitiveMirrors = CollectionHelper.newHashMap();
+
+		tempPrimitiveMirrors.put( Boolean.TYPE, typeUtils.getPrimitiveType( TypeKind.BOOLEAN ) );
+		tempPrimitiveMirrors.put( Character.TYPE, typeUtils.getPrimitiveType( TypeKind.CHAR ) );
+		tempPrimitiveMirrors.put( Byte.TYPE, typeUtils.getPrimitiveType( TypeKind.BYTE ) );
+		tempPrimitiveMirrors.put( Short.TYPE, typeUtils.getPrimitiveType( TypeKind.SHORT ) );
+		tempPrimitiveMirrors.put( Integer.TYPE, typeUtils.getPrimitiveType( TypeKind.INT ) );
+		tempPrimitiveMirrors.put( Long.TYPE, typeUtils.getPrimitiveType( TypeKind.LONG ) );
+		tempPrimitiveMirrors.put( Float.TYPE, typeUtils.getPrimitiveType( TypeKind.FLOAT ) );
+		tempPrimitiveMirrors.put( Double.TYPE, typeUtils.getPrimitiveType( TypeKind.DOUBLE ) );
+
+		primitiveMirrors = Collections.unmodifiableMap( tempPrimitiveMirrors );
+	}
+
+	/**
+	 * Returns a list containing those annotation mirrors from the input list,
+	 * which are of type <code>annotationType</code>. The input collection
+	 * remains untouched.
+	 *
+	 * @param annotationMirrors A list of annotation mirrors.
+	 * @param annotationType The type to be compared against.
+	 *
+	 * @return A list with those annotation mirrors from the input list, which
+	 *         are of type <code>annotationType</code>. May be empty but never
+	 *         null.
+	 */
+	public List<AnnotationMirror> filterByType(List<? extends AnnotationMirror> annotationMirrors, TypeMirror annotationType) {
+
+		List<AnnotationMirror> theValue = CollectionHelper.newArrayList();
+
+		if ( annotationMirrors == null || annotationType == null ) {
+			return theValue;
+		}
+
+		for ( AnnotationMirror oneAnnotationMirror : annotationMirrors ) {
+
+			if ( typeUtils.isSameType( oneAnnotationMirror.getAnnotationType(), annotationType ) ) {
+				theValue.add( oneAnnotationMirror );
+			}
+		}
+
+		return theValue;
+	}
+
+	/**
+	 * Returns that mirror from the given list of annotation mirrors that
+	 * represents the annotation type specified by the given class.
+	 *
+	 * @param annotationMirrors A list of annotation mirrors.
+	 * @param annotationClazz The class of the annotation of interest.
+	 *
+	 * @return The mirror from the given list that represents the specified
+	 *         annotation or null, if the given list doesn't contain such a
+	 *         mirror.
+	 */
+	public AnnotationMirror getMirror(List<? extends AnnotationMirror> annotationMirrors, Class<? extends Annotation> annotationClazz) {
+
+		if ( annotationMirrors == null || annotationClazz == null ) {
+			return null;
+		}
+
+		TypeMirror mirrorForAnnotation = elementUtils.getTypeElement(
+				annotationClazz.getCanonicalName()
+		).asType();
+
+		for ( AnnotationMirror oneAnnotationMirror : annotationMirrors ) {
+
+			if ( typeUtils.isSameType(
+					oneAnnotationMirror.getAnnotationType(),
+					mirrorForAnnotation
+			) ) {
+				return oneAnnotationMirror;
+			}
+		}
+
+		return null;
+	}
+
+	/**
+	 * Returns a TypeMirror for the given class.
+	 *
+	 * @param clazz The class of interest. May not be a an array type.
+	 *
+	 * @return A TypeMirror for the given class.
+	 */
+	public TypeMirror getMirrorForType(Class<?> clazz) {
+
+		if ( clazz.isPrimitive() ) {
+			return primitiveMirrors.get( clazz );
+		}
+		else {
+
+			TypeElement typeElement = elementUtils.getTypeElement( clazz.getCanonicalName() );
+
+			if ( typeElement != null ) {
+				return typeUtils.getDeclaredType( typeElement );
+			}
+		}
+
+		throw new AssertionError( "Couldn't find a type element for class " + clazz );
+	}
+
+	/**
+	 * Returns the annotation value of the given annotation mirror with the
+	 * given name.
+	 *
+	 * @param annotationMirror An annotation mirror.
+	 * @param name The name of the annotation value of interest.
+	 *
+	 * @return The annotation value with the given name or null, if one of the
+	 *         input values is null or if no value with the given name exists
+	 *         within the given annotation mirror.
+	 */
+	public AnnotationValue getAnnotationValue(AnnotationMirror annotationMirror, String name) {
+
+		if ( annotationMirror == null || name == null ) {
+			return null;
+		}
+
+		Map<? extends ExecutableElement, ? extends AnnotationValue> elementValues = annotationMirror.getElementValues();
+
+		for ( Entry<? extends ExecutableElement, ? extends AnnotationValue> oneElementValue : elementValues.entrySet() ) {
+
+			if ( oneElementValue.getKey().getSimpleName().contentEquals( name ) ) {
+
+				return oneElementValue.getValue();
+			}
+		}
+
+		return null;
+	}
+
+	/**
+	 * Returns the given annotation mirror's array-typed annotation value with
+	 * the given name.
+	 *
+	 * @param annotationMirror An annotation mirror.
+	 * @param name The name of the annotation value of interest.
+	 *
+	 * @return The annotation value with the given name or an empty list, if no
+	 *         such value exists within the given annotation mirror or such a
+	 *         value exists but is not an array-typed one.
+	 */
+	public List<? extends AnnotationValue> getAnnotationArrayValue(AnnotationMirror annotationMirror, String name) {
+
+		AnnotationValue annotationValue = getAnnotationValue( annotationMirror, name );
+
+		if ( annotationValue == null ) {
+			return Collections.<AnnotationValue>emptyList();
+		}
+
+		List<? extends AnnotationValue> theValue = annotationValue.accept(
+				new SimpleAnnotationValueVisitor6<List<? extends AnnotationValue>, Void>() {
+
+					@Override
+					public List<? extends AnnotationValue> visitArray(List<? extends AnnotationValue> values, Void p) {
+						return values;
+					}
+
+				}, null
+		);
+
+		return theValue != null ? theValue : Collections
+				.<AnnotationValue>emptyList();
+	}
+
+	/**
+	 * <p>
+	 * Returns a set containing the "lowest" type per hierarchy contained in the
+	 * input set. The following examples shall demonstrate the behavior.
+	 * </p>
+	 * <ul>
+	 * <li>
+	 * Input: <code>String</code>; Output: <code>String</code></li>
+	 * <li>
+	 * Input: <code>Object</code>, <code>String</code>; Output:
+	 * <code>String</code></li>
+	 * <li>
+	 * Input: <code>Object</code>, <code>Collection</code>, <code>List</code>;
+	 * Output: <code>List</code></li>
+	 * <li>
+	 * Input: <code>Collection</code>, <code>Set</code>, <code>List</code>;
+	 * Output: <code>List</code>, <code>Set</code></li>
+	 * </ul>
+	 *
+	 * @param types A set of type mirrors.
+	 *
+	 * @return A set with the lowest types per hierarchy or null, if the input
+	 *         set was null.
+	 */
+	public Set<TypeMirror> keepLowestTypePerHierarchy(Set<TypeMirror> types) {
+
+		if ( types == null ) {
+			return null;
+		}
+
+		Set<TypeMirror> theValue = CollectionHelper.newHashSet();
+
+		for ( TypeMirror typeMirror1 : types ) {
+			boolean foundSubType = false;
+			for ( TypeMirror typeMirror2 : types ) {
+				if ( !typeUtils.isSameType( typeMirror2, typeMirror1 ) && typeUtils.isAssignable(
+						typeMirror2, typeMirror1
+				) ) {
+					foundSubType = true;
+					continue;
+				}
+			}
+			if ( !foundSubType ) {
+				theValue.add( typeMirror1 );
+			}
+		}
+
+		return theValue;
+	}
+
+}
diff --git a/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/util/CollectionHelper.java b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/util/CollectionHelper.java
new file mode 100644
index 0000000..720c5fb
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/util/CollectionHelper.java
@@ -0,0 +1,50 @@
+// $Id: CollectionHelper.java 19033 2010-03-19 21:27:15Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.util;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Provides some methods for simplified collection instantiation.
+ *
+ * @author Gunnar Morling
+ */
+public class CollectionHelper {
+
+	public static <K, V> HashMap<K, V> newHashMap() {
+		return new HashMap<K, V>();
+	}
+
+	public static <T> HashSet<T> newHashSet() {
+		return new HashSet<T>();
+	}
+
+	public static <T> ArrayList<T> newArrayList() {
+		return new ArrayList<T>();
+	}
+
+	public static <T> Set<T> asSet(T... ts) {
+
+		return new HashSet<T>( Arrays.asList( ts ) );
+	}
+
+}
\ No newline at end of file
diff --git a/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/util/ConstraintHelper.java b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/util/ConstraintHelper.java
new file mode 100644
index 0000000..c8b1499
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/util/ConstraintHelper.java
@@ -0,0 +1,646 @@
+// $Id: ConstraintHelper.java 19324 2010-04-29 19:02:09Z gunnar.morling $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.util;
+
+import java.lang.annotation.Annotation;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.AnnotationValue;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.Name;
+import javax.lang.model.type.DeclaredType;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.util.Elements;
+import javax.lang.model.util.SimpleAnnotationValueVisitor6;
+import javax.lang.model.util.TypeKindVisitor6;
+import javax.lang.model.util.Types;
+import javax.validation.Constraint;
+import javax.validation.ConstraintValidator;
+import javax.validation.Valid;
+import javax.validation.constraints.AssertFalse;
+import javax.validation.constraints.AssertTrue;
+import javax.validation.constraints.DecimalMax;
+import javax.validation.constraints.DecimalMin;
+import javax.validation.constraints.Digits;
+import javax.validation.constraints.Future;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Null;
+import javax.validation.constraints.Past;
+import javax.validation.constraints.Pattern;
+import javax.validation.constraints.Size;
+
+/**
+ * Helper class that deals with all constraint-related stuff, such as
+ * determining whether a given annotation represents a constraint annotation or
+ * whether a given annotation is allowed to be declared at a given element.
+ *
+ * @author Gunnar Morling
+ */
+public class ConstraintHelper {
+
+	/**
+	 * Possible results of a constraint check as returned by
+	 * {@link ConstraintHelper#checkConstraint(DeclaredType, TypeMirror)}.
+	 *
+	 * @author Gunnar Morling
+	 */
+	public enum ConstraintCheckResult {
+
+		/**
+		 * The checked constraint is allowed at the evaluated type.
+		 */
+		ALLOWED,
+
+		/**
+		 * The checked constraint is not allowed at the evaluated type.
+		 */
+		DISALLOWED,
+
+		/**
+		 * Multiple validators were found, that could validate the checked
+		 * constrained at the evaluated type.
+		 */
+		MULTIPLE_VALIDATORS_FOUND
+	}
+
+	/**
+	 * The type of an annotation with respect to the BV API.
+	 *
+	 * @author Gunnar Morling
+	 */
+	public enum AnnotationType {
+
+		/**
+		 * Given annotation is a constraint annotation (e.g. @Min).
+		 */
+		CONSTRAINT_ANNOTATION,
+
+		/**
+		 * Given annotation is a multi-valued annotation (e.g.
+		 * <code>
+		 *
+		 * @List({
+		 * @Min(10),
+		 * @Min(value=20, groups= Special.class})
+		 * })
+		 * </code>.
+		 */
+		MULTI_VALUED_CONSTRAINT_ANNOTATION,
+
+		/**
+		 * Given annotation is the @Valid annotation.
+		 */
+		GRAPH_VALIDATION_ANNOTATION,
+
+		/**
+		 * Given annotation is not related to the BV API (e.g. @Resource).
+		 */
+		NO_CONSTRAINT_ANNOTATION
+	}
+
+	/**
+	 * The name of the package containing JSR 303 standard annotations
+	 * ("javax.validation.constraints").
+	 */
+	private final Name CONSTRAINT_ANNOTATION_PACKAGE_NAME;
+
+	private static Map<Name, Set<TypeMirror>> builtInConstraints;
+
+	private Elements elementUtils;
+
+	private Types typeUtils;
+
+	private AnnotationApiHelper annotationApiHelper;
+
+	public ConstraintHelper(Elements elementUtils, Types typeUtils, AnnotationApiHelper annotationApiHelper) {
+
+		this.elementUtils = elementUtils;
+		this.typeUtils = typeUtils;
+		this.annotationApiHelper = annotationApiHelper;
+
+		CONSTRAINT_ANNOTATION_PACKAGE_NAME = elementUtils.getName( Size.class.getPackage().getName() );
+
+		builtInConstraints = CollectionHelper.newHashMap();
+
+		registerAllowedTypesForBuiltInConstraint(
+				AssertFalse.class, CollectionHelper.<Class<?>>asSet( Boolean.class )
+		);
+		registerAllowedTypesForBuiltInConstraint( AssertTrue.class, CollectionHelper.<Class<?>>asSet( Boolean.class ) );
+		registerAllowedTypesForBuiltInConstraint(
+				DecimalMax.class, CollectionHelper.<Class<?>>asSet( Number.class, String.class )
+		);
+		registerAllowedTypesForBuiltInConstraint(
+				DecimalMin.class, CollectionHelper.<Class<?>>asSet( Number.class, String.class )
+		);
+		registerAllowedTypesForBuiltInConstraint(
+				Digits.class, CollectionHelper.<Class<?>>asSet( Number.class, String.class )
+		);
+		registerAllowedTypesForBuiltInConstraint(
+				Future.class, CollectionHelper.<Class<?>>asSet( Calendar.class, Date.class )
+		);
+		registerAllowedTypesForBuiltInConstraint(
+				Max.class, CollectionHelper.<Class<?>>asSet( Number.class, String.class )
+		);
+		registerAllowedTypesForBuiltInConstraint(
+				Min.class, CollectionHelper.<Class<?>>asSet( Number.class, String.class )
+		);
+		registerAllowedTypesForBuiltInConstraint( NotNull.class, CollectionHelper.<Class<?>>asSet( Object.class ) );
+		registerAllowedTypesForBuiltInConstraint( Null.class, CollectionHelper.<Class<?>>asSet( Object.class ) );
+		registerAllowedTypesForBuiltInConstraint(
+				Past.class, CollectionHelper.<Class<?>>asSet( Calendar.class, Date.class )
+		);
+		registerAllowedTypesForBuiltInConstraint( Pattern.class, CollectionHelper.<Class<?>>asSet( String.class ) );
+		registerAllowedTypesForBuiltInConstraint(
+				Size.class, CollectionHelper.<Class<?>>asSet(
+						Object[].class,
+						boolean[].class,
+						byte[].class,
+						char[].class,
+						double[].class,
+						float[].class,
+						int[].class,
+						long[].class,
+						short[].class,
+						Collection.class,
+						Map.class,
+						String.class
+				)
+		);
+	}
+
+	/**
+	 * Checks, whether the given type element represents a constraint annotation
+	 * or not. That's the case, if the given element is annotated with the
+	 * {@link Constraint} meta-annotation (which is only allowed at annotation
+	 * declarations).
+	 *
+	 * @param element The element of interest.
+	 *
+	 * @return True, if the given element is a constraint annotation type, false
+	 *         otherwise.
+	 */
+	public boolean isConstraintAnnotation(Element element) {
+		return element.getAnnotation( Constraint.class ) != null;
+	}
+
+	/**
+	 * Returns the {@link AnnotationType} of the given annotation.
+	 *
+	 * @param annotationMirror The annotation mirror of interest.
+	 *
+	 * @return The given mirror's annotation type.
+	 */
+	public AnnotationType getAnnotationType(AnnotationMirror annotationMirror) {
+
+		if ( isConstraintAnnotation( annotationMirror ) ) {
+			return AnnotationType.CONSTRAINT_ANNOTATION;
+		}
+		else if ( isMultiValuedConstraint( annotationMirror ) ) {
+			return AnnotationType.MULTI_VALUED_CONSTRAINT_ANNOTATION;
+		}
+		else if ( isGraphValidationAnnotation( annotationMirror ) ) {
+			return AnnotationType.GRAPH_VALIDATION_ANNOTATION;
+		}
+		else {
+			return AnnotationType.NO_CONSTRAINT_ANNOTATION;
+		}
+
+	}
+
+	/**
+	 * Returns a list with the constraint annotations contained in the given
+	 * array-valued annotation mirror.
+	 *
+	 * @param annotationMirror An array-valued annotation mirror (meaning it has an
+	 * array-typed attribute with name "value").
+	 *
+	 * @return A list with the constraint annotations part of the given
+	 *         multi-valued constraint annotation. Will return an empty list if
+	 *         the given annotation is no multi-valued annotation or if no
+	 *         constraint annotations are contained within the given
+	 *         array-valued annotation.
+	 */
+	public List<AnnotationMirror> getPartsOfMultiValuedConstraint(
+			AnnotationMirror annotationMirror) {
+
+		final List<AnnotationMirror> theValue = CollectionHelper.newArrayList();
+
+		for ( AnnotationValue oneValuePart : annotationApiHelper
+				.getAnnotationArrayValue( annotationMirror, "value" ) ) {
+
+			oneValuePart.accept(
+					new SimpleAnnotationValueVisitor6<Void, Void>() {
+
+						@Override
+						public Void visitAnnotation(AnnotationMirror a, Void p) {
+
+							if ( isConstraintAnnotation(
+									a.getAnnotationType()
+											.asElement()
+							) ) {
+								theValue.add( a );
+							}
+
+							return null;
+						}
+
+					}, null
+			);
+
+		}
+
+		return theValue;
+	}
+
+	/**
+	 * Checks whether the given annotation type (which <b>must</b> be a
+	 * constraint annotation type) may be specified at elements of the specified
+	 * type.
+	 *
+	 * @param constraintAnnotationType A constraint annotation type.
+	 * @param typeOfAnnotatedElement A type which with an element is annotated.
+	 *
+	 * @return Whether the given constraint annotation may be specified at
+	 *         elements of the given type.
+	 */
+	public ConstraintCheckResult checkConstraint(
+			DeclaredType constraintAnnotationType,
+			TypeMirror typeOfAnnotatedElement) {
+
+		return isBuiltInConstraint( constraintAnnotationType ) ? checkBuiltInConstraint(
+				constraintAnnotationType, typeOfAnnotatedElement
+		)
+				: checkCustomConstraint(
+				constraintAnnotationType,
+				typeOfAnnotatedElement
+		);
+	}
+
+	// ==================================
+	// private API below
+	// ==================================
+
+	/**
+	 * Checks, whether the given annotation mirror represents a constraint
+	 * annotation or not. That's the case, if the given mirror is annotated with
+	 * the {@link Constraint} meta-annotation (which is only allowed at
+	 * annotation declarations).
+	 *
+	 * @param annotationMirror The annotation mirror of interest.
+	 *
+	 * @return True, if the given mirror represents a constraint annotation
+	 *         type, false otherwise.
+	 */
+	private boolean isConstraintAnnotation(AnnotationMirror annotationMirror) {
+		return isConstraintAnnotation(
+				annotationMirror.getAnnotationType()
+						.asElement()
+		);
+	}
+
+	/**
+	 * Checks, whether the given annotation mirror represents a multi-valued
+	 * constraint such as {@link javax.validation.constraints.Pattern.List}.
+	 * That is the case if the annotation has an array-typed attribute with name
+	 * "value", that exclusively contains constraint annotations.
+	 *
+	 * @param annotationMirror The annotation mirror of interest.
+	 *
+	 * @return True, if the given mirror represents a multi-valued constraint,
+	 *         false otherwise.
+	 */
+	private boolean isMultiValuedConstraint(AnnotationMirror annotationMirror) {
+
+		List<? extends AnnotationValue> annotationArrayValue = annotationApiHelper.getAnnotationArrayValue(
+				annotationMirror, "value"
+		);
+
+		// a multi-valued constraint must have at least one value
+		if ( annotationArrayValue.isEmpty() ) {
+			return false;
+		}
+
+		for ( AnnotationValue oneAnnotationValue : annotationArrayValue ) {
+
+			Boolean isConstraintAnnotation = oneAnnotationValue.accept(
+					new SimpleAnnotationValueVisitor6<Boolean, Void>() {
+
+						@Override
+						public Boolean visitAnnotation(
+								AnnotationMirror a, Void p) {
+
+							return isConstraintAnnotation( a.getAnnotationType().asElement() );
+						}
+					}, null
+			);
+
+			//TODO GM: have all parts of the array to be constraint annotations?
+			if ( Boolean.TRUE != isConstraintAnnotation ) {
+				return false;
+			}
+		}
+
+		return true;
+	}
+
+	/**
+	 * Checks, whether the given mirror represents the {@link Valid} annotation.
+	 *
+	 * @param annotationMirror The annotation mirror of interest.
+	 *
+	 * @return True, if the given mirror represents the @Valid annotation, false
+	 *         otherwise.
+	 */
+	private boolean isGraphValidationAnnotation(
+			AnnotationMirror annotationMirror) {
+
+		return typeUtils.isSameType(
+				annotationMirror.getAnnotationType(),
+				annotationApiHelper.getMirrorForType( Valid.class )
+		);
+	}
+
+	private ConstraintCheckResult checkBuiltInConstraint(DeclaredType builtInAnnotationType, TypeMirror typeOfAnnotatedElement) {
+
+		Set<TypeMirror> allowedTypes = getAllowedTypesForBuiltInConstraint( builtInAnnotationType );
+
+		for ( TypeMirror oneAllowedType : allowedTypes ) {
+			if ( typeUtils.isAssignable( typeOfAnnotatedElement, oneAllowedType ) ) {
+				return ConstraintCheckResult.ALLOWED;
+			}
+		}
+
+		return ConstraintCheckResult.DISALLOWED;
+	}
+
+	private Set<TypeMirror> getAllowedTypesForBuiltInConstraint(DeclaredType builtInAnnotationType) {
+
+		Set<TypeMirror> theValue = builtInConstraints.get( builtInAnnotationType.asElement().getSimpleName() );
+
+		if ( theValue == null ) {
+			theValue = Collections.emptySet();
+		}
+
+		return theValue;
+	}
+
+	/**
+	 * Returns a set containing all those types, at which the specified custom
+	 * constraint-annotation is allowed.
+	 *
+	 * @param customAnnotationType A custom constraint type.
+	 * @param typeOfAnnotatedElement The type of the annotated element
+	 *
+	 * @return A set with all types supported by the given constraint. May be
+	 *         empty in case of constraint composition, if there is no common
+	 *         type supported by all composing constraints.
+	 */
+	private ConstraintCheckResult checkCustomConstraint(DeclaredType customAnnotationType, TypeMirror typeOfAnnotatedElement) {
+
+		Set<AnnotationMirror> composingConstraints = getComposingConstraints( customAnnotationType );
+		boolean isComposedConstraint = !composingConstraints.isEmpty();
+
+		for ( AnnotationMirror oneComposingConstraint : composingConstraints ) {
+
+			ConstraintCheckResult annotationCheckResult = checkConstraint(
+					oneComposingConstraint.getAnnotationType(), typeOfAnnotatedElement
+			);
+
+			if ( annotationCheckResult != ConstraintCheckResult.ALLOWED ) {
+				return annotationCheckResult;
+			}
+
+		}
+
+		Set<TypeMirror> theValue = getSupportedTypes(
+				customAnnotationType,
+				typeOfAnnotatedElement
+		);
+
+		if ( theValue.size() > 1 ) {
+			return ConstraintCheckResult.MULTIPLE_VALIDATORS_FOUND;
+		}
+		else if ( theValue.size() == 1 || isComposedConstraint ) {
+			return ConstraintCheckResult.ALLOWED;
+		}
+		else {
+			return ConstraintCheckResult.DISALLOWED;
+		}
+	}
+
+	/**
+	 * <p> Returns a set with those types supported by the constraint validators
+	 * specified in the @Constraint meta-annotation of the given constraint
+	 * annotation type to which the specified type can be assigned. </p>
+	 * <p>
+	 * If multiple types from the same inheritance hierarchy (e.g. Collection
+	 * and Set) are supported by the validators, only the "lowest" one (e.g.
+	 * Set) will be part of the result.
+	 * </p>
+	 *
+	 * @param constraintAnnotationType A constraint annotation type.
+	 * @param type A type.
+	 *
+	 * @return A set with the supported types.
+	 */
+	private Set<TypeMirror> getSupportedTypes(
+			DeclaredType constraintAnnotationType, TypeMirror type) {
+
+		Set<TypeMirror> theValue = CollectionHelper.newHashSet();
+
+		//the Constraint meta-annotation at the type declaration, e.g. "@Constraint(validatedBy = CheckCaseValidator.class)"
+		AnnotationMirror constraintMetaAnnotation = getConstraintMetaAnnotation( constraintAnnotationType );
+
+		//the validator classes, e.g. [CheckCaseValidator.class]
+		List<? extends AnnotationValue> validatorClassReferences = getValidatorClassesFromConstraintMetaAnnotation(
+				constraintMetaAnnotation
+		);
+
+		for ( AnnotationValue oneValidatorClassReference : validatorClassReferences ) {
+
+			TypeMirror supportedType = getSupportedType( oneValidatorClassReference );
+
+			if ( typeUtils.isAssignable( type, supportedType ) ) {
+				theValue.add( supportedType );
+			}
+		}
+
+		return annotationApiHelper.keepLowestTypePerHierarchy( theValue );
+	}
+
+	private TypeMirror getSupportedType(AnnotationValue oneValidatorClassReference) {
+
+		TypeMirror validatorType = oneValidatorClassReference.accept(
+				new SimpleAnnotationValueVisitor6<TypeMirror, Void>() {
+
+					@Override
+					public TypeMirror visitType(TypeMirror t, Void p) {
+						return t;
+					}
+				}, null
+		);
+
+		// contains the bindings of the type parameters from the implemented
+		// ConstraintValidator interface, e.g. "ConstraintValidator<CheckCase, String>"
+		TypeMirror constraintValidatorImplementation = getConstraintValidatorSuperType( validatorType );
+
+		return constraintValidatorImplementation.accept(
+				new TypeKindVisitor6<TypeMirror, Void>() {
+
+					@Override
+					public TypeMirror visitDeclared(DeclaredType constraintValidatorImplementation, Void p) {
+						// 2nd type parameter contains the data type supported by current validator class, e.g. "String"
+						return constraintValidatorImplementation.getTypeArguments().get( 1 );
+					}
+
+				}, null
+		);
+	}
+
+	private TypeMirror getConstraintValidatorSuperType(TypeMirror type) {
+
+		List<? extends TypeMirror> superTypes = typeUtils.directSupertypes( type );
+		List<TypeMirror> nextSuperTypes = CollectionHelper.newArrayList();
+
+		//follow the type hierarchy upwards, until we have found the ConstraintValidator IF
+		while ( !superTypes.isEmpty() ) {
+
+			for ( TypeMirror oneSuperType : superTypes ) {
+				if ( typeUtils.asElement( oneSuperType ).getSimpleName()
+						.contentEquals( ConstraintValidator.class.getSimpleName() ) ) {
+
+					return oneSuperType;
+				}
+
+				nextSuperTypes.addAll( typeUtils.directSupertypes( oneSuperType ) );
+			}
+
+			superTypes = nextSuperTypes;
+			nextSuperTypes = CollectionHelper.newArrayList();
+		}
+
+		//HV-293: Actually this should never happen, as we can have only ConstraintValidator implementations
+		//here. The Eclipse JSR 269 implementation unfortunately doesn't always create the type hierarchy 
+		//properly though.
+		//TODO GM: create and report an isolated test case
+		throw new IllegalStateException( "Expected type " + type + " to implement javax.validation.ConstraintValidator, but it doesn't." );
+	}
+
+	/**
+	 * Retrieves the {@link Constraint} meta-annotation from the given
+	 * constraint annotation.
+	 *
+	 * @param annotationType A constraint type.
+	 *
+	 * @return The Constraint meta-annotation.
+	 *
+	 * @throws IllegalArgumentException If the given constraint annotation type isn't annotated with
+	 *                                  the {@link Constraint} meta-annotation.
+	 */
+	private AnnotationMirror getConstraintMetaAnnotation(DeclaredType annotationType) {
+
+		List<? extends AnnotationMirror> annotationMirrors = annotationType.asElement().getAnnotationMirrors();
+
+		AnnotationMirror constraintMetaAnnotation = annotationApiHelper.getMirror(
+				annotationMirrors, Constraint.class
+		);
+
+		if ( constraintMetaAnnotation == null ) {
+			throw new IllegalArgumentException( "Given type " + annotationType + " isn't a constraint annotation type." );
+		}
+
+		return constraintMetaAnnotation;
+	}
+
+	private List<? extends AnnotationValue> getValidatorClassesFromConstraintMetaAnnotation(AnnotationMirror constraintMetaAnnotation) {
+
+		AnnotationValue validatedBy = annotationApiHelper.getAnnotationValue( constraintMetaAnnotation, "validatedBy" );
+
+		return validatedBy.accept(
+				new SimpleAnnotationValueVisitor6<List<? extends AnnotationValue>, Void>() {
+
+					@Override
+					public List<? extends AnnotationValue> visitArray(List<? extends AnnotationValue> values, Void p) {
+						return values;
+					}
+
+				}, null
+		);
+	}
+
+	private void registerAllowedTypesForBuiltInConstraint(Class<? extends Annotation> annotation, Set<Class<?>> allowedTypes) {
+
+		Set<TypeMirror> mirrorsForAllowedTypes = CollectionHelper.newHashSet();
+
+		for ( Class<?> oneAllowedType : allowedTypes ) {
+
+			if ( oneAllowedType.isArray() ) {
+				mirrorsForAllowedTypes.add( typeUtils.getArrayType( annotationApiHelper.getMirrorForType( oneAllowedType.getComponentType() ) ) );
+			}
+			else {
+				mirrorsForAllowedTypes.add( annotationApiHelper.getMirrorForType( oneAllowedType ) );
+			}
+
+		}
+
+		builtInConstraints.put( elementUtils.getName( annotation.getSimpleName() ), mirrorsForAllowedTypes );
+	}
+
+	/**
+	 * Checks, whether the given constraint annotation type is a built-in
+	 * constraint annotation (which is the case, if it is declared in the
+	 * package <code>javax.validation.constraints</code>).
+	 *
+	 * @param constraintAnnotationType The type to check.
+	 *
+	 * @return True, if the given type is a constraint annotation, false
+	 *         otherwise.
+	 */
+	private boolean isBuiltInConstraint(DeclaredType constraintAnnotationType) {
+
+		return
+				CONSTRAINT_ANNOTATION_PACKAGE_NAME.equals(
+						elementUtils.getPackageOf( constraintAnnotationType.asElement() ).getQualifiedName()
+				);
+	}
+
+	private Set<AnnotationMirror> getComposingConstraints(DeclaredType constraintAnnotationType) {
+
+		Set<AnnotationMirror> theValue = CollectionHelper.newHashSet();
+
+		List<? extends AnnotationMirror> annotationMirrors = constraintAnnotationType.asElement()
+				.getAnnotationMirrors();
+
+		for ( AnnotationMirror oneAnnotationMirror : annotationMirrors ) {
+			if ( isConstraintAnnotation( oneAnnotationMirror.getAnnotationType().asElement() ) ) {
+				theValue.add( oneAnnotationMirror );
+			}
+		}
+
+		return theValue;
+	}
+
+}
diff --git a/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/util/MessagerAdapter.java b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/util/MessagerAdapter.java
new file mode 100644
index 0000000..b256ee5
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/main/java/org/hibernate/validator/ap/util/MessagerAdapter.java
@@ -0,0 +1,102 @@
+// $Id: MessagerAdapter.java 19310 2010-04-27 22:51:17Z gunnar.morling $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.util;
+
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+import java.util.Set;
+import javax.annotation.processing.Messager;
+import javax.tools.Diagnostic.Kind;
+
+import org.hibernate.validator.ap.checks.ConstraintCheckError;
+
+/**
+ * Wrapper around {@link Messager}, which adds the ability to format error messages using {@link MessageFormat}.
+ *
+ * @author Gunnar Morling
+ */
+public class MessagerAdapter {
+
+	/**
+	 * Contains the texts to be displayed.
+	 */
+	private final ResourceBundle errorMessages;
+
+	private final Messager messager;
+
+	/**
+	 * The kind of diagnostic to be used when reporting any problems.
+	 */
+	private Kind diagnosticKind;
+
+	/**
+	 * Creates a new MessagerAdapter.
+	 *
+	 * @param messager The underlying messager.
+	 * @param diagnosticKind The kind with which messages shall be reported.
+	 */
+	public MessagerAdapter(Messager messager, Kind diagnosticKind) {
+
+		this.messager = messager;
+		this.diagnosticKind = diagnosticKind;
+
+		errorMessages = ResourceBundle.getBundle( "org.hibernate.validator.ap.ValidationProcessorMessages" );
+	}
+
+	/**
+	 * Returns the messager used by this adapter.
+	 *
+	 * @return The underlying messager.
+	 */
+	public Messager getDelegate() {
+		return messager;
+	}
+
+	/**
+	 * Reports the given errors against the underlying {@link Messager} using
+	 * the specified {@link Kind}.
+	 *
+	 * @param errors A set with errors to report. May be empty but must not be
+	 * null.
+	 */
+	public void reportErrors(Set<ConstraintCheckError> errors) {
+		for ( ConstraintCheckError oneError : errors ) {
+			reportError( oneError );
+		}
+	}
+
+	/**
+	 * Reports the given error. Message parameters will be put into the template
+	 * retrieved from the resource bundle if applicable.
+	 *
+	 * @param error The error to report.
+	 */
+	private void reportError(ConstraintCheckError error) {
+
+		String message = errorMessages.getString( error.getMessageKey() );
+
+		if ( error.getMessageParameters() != null ) {
+			message = MessageFormat.format( message, error.getMessageParameters() );
+		}
+
+		messager.printMessage(
+				diagnosticKind, message, error.getElement(), error.getAnnotationMirror()
+		);
+	}
+
+}
diff --git a/hibernate-validator-annotation-processor/src/main/resources/META-INF/services/javax.annotation.processing.Processor b/hibernate-validator-annotation-processor/src/main/resources/META-INF/services/javax.annotation.processing.Processor
new file mode 100644
index 0000000..bfffe2c
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/main/resources/META-INF/services/javax.annotation.processing.Processor
@@ -0,0 +1 @@
+org.hibernate.validator.ap.ConstraintValidationProcessor
\ No newline at end of file
diff --git a/hibernate-validator-annotation-processor/src/main/resources/org/hibernate/validator/ap/ValidationProcessorMessages.properties b/hibernate-validator-annotation-processor/src/main/resources/org/hibernate/validator/ap/ValidationProcessorMessages.properties
new file mode 100644
index 0000000..f13af72
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/main/resources/org/hibernate/validator/ap/ValidationProcessorMessages.properties
@@ -0,0 +1,13 @@
+# $Id: ValidationProcessorMessages.properties 17927 2009-11-05 09:51:52Z hardy.ferentschik $
+#
+# Contains error messages to be used by the ConstraintValidationProcessor.
+
+ONLY_GETTERS_MAY_BE_ANNOTATED=Constraint annotations must not be specified at methods, which are no valid JavaBeans getter methods.
+NOT_SUPPORTED_TYPE=The annotation @{0} is disallowed for this data type.
+NOT_SUPPORTED_RETURN_TYPE=The annotation @{0} is disallowed for the return type of this method.
+ONLY_CONSTRAINT_ANNOTATIONS_MAY_BE_ANNOTATED=Constraint annotations must not be specified at annotation types, which are no constraint annotation types themselves.
+STATIC_METHODS_MAY_NOT_BE_ANNOTATED=Only non-static methods may be annotated with constraint annotations.
+STATIC_FIELDS_MAY_NOT_BE_ANNOTATED=Only non-static fields may be annotated with constraint annotations.
+INVALID_DIAGNOSTIC_KIND_GIVEN=The given value {0} is no valid diagnostic kind. Kind.ERROR will be used.
+ATVALID_NOT_ALLOWED_AT_PRIMITIVE_FIELD=Fields of a primitive type must not annotated with @Valid.
+ATVALID_NOT_ALLOWED_AT_METHOD_RETURNING_PRIMITIVE_TYPE=Methods returning a primitive type must not annotated with @Valid.
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/ConstraintValidationProcessorTest.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/ConstraintValidationProcessorTest.java
new file mode 100644
index 0000000..30e042b
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/ConstraintValidationProcessorTest.java
@@ -0,0 +1,386 @@
+// $Id: ConstraintValidationProcessorTest.java 19525 2010-05-15 16:05:09Z gunnar.morling $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap;
+
+import java.io.File;
+import javax.tools.Diagnostic;
+import javax.tools.Diagnostic.Kind;
+import javax.tools.DiagnosticCollector;
+import javax.tools.JavaFileObject;
+import javax.tools.ToolProvider;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.ap.testmodel.FieldLevelValidationUsingBuiltInConstraints;
+import org.hibernate.validator.ap.testmodel.MethodLevelValidationUsingBuiltInConstraints;
+import org.hibernate.validator.ap.testmodel.MultipleConstraintsOfSameType;
+import org.hibernate.validator.ap.testmodel.ValidationUsingAtValidAnnotation;
+import org.hibernate.validator.ap.testmodel.boxing.ValidLong;
+import org.hibernate.validator.ap.testmodel.boxing.ValidLongValidator;
+import org.hibernate.validator.ap.testmodel.boxing.ValidationUsingBoxing;
+import org.hibernate.validator.ap.testmodel.classlevelconstraints.ClassLevelValidation;
+import org.hibernate.validator.ap.testmodel.classlevelconstraints.ValidCustomer;
+import org.hibernate.validator.ap.testmodel.classlevelconstraints.ValidCustomerValidator;
+import org.hibernate.validator.ap.testmodel.composedconstraint.FieldLevelValidationUsingComposedConstraint;
+import org.hibernate.validator.ap.testmodel.composedconstraint.ValidOrderNumber;
+import org.hibernate.validator.ap.testmodel.composedconstraint2.ComposedConstraint;
+import org.hibernate.validator.ap.testmodel.composedconstraint2.ComposingConstraint1;
+import org.hibernate.validator.ap.testmodel.composedconstraint2.ComposingConstraint1ValidatorForGregorianCalendar;
+import org.hibernate.validator.ap.testmodel.composedconstraint2.ComposingConstraint1ValidatorForList;
+import org.hibernate.validator.ap.testmodel.composedconstraint2.ComposingConstraint1ValidatorForString;
+import org.hibernate.validator.ap.testmodel.composedconstraint2.ComposingConstraint2;
+import org.hibernate.validator.ap.testmodel.composedconstraint2.ComposingConstraint2ValidatorForArrayList;
+import org.hibernate.validator.ap.testmodel.composedconstraint2.ComposingConstraint2ValidatorForCalendar;
+import org.hibernate.validator.ap.testmodel.composedconstraint2.ComposingConstraint2ValidatorForCollection;
+import org.hibernate.validator.ap.testmodel.composedconstraint2.FieldLevelValidationUsingComplexComposedConstraint;
+import org.hibernate.validator.ap.testmodel.customconstraints.CaseMode;
+import org.hibernate.validator.ap.testmodel.customconstraints.CheckCase;
+import org.hibernate.validator.ap.testmodel.customconstraints.CheckCaseValidator;
+import org.hibernate.validator.ap.testmodel.customconstraints.FieldLevelValidationUsingCustomConstraints;
+import org.hibernate.validator.ap.testmodel.inheritedvalidator.AbstractCustomConstraintValidator;
+import org.hibernate.validator.ap.testmodel.inheritedvalidator.CustomConstraint;
+import org.hibernate.validator.ap.testmodel.inheritedvalidator.CustomConstraintValidator;
+import org.hibernate.validator.ap.testmodel.inheritedvalidator.FieldLevelValidationUsingInheritedValidator;
+import org.hibernate.validator.ap.testmodel.invalidcomposedconstraint.ValidCustomerNumber;
+import org.hibernate.validator.ap.testmodel.nouniquevalidatorresolution.NoUniqueValidatorResolution;
+import org.hibernate.validator.ap.testmodel.nouniquevalidatorresolution.SerializableCollection;
+import org.hibernate.validator.ap.testmodel.nouniquevalidatorresolution.Size;
+import org.hibernate.validator.ap.testmodel.nouniquevalidatorresolution.SizeValidatorForCollection;
+import org.hibernate.validator.ap.testmodel.nouniquevalidatorresolution.SizeValidatorForSerializable;
+import org.hibernate.validator.ap.testmodel.nouniquevalidatorresolution.SizeValidatorForSet;
+import org.hibernate.validator.ap.testutil.CompilerTestHelper;
+import org.hibernate.validator.ap.util.DiagnosticExpectation;
+
+import static org.hibernate.validator.ap.testutil.CompilerTestHelper.assertThatDiagnosticsMatch;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+/**
+ * Test for {@link ConstraintValidationProcessor} using the Java compiler
+ * API as defined by JSR 199.
+ *
+ * @author Gunnar Morling.
+ */
+public class ConstraintValidationProcessorTest {
+
+	private static CompilerTestHelper compilerHelper;
+
+	private DiagnosticCollector<JavaFileObject> diagnostics;
+
+	@BeforeClass
+	public static void setUpCompilerHelper() {
+
+		String testSourceBaseDir = System.getProperty( "testSourceBaseDir" );
+		String pathToBeanValidationApiJar = System.getProperty( "pathToBeanValidationApiJar" );
+
+		assertNotNull(
+				testSourceBaseDir,
+				"The system property testSourceBaseDir has to be set and point to the base directory of the test java sources."
+		);
+		assertNotNull(
+				pathToBeanValidationApiJar,
+				"The system property pathToBeanValidationApiJar has to be set and point to the BV API Jars."
+		);
+
+		compilerHelper =
+				new CompilerTestHelper(
+						ToolProvider.getSystemJavaCompiler(), testSourceBaseDir, pathToBeanValidationApiJar
+				);
+	}
+
+	@BeforeMethod
+	public void setUp() {
+		diagnostics = new DiagnosticCollector<JavaFileObject>();
+	}
+
+	@Test
+	public void fieldLevelValidationUsingBuiltInConstraints() {
+
+		File sourceFile = compilerHelper.getSourceFile( FieldLevelValidationUsingBuiltInConstraints.class );
+
+		boolean compilationResult =
+				compilerHelper.compile( new ConstraintValidationProcessor(), diagnostics, sourceFile );
+
+		assertFalse( compilationResult );
+		assertThatDiagnosticsMatch(
+				diagnostics, new DiagnosticExpectation( Kind.ERROR, 54 ), new DiagnosticExpectation( Kind.ERROR, 60 )
+		);
+	}
+
+	@Test
+	public void testThatProcessorOptionsAreEvaluated() {
+
+		File sourceFile = compilerHelper.getSourceFile( FieldLevelValidationUsingBuiltInConstraints.class );
+
+		// compile with -AdiagnosticKind=Kind.WARNING and -Averbose=true
+		boolean compilationResult =
+				compilerHelper.compile(
+						new ConstraintValidationProcessor(), diagnostics, Kind.WARNING, true, sourceFile
+				);
+
+		// compilation succeeds as there are problems, but Kind.WARNING won't stop compilation
+		assertTrue( compilationResult );
+
+		assertThatDiagnosticsMatch(
+				diagnostics,
+				new DiagnosticExpectation( Kind.NOTE, Diagnostic.NOPOS ), //says that verbose messaging is enabled
+				new DiagnosticExpectation( Kind.WARNING, 54 ),
+				new DiagnosticExpectation( Kind.WARNING, 60 )
+		);
+	}
+
+	@Test
+	public void fieldLevelValidationUsingCustomConstraints() {
+
+		File sourceFile1 = compilerHelper.getSourceFile( FieldLevelValidationUsingCustomConstraints.class );
+		File sourceFile2 = compilerHelper.getSourceFile( CheckCase.class );
+		File sourceFile3 = compilerHelper.getSourceFile( CaseMode.class );
+		File sourceFile4 = compilerHelper.getSourceFile( CheckCaseValidator.class );
+
+		boolean compilationResult =
+				compilerHelper.compile(
+						new ConstraintValidationProcessor(),
+						diagnostics,
+						sourceFile1,
+						sourceFile2,
+						sourceFile3,
+						sourceFile4
+				);
+
+		assertFalse( compilationResult );
+		assertThatDiagnosticsMatch( diagnostics, new DiagnosticExpectation( Kind.ERROR, 30 ) );
+	}
+
+	@Test
+	public void testThatInheritedValidatorClassesAreHandledCorrectly() {
+
+		File sourceFile1 = compilerHelper.getSourceFile( FieldLevelValidationUsingInheritedValidator.class );
+		File sourceFile2 = compilerHelper.getSourceFile( CustomConstraint.class );
+		File sourceFile3 = compilerHelper.getSourceFile( AbstractCustomConstraintValidator.class );
+		File sourceFile4 = compilerHelper.getSourceFile( CustomConstraintValidator.class );
+
+		boolean compilationResult =
+				compilerHelper.compile(
+						new ConstraintValidationProcessor(),
+						diagnostics,
+						sourceFile1,
+						sourceFile2,
+						sourceFile3,
+						sourceFile4
+				);
+
+		assertFalse( compilationResult );
+		assertThatDiagnosticsMatch( diagnostics, new DiagnosticExpectation( Kind.ERROR, 30 ) );
+	}
+
+	@Test
+	public void methodLevelValidationUsingBuiltInConstraints() {
+
+		File sourceFile = compilerHelper.getSourceFile( MethodLevelValidationUsingBuiltInConstraints.class );
+
+		boolean compilationResult =
+				compilerHelper.compile( new ConstraintValidationProcessor(), diagnostics, sourceFile );
+
+		assertFalse( compilationResult );
+		assertThatDiagnosticsMatch(
+				diagnostics,
+				new DiagnosticExpectation( Kind.ERROR, 32 ),
+				new DiagnosticExpectation( Kind.ERROR, 39 ),
+				new DiagnosticExpectation( Kind.ERROR, 47 ),
+				new DiagnosticExpectation( Kind.ERROR, 54 )
+		);
+	}
+
+	@Test
+	public void classLevelValidation() {
+
+		File sourceFile1 = compilerHelper.getSourceFile( ClassLevelValidation.class );
+		File sourceFile2 = compilerHelper.getSourceFile( ValidCustomer.class );
+		File sourceFile3 = compilerHelper.getSourceFile( ValidCustomerValidator.class );
+
+		boolean compilationResult =
+				compilerHelper.compile(
+						new ConstraintValidationProcessor(), diagnostics, sourceFile1, sourceFile2, sourceFile3
+				);
+
+		assertFalse( compilationResult );
+		assertThatDiagnosticsMatch( diagnostics, new DiagnosticExpectation( Kind.ERROR, 28 ) );
+	}
+
+	@Test
+	public void validationUsingComposedConstraint() {
+
+		File sourceFile1 = compilerHelper.getSourceFile( FieldLevelValidationUsingComposedConstraint.class );
+		File sourceFile2 = compilerHelper.getSourceFile( ValidOrderNumber.class );
+
+		boolean compilationResult =
+				compilerHelper.compile( new ConstraintValidationProcessor(), diagnostics, sourceFile1, sourceFile2 );
+
+		assertFalse( compilationResult );
+		assertThatDiagnosticsMatch( diagnostics, new DiagnosticExpectation( Kind.ERROR, 29 ) );
+	}
+
+	@Test
+	public void validationUsingComplexComposedConstraint() {
+
+		File sourceFile1 = compilerHelper.getSourceFile( FieldLevelValidationUsingComplexComposedConstraint.class );
+		File sourceFile2 = compilerHelper.getSourceFile( ComposedConstraint.class );
+		File sourceFile3 = compilerHelper.getSourceFile( ComposingConstraint1.class );
+		File sourceFile4 = compilerHelper.getSourceFile( ComposingConstraint1ValidatorForString.class );
+		File sourceFile5 = compilerHelper.getSourceFile( ComposingConstraint1ValidatorForGregorianCalendar.class );
+		File sourceFile6 = compilerHelper.getSourceFile( ComposingConstraint1ValidatorForList.class );
+		File sourceFile7 = compilerHelper.getSourceFile( ComposingConstraint2.class );
+		File sourceFile8 = compilerHelper.getSourceFile( ComposingConstraint2ValidatorForArrayList.class );
+		File sourceFile9 = compilerHelper.getSourceFile( ComposingConstraint2ValidatorForCalendar.class );
+		File sourceFile10 = compilerHelper.getSourceFile( ComposingConstraint2ValidatorForCollection.class );
+
+		boolean compilationResult =
+				compilerHelper.compile(
+						new ConstraintValidationProcessor(),
+						diagnostics,
+						sourceFile1,
+						sourceFile2,
+						sourceFile3,
+						sourceFile4,
+						sourceFile5,
+						sourceFile6,
+						sourceFile7,
+						sourceFile8,
+						sourceFile9,
+						sourceFile10
+				);
+
+		assertFalse( compilationResult );
+		assertThatDiagnosticsMatch(
+				diagnostics,
+				new DiagnosticExpectation( Kind.ERROR, 29 ),
+				new DiagnosticExpectation( Kind.ERROR, 41 ),
+				new DiagnosticExpectation( Kind.ERROR, 50 ),
+				new DiagnosticExpectation( Kind.ERROR, 56 )
+		);
+	}
+
+	@Test
+	public void validationUsingBoxing() {
+
+		File sourceFile1 = compilerHelper.getSourceFile( ValidationUsingBoxing.class );
+		File sourceFile2 = compilerHelper.getSourceFile( ValidLong.class );
+		File sourceFile3 = compilerHelper.getSourceFile( ValidLongValidator.class );
+
+		boolean compilationResult =
+				compilerHelper.compile(
+						new ConstraintValidationProcessor(), diagnostics, sourceFile1, sourceFile2, sourceFile3
+				);
+
+		assertFalse( compilationResult );
+		assertThatDiagnosticsMatch(
+				diagnostics,
+				new DiagnosticExpectation( Kind.ERROR, 31 ),
+				new DiagnosticExpectation( Kind.ERROR, 37 ),
+				new DiagnosticExpectation( Kind.ERROR, 43 ),
+				new DiagnosticExpectation( Kind.ERROR, 59 ),
+				new DiagnosticExpectation( Kind.ERROR, 67 )
+		);
+	}
+
+	@Test
+	public void testThatSpecifyingConstraintAnnotationAtNonConstraintAnnotationTypeCausesCompilationError() {
+
+		File sourceFile = compilerHelper.getSourceFile( ValidCustomerNumber.class );
+
+		boolean compilationResult =
+				compilerHelper.compile( new ConstraintValidationProcessor(), diagnostics, sourceFile );
+
+		assertFalse( compilationResult );
+		assertThatDiagnosticsMatch(
+				diagnostics, new DiagnosticExpectation( Kind.ERROR, 28 ), new DiagnosticExpectation( Kind.ERROR, 29 )
+		);
+	}
+
+	@Test
+	public void testThatNonUniqueValidatorResolutionCausesCompilationError() {
+
+		File sourceFile1 = compilerHelper.getSourceFile( NoUniqueValidatorResolution.class );
+		File sourceFile2 = compilerHelper.getSourceFile( Size.class );
+		File sourceFile3 = compilerHelper.getSourceFile( SizeValidatorForCollection.class );
+		File sourceFile4 = compilerHelper.getSourceFile( SizeValidatorForSerializable.class );
+		File sourceFile5 = compilerHelper.getSourceFile( SerializableCollection.class );
+		File sourceFile6 = compilerHelper.getSourceFile( SizeValidatorForSet.class );
+
+		boolean compilationResult =
+				compilerHelper.compile(
+						new ConstraintValidationProcessor(),
+						diagnostics,
+						sourceFile1,
+						sourceFile2,
+						sourceFile3,
+						sourceFile4,
+						sourceFile5,
+						sourceFile6
+				);
+
+		assertFalse( compilationResult );
+		assertThatDiagnosticsMatch(
+				diagnostics, new DiagnosticExpectation(
+						Kind.ERROR, 33
+				)
+		);
+	}
+
+	@Test
+	public void testThatMultiValuedConstrainedIsOnlyGivenAtSupportedType() {
+
+		File sourceFile1 = compilerHelper.getSourceFile( MultipleConstraintsOfSameType.class );
+
+		boolean compilationResult = compilerHelper.compile(
+				new ConstraintValidationProcessor(), diagnostics, sourceFile1
+		);
+
+		assertFalse( compilationResult );
+		assertThatDiagnosticsMatch(
+				diagnostics,
+				new DiagnosticExpectation( Kind.ERROR, 33 ),
+				new DiagnosticExpectation( Kind.ERROR, 33 )
+		);
+	}
+
+	@Test
+	public void testThatAtValidAnnotationGivenAtNotSupportedTypesCausesCompilationErrors() {
+
+		File sourceFile1 = compilerHelper.getSourceFile( ValidationUsingAtValidAnnotation.class );
+
+		boolean compilationResult = compilerHelper.compile(
+				new ConstraintValidationProcessor(), diagnostics, sourceFile1
+		);
+
+		assertFalse( compilationResult );
+		assertThatDiagnosticsMatch(
+				diagnostics,
+				new DiagnosticExpectation( Kind.ERROR, 34 ),
+				new DiagnosticExpectation( Kind.ERROR, 40 ),
+				new DiagnosticExpectation( Kind.ERROR, 56 ),
+				new DiagnosticExpectation( Kind.ERROR, 64 ),
+				new DiagnosticExpectation( Kind.ERROR, 72 ),
+				new DiagnosticExpectation( Kind.ERROR, 80 ),
+				new DiagnosticExpectation( Kind.ERROR, 88 )
+		);
+	}
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/FieldLevelValidationUsingBuiltInConstraints.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/FieldLevelValidationUsingBuiltInConstraints.java
new file mode 100644
index 0000000..a889b9f
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/FieldLevelValidationUsingBuiltInConstraints.java
@@ -0,0 +1,71 @@
+// $Id: FieldLevelValidationUsingBuiltInConstraints.java 18897 2010-02-25 19:12:35Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+import javax.validation.constraints.Size;
+
+public class FieldLevelValidationUsingBuiltInConstraints {
+
+	@Size(min = 10)
+	public String string;
+
+	@Size(min = 10)
+	public Collection collection1;
+
+	@Size(min = 10)
+	public Collection<?> collection2;
+
+	@Size(min = 10)
+	public Collection<String> stringCollection;
+
+	/**
+	 * Allowed, as List extends Collection.
+	 */
+	@Size(min = 10)
+	public List list1;
+
+	@Size(min = 10)
+	public List<?> list2;
+
+	@Size(min = 10)
+	public List<String> stringList;
+
+	/**
+	 * Not allowed (unsupported type).
+	 */
+	@Size(min = 10)
+	public Date date;
+
+	/**
+	 * Not allowed (static field).
+	 */
+	@Size(min = 10)
+	public static String staticString;
+
+	@Size(min = 10)
+	public Object[] objectArray;
+
+	@Size(min = 10)
+	public Integer[] integerArray;
+
+	@Size(min = 10)
+	public int[] intArray;
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/MethodLevelValidationUsingBuiltInConstraints.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/MethodLevelValidationUsingBuiltInConstraints.java
new file mode 100644
index 0000000..a97ef04
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/MethodLevelValidationUsingBuiltInConstraints.java
@@ -0,0 +1,58 @@
+// $Id: MethodLevelValidationUsingBuiltInConstraints.java 18896 2010-02-25 19:04:40Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel;
+
+import java.util.Date;
+import javax.validation.constraints.Size;
+
+public class MethodLevelValidationUsingBuiltInConstraints {
+	@Size(min = 10)
+	public String getString() {
+		return null;
+	}
+
+	/**
+	 * Not allowed. Method is no getter.
+	 */
+	@Size(min = 10)
+	public void setString() {
+	}
+
+	/**
+	 * Not allowed. Return type doesn't match.
+	 */
+	@Size(min = 10)
+	public Date getDate() {
+		return null;
+	}
+
+	/**
+	 * Not allowed. No return type.
+	 */
+	@Size(min = 10)
+	public void getAnotherString() {
+	}
+
+	/**
+	 * Not allowed. Static method.
+	 */
+	@Size(min = 10)
+	public static String getStringStatically() {
+		return null;
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/MultipleConstraintsOfSameType.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/MultipleConstraintsOfSameType.java
new file mode 100644
index 0000000..8ff9ea3
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/MultipleConstraintsOfSameType.java
@@ -0,0 +1,35 @@
+// $Id: MultipleConstraintsOfSameType.java 18897 2010-02-25 19:12:35Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel;
+
+import java.util.Date;
+
+import javax.validation.constraints.Pattern;
+import javax.validation.constraints.Pattern.List;
+
+public class MultipleConstraintsOfSameType {
+	
+	@List(value = { @Pattern(regexp = ""), @Pattern(regexp = "") })
+	public String string;
+
+	/**
+	 * Not allowed.
+	 */
+	@List(value = { @Pattern(regexp = ""), @Pattern(regexp = "") })
+	public Date date;
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/ValidationUsingAtValidAnnotation.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/ValidationUsingAtValidAnnotation.java
new file mode 100644
index 0000000..d9344ac
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/ValidationUsingAtValidAnnotation.java
@@ -0,0 +1,91 @@
+// $Id: ValidationUsingAtValidAnnotation.java 19090 2010-03-23 15:22:59Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel;
+
+import java.util.Collection;
+import javax.validation.Valid;
+
+public class ValidationUsingAtValidAnnotation {
+
+	@Valid
+	public Integer integer;
+
+	@Valid
+	public Collection<?> collection1;
+
+	/**
+	 * Not allowed (primitive type).
+	 */
+	@Valid
+	public int primitiveInt;
+
+	/**
+	 * Not allowed (static field).
+	 */
+	@Valid
+	public static Integer staticInteger;
+
+	@Valid
+	public Integer getInteger() {
+		return null;
+	}
+
+	@Valid
+	public Collection<?> getCollection() {
+		return null;
+	}
+
+	/**
+	 * Not allowed (primitive type).
+	 */
+	@Valid
+	public int getPrimitiveInt() {
+		return 0;
+	}
+
+	/**
+	 * Not allowed (static field).
+	 */
+	@Valid
+	public static Integer getStaticInteger() {
+		return null;
+	}
+
+	/**
+	 * Not allowed (no getter).
+	 */
+	@Valid
+	public Collection<?> getCollectionWithParams(int i) {
+		return null;
+	}
+
+	/**
+	 * Not allowed (no getter).
+	 */
+	@Valid
+	public Collection<?> setCollection() {
+		return null;
+	}
+
+	/**
+	 * Not allowed (no getter).
+	 */
+	@Valid
+	public void getVoid() {
+	}
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/boxing/ValidLong.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/boxing/ValidLong.java
new file mode 100644
index 0000000..b31b754
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/boxing/ValidLong.java
@@ -0,0 +1,41 @@
+// $Id: ValidLong.java 18896 2010-02-25 19:04:40Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.boxing;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+ at Target({ METHOD, FIELD, ANNOTATION_TYPE })
+ at Retention(RUNTIME)
+ at Constraint(validatedBy = ValidLongValidator.class)
+ at Documented
+public @interface ValidLong {
+	String message() default "";
+
+	Class<?>[] groups() default { };
+
+	Class<? extends Payload>[] payload() default { };
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/boxing/ValidLongValidator.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/boxing/ValidLongValidator.java
new file mode 100644
index 0000000..84296d9
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/boxing/ValidLongValidator.java
@@ -0,0 +1,30 @@
+// $Id: ValidLongValidator.java 18896 2010-02-25 19:04:40Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.boxing;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+public class ValidLongValidator implements ConstraintValidator<ValidLong, Long> {
+	public void initialize(ValidLong constraintAnnotation) {
+	}
+
+	public boolean isValid(Long object, ConstraintValidatorContext constraintContext) {
+		return true;
+	}
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/boxing/ValidationUsingBoxing.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/boxing/ValidationUsingBoxing.java
new file mode 100644
index 0000000..f16bdd4
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/boxing/ValidationUsingBoxing.java
@@ -0,0 +1,72 @@
+// $Id: ValidationUsingBoxing.java 18896 2010-02-25 19:04:40Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.boxing;
+
+public class ValidationUsingBoxing {
+
+	@ValidLong
+	public long primitiveLongField;
+
+	@ValidLong
+	public Long longField;
+
+	/**
+	 * Not allowed.
+	 */
+	@ValidLong
+	public int intField;
+
+	/**
+	 * Not allowed.
+	 */
+	@ValidLong
+	public Integer integerField;
+
+	/**
+	 * Not allowed.
+	 */
+	@ValidLong
+	public double doubleField;
+
+	@ValidLong
+	public long getPrimitiveLong() {
+		return 0;
+	}
+
+	@ValidLong
+	public Long getLong() {
+		return Long.MIN_VALUE;
+	}
+
+	/**
+	 * Not allowed.
+	 */
+	@ValidLong
+	public int getInt() {
+		return 0;
+	}
+
+	/**
+	 * Not allowed.
+	 */
+	@ValidLong
+	public Integer getInteger() {
+		return Integer.MIN_VALUE;
+	}
+
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/classlevelconstraints/ClassLevelValidation.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/classlevelconstraints/ClassLevelValidation.java
new file mode 100644
index 0000000..2195d06
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/classlevelconstraints/ClassLevelValidation.java
@@ -0,0 +1,31 @@
+// $Id: ClassLevelValidation.java 18896 2010-02-25 19:04:40Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.classlevelconstraints;
+
+public class ClassLevelValidation {
+	@ValidCustomer
+	public static class Customer {
+	}
+
+	/**
+	 * Not allowed.
+	 */
+	@ValidCustomer
+	public static class Order {
+	}
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/classlevelconstraints/ValidCustomer.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/classlevelconstraints/ValidCustomer.java
new file mode 100644
index 0000000..b7fe256
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/classlevelconstraints/ValidCustomer.java
@@ -0,0 +1,39 @@
+// $Id: ValidCustomer.java 18896 2010-02-25 19:04:40Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.classlevelconstraints;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+ at Target({ TYPE })
+ at Retention(RUNTIME)
+ at Constraint(validatedBy = ValidCustomerValidator.class)
+ at Documented
+public @interface ValidCustomer {
+	String message() default "";
+
+	Class<?>[] groups() default { };
+
+	Class<? extends Payload>[] payload() default { };
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/classlevelconstraints/ValidCustomerValidator.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/classlevelconstraints/ValidCustomerValidator.java
new file mode 100644
index 0000000..604388e
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/classlevelconstraints/ValidCustomerValidator.java
@@ -0,0 +1,32 @@
+// $Id: ValidCustomerValidator.java 18896 2010-02-25 19:04:40Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.classlevelconstraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+import org.hibernate.validator.ap.testmodel.classlevelconstraints.ClassLevelValidation.Customer;
+
+public class ValidCustomerValidator implements ConstraintValidator<ValidCustomer, Customer> {
+	public void initialize(ValidCustomer constraintAnnotation) {
+	}
+
+	public boolean isValid(Customer customer, ConstraintValidatorContext constraintContext) {
+		return true;
+	}
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint/FieldLevelValidationUsingComposedConstraint.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint/FieldLevelValidationUsingComposedConstraint.java
new file mode 100644
index 0000000..260d9f8
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint/FieldLevelValidationUsingComposedConstraint.java
@@ -0,0 +1,31 @@
+// $Id: FieldLevelValidationUsingComposedConstraint.java 18896 2010-02-25 19:04:40Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.composedconstraint;
+
+import java.util.Date;
+
+public class FieldLevelValidationUsingComposedConstraint {
+	@ValidOrderNumber
+	public String string;
+
+	/**
+	 * Not allowed.
+	 */
+	@ValidOrderNumber
+	public Date date;
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint/ValidOrderNumber.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint/ValidOrderNumber.java
new file mode 100644
index 0000000..cab0bc7
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint/ValidOrderNumber.java
@@ -0,0 +1,45 @@
+// $Id: ValidOrderNumber.java 18896 2010-02-25 19:04:40Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.composedconstraint;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+ at NotNull
+ at Size(min = 10, max = 10)
+ at Target({ METHOD, FIELD, ANNOTATION_TYPE })
+ at Retention(RUNTIME)
+ at Constraint(validatedBy = { })
+ at Documented
+public @interface ValidOrderNumber {
+	String message() default "";
+
+	Class<?>[] groups() default { };
+
+	Class<? extends Payload>[] payload() default { };
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/ComposedConstraint.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/ComposedConstraint.java
new file mode 100644
index 0000000..52a7cd4
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/ComposedConstraint.java
@@ -0,0 +1,43 @@
+// $Id: ComposedConstraint.java 18896 2010-02-25 19:04:40Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.composedconstraint2;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+ at ComposingConstraint1
+ at ComposingConstraint2
+ at Target({ METHOD, FIELD, ANNOTATION_TYPE })
+ at Retention(RUNTIME)
+ at Constraint(validatedBy = { })
+ at Documented
+public @interface ComposedConstraint {
+	String message() default "";
+
+	Class<?>[] groups() default { };
+
+	Class<? extends Payload>[] payload() default { };
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/ComposingConstraint1.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/ComposingConstraint1.java
new file mode 100644
index 0000000..005adba
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/ComposingConstraint1.java
@@ -0,0 +1,45 @@
+// $Id: ComposingConstraint1.java 18896 2010-02-25 19:04:40Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.composedconstraint2;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+ at Target({ METHOD, FIELD, ANNOTATION_TYPE })
+ at Retention(RUNTIME)
+ at Constraint(validatedBy = {
+		ComposingConstraint1ValidatorForList.class,
+		ComposingConstraint1ValidatorForString.class,
+		ComposingConstraint1ValidatorForGregorianCalendar.class
+})
+ at Documented
+public @interface ComposingConstraint1 {
+	String message() default "";
+
+	Class<?>[] groups() default { };
+
+	Class<? extends Payload>[] payload() default { };
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/ComposingConstraint1ValidatorForGregorianCalendar.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/ComposingConstraint1ValidatorForGregorianCalendar.java
new file mode 100644
index 0000000..0729eac
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/ComposingConstraint1ValidatorForGregorianCalendar.java
@@ -0,0 +1,32 @@
+// $Id: ComposingConstraint1ValidatorForGregorianCalendar.java 18896 2010-02-25 19:04:40Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.composedconstraint2;
+
+import java.util.GregorianCalendar;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+public class ComposingConstraint1ValidatorForGregorianCalendar
+		implements ConstraintValidator<ComposingConstraint1, GregorianCalendar> {
+	public void initialize(ComposingConstraint1 constraintAnnotation) {
+	}
+
+	public boolean isValid(GregorianCalendar object, ConstraintValidatorContext constraintContext) {
+		return true;
+	}
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/ComposingConstraint1ValidatorForList.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/ComposingConstraint1ValidatorForList.java
new file mode 100644
index 0000000..f74ff3e
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/ComposingConstraint1ValidatorForList.java
@@ -0,0 +1,32 @@
+// $Id: ComposingConstraint1ValidatorForList.java 18896 2010-02-25 19:04:40Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.composedconstraint2;
+
+import java.util.List;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+public class ComposingConstraint1ValidatorForList implements ConstraintValidator<ComposingConstraint1, List<?>> {
+	public void initialize(ComposingConstraint1 constraintAnnotation) {
+
+	}
+
+	public boolean isValid(List<?> object, ConstraintValidatorContext constraintContext) {
+		return true;
+	}
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/ComposingConstraint1ValidatorForString.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/ComposingConstraint1ValidatorForString.java
new file mode 100644
index 0000000..3cd0e8f
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/ComposingConstraint1ValidatorForString.java
@@ -0,0 +1,38 @@
+// $Id: ComposingConstraint1ValidatorForString.java 18896 2010-02-25 19:04:40Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.composedconstraint2;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+public class ComposingConstraint1ValidatorForString implements
+ConstraintValidator<ComposingConstraint1, String> {
+
+	
+
+	public void initialize(ComposingConstraint1 constraintAnnotation) {
+		
+	}
+
+	public boolean isValid(String object,
+			ConstraintValidatorContext constraintContext) {
+
+		return true;
+	}
+
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/ComposingConstraint2.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/ComposingConstraint2.java
new file mode 100644
index 0000000..8362d8d
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/ComposingConstraint2.java
@@ -0,0 +1,45 @@
+// $Id: ComposingConstraint2.java 18896 2010-02-25 19:04:40Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.composedconstraint2;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+ at Target({ METHOD, FIELD, ANNOTATION_TYPE })
+ at Retention(RUNTIME)
+ at Constraint(validatedBy = {
+		ComposingConstraint2ValidatorForArrayList.class,
+		ComposingConstraint2ValidatorForCalendar.class,
+		ComposingConstraint2ValidatorForCollection.class
+})
+ at Documented
+public @interface ComposingConstraint2 {
+	String message() default "";
+
+	Class<?>[] groups() default { };
+
+	Class<? extends Payload>[] payload() default { };
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/ComposingConstraint2ValidatorForArrayList.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/ComposingConstraint2ValidatorForArrayList.java
new file mode 100644
index 0000000..73fd680
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/ComposingConstraint2ValidatorForArrayList.java
@@ -0,0 +1,33 @@
+// $Id: ComposingConstraint2ValidatorForArrayList.java 18896 2010-02-25 19:04:40Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.composedconstraint2;
+
+import java.util.ArrayList;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+public class ComposingConstraint2ValidatorForArrayList
+		implements ConstraintValidator<ComposingConstraint2, ArrayList<?>> {
+
+	public void initialize(ComposingConstraint2 constraintAnnotation) {
+	}
+
+	public boolean isValid(ArrayList<?> object, ConstraintValidatorContext constraintContext) {
+		return true;
+	}
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/ComposingConstraint2ValidatorForCalendar.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/ComposingConstraint2ValidatorForCalendar.java
new file mode 100644
index 0000000..2ad6fb8
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/ComposingConstraint2ValidatorForCalendar.java
@@ -0,0 +1,38 @@
+// $Id: ComposingConstraint2ValidatorForCalendar.java 18896 2010-02-25 19:04:40Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.composedconstraint2;
+
+import java.util.Calendar;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+public class ComposingConstraint2ValidatorForCalendar implements
+ConstraintValidator<ComposingConstraint2, Calendar> {
+
+	public void initialize(ComposingConstraint2 constraintAnnotation) {
+		
+	}
+
+	public boolean isValid(Calendar object,
+			ConstraintValidatorContext constraintContext) {
+
+		return true;
+	}
+
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/ComposingConstraint2ValidatorForCollection.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/ComposingConstraint2ValidatorForCollection.java
new file mode 100644
index 0000000..506ffe8
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/ComposingConstraint2ValidatorForCollection.java
@@ -0,0 +1,32 @@
+// $Id: ComposingConstraint2ValidatorForCollection.java 18896 2010-02-25 19:04:40Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.composedconstraint2;
+
+import java.util.Collection;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+public class ComposingConstraint2ValidatorForCollection
+		implements ConstraintValidator<ComposingConstraint2, Collection<?>> {
+	public void initialize(ComposingConstraint2 constraintAnnotation) {
+	}
+
+	public boolean isValid(Collection<?> object, ConstraintValidatorContext constraintContext) {
+		return true;
+	}
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/FieldLevelValidationUsingComplexComposedConstraint.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/FieldLevelValidationUsingComplexComposedConstraint.java
new file mode 100644
index 0000000..84a7a24
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/composedconstraint2/FieldLevelValidationUsingComplexComposedConstraint.java
@@ -0,0 +1,59 @@
+// $Id: FieldLevelValidationUsingComplexComposedConstraint.java 18896 2010-02-25 19:04:40Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.composedconstraint2;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.List;
+
+public class FieldLevelValidationUsingComplexComposedConstraint {
+
+	@ComposedConstraint
+	public String string;
+	
+	@ComposedConstraint
+	public List<?> list;
+	
+	/**
+	 * Allowed
+	 */
+	@ComposedConstraint
+	public GregorianCalendar gregorianCalendar;
+	
+	@ComposedConstraint
+	public Collection<?> collection;
+	
+	/**
+	 * Allowed
+	 */
+	@ComposedConstraint
+	public ArrayList<?> arrayList;
+	
+	@ComposedConstraint
+	public Calendar calendar;
+		
+	/**
+	 * Not allowed.
+	 */
+	@ComposedConstraint
+	public Date date;
+
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/customconstraints/CaseMode.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/customconstraints/CaseMode.java
new file mode 100644
index 0000000..fad415e
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/customconstraints/CaseMode.java
@@ -0,0 +1,23 @@
+// $Id: CaseMode.java 18896 2010-02-25 19:04:40Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.customconstraints;
+
+public enum CaseMode {
+	UPPER,
+	LOWER;
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/customconstraints/CheckCase.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/customconstraints/CheckCase.java
new file mode 100644
index 0000000..9977c96
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/customconstraints/CheckCase.java
@@ -0,0 +1,43 @@
+// $Id: CheckCase.java 18896 2010-02-25 19:04:40Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.customconstraints;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+ at Target({ METHOD, FIELD, ANNOTATION_TYPE })
+ at Retention(RUNTIME)
+ at Constraint(validatedBy = CheckCaseValidator.class)
+ at Documented
+public @interface CheckCase {
+	String message() default "";
+
+	Class<?>[] groups() default { };
+
+	Class<? extends Payload>[] payload() default { };
+
+	CaseMode value();
+}
\ No newline at end of file
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/customconstraints/CheckCaseValidator.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/customconstraints/CheckCaseValidator.java
new file mode 100644
index 0000000..6b258da
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/customconstraints/CheckCaseValidator.java
@@ -0,0 +1,42 @@
+// $Id: CheckCaseValidator.java 18896 2010-02-25 19:04:40Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.customconstraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+public class CheckCaseValidator implements ConstraintValidator<CheckCase, String> {
+	private CaseMode caseMode;
+
+	public void initialize(CheckCase constraintAnnotation) {
+		this.caseMode = constraintAnnotation.value();
+	}
+
+	public boolean isValid(String object, ConstraintValidatorContext constraintContext) {
+		if ( object == null ) {
+			return true;
+		}
+
+		if ( caseMode == CaseMode.UPPER ) {
+			return object.equals( object.toUpperCase() );
+		}
+		else {
+			return object.equals( object.toLowerCase() );
+		}
+	}
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/customconstraints/FieldLevelValidationUsingCustomConstraints.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/customconstraints/FieldLevelValidationUsingCustomConstraints.java
new file mode 100644
index 0000000..3623dbb
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/customconstraints/FieldLevelValidationUsingCustomConstraints.java
@@ -0,0 +1,33 @@
+// $Id: FieldLevelValidationUsingCustomConstraints.java 18896 2010-02-25 19:04:40Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.customconstraints;
+
+import java.util.Date;
+
+public class FieldLevelValidationUsingCustomConstraints {
+
+	@CheckCase(CaseMode.UPPER)
+	public String string;
+	
+	/**
+	 * Not allowed.
+	 */
+	@CheckCase(CaseMode.UPPER)
+	public Date date;
+
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/inheritedvalidator/AbstractCustomConstraintValidator.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/inheritedvalidator/AbstractCustomConstraintValidator.java
new file mode 100644
index 0000000..e5af4cf
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/inheritedvalidator/AbstractCustomConstraintValidator.java
@@ -0,0 +1,24 @@
+// $Id: AbstractCustomConstraintValidator.java 19324 2010-04-29 19:02:09Z gunnar.morling $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.inheritedvalidator;
+
+import javax.validation.ConstraintValidator;
+
+public abstract class AbstractCustomConstraintValidator implements ConstraintValidator<CustomConstraint, String> {
+
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/inheritedvalidator/CustomConstraint.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/inheritedvalidator/CustomConstraint.java
new file mode 100644
index 0000000..6d33f63
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/inheritedvalidator/CustomConstraint.java
@@ -0,0 +1,43 @@
+// $Id: CustomConstraint.java 19324 2010-04-29 19:02:09Z gunnar.morling $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.inheritedvalidator;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+ at Target({ METHOD, FIELD, ANNOTATION_TYPE })
+ at Retention(RUNTIME)
+ at Constraint(validatedBy = CustomConstraintValidator.class)
+ at Documented
+public @interface CustomConstraint {
+
+	String message() default "";
+
+	Class<?>[] groups() default { };
+
+	Class<? extends Payload>[] payload() default { };
+
+}
\ No newline at end of file
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/inheritedvalidator/CustomConstraintValidator.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/inheritedvalidator/CustomConstraintValidator.java
new file mode 100644
index 0000000..c1fef5e
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/inheritedvalidator/CustomConstraintValidator.java
@@ -0,0 +1,30 @@
+// $Id: CustomConstraintValidator.java 19324 2010-04-29 19:02:09Z gunnar.morling $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.inheritedvalidator;
+
+import javax.validation.ConstraintValidatorContext;
+
+public class CustomConstraintValidator extends AbstractCustomConstraintValidator {
+
+	public void initialize(CustomConstraint constraintAnnotation) {
+	}
+
+	public boolean isValid(String object, ConstraintValidatorContext constraintContext) {
+		return true;
+	}
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/inheritedvalidator/FieldLevelValidationUsingInheritedValidator.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/inheritedvalidator/FieldLevelValidationUsingInheritedValidator.java
new file mode 100644
index 0000000..c1e5f0e
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/inheritedvalidator/FieldLevelValidationUsingInheritedValidator.java
@@ -0,0 +1,33 @@
+// $Id: FieldLevelValidationUsingInheritedValidator.java 19324 2010-04-29 19:02:09Z gunnar.morling $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.inheritedvalidator;
+
+import java.util.Date;
+
+public class FieldLevelValidationUsingInheritedValidator {
+
+	@CustomConstraint
+	public String string;
+
+	/**
+	 * Not allowed.
+	 */
+	@CustomConstraint
+	public Date date;
+
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/invalidcomposedconstraint/ValidCustomerNumber.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/invalidcomposedconstraint/ValidCustomerNumber.java
new file mode 100644
index 0000000..e958c94
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/invalidcomposedconstraint/ValidCustomerNumber.java
@@ -0,0 +1,36 @@
+// $Id: ValidCustomerNumber.java 18897 2010-02-25 19:12:35Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.invalidcomposedconstraint;
+
+import javax.validation.Payload;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+
+/**
+ * Constraint annotations are not allowed here, as ValidCustomerNumber isn't a
+ * proper constraint type definition.
+ */
+ at NotNull
+ at Size(min = 10, max = 10)
+public @interface ValidCustomerNumber {
+	String message() default "";
+
+	Class<?>[] groups() default { };
+
+	Class<? extends Payload>[] payload() default { };
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/nouniquevalidatorresolution/NoUniqueValidatorResolution.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/nouniquevalidatorresolution/NoUniqueValidatorResolution.java
new file mode 100644
index 0000000..6f8cf35
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/nouniquevalidatorresolution/NoUniqueValidatorResolution.java
@@ -0,0 +1,35 @@
+// $Id: NoUniqueValidatorResolution.java 18897 2010-02-25 19:12:35Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.nouniquevalidatorresolution;
+
+import java.util.Set;
+
+public class NoUniqueValidatorResolution {
+
+	/**
+	 * Allowed, as there is one maximally specific validator.
+	 */
+	@Size
+	public Set<?> set;
+
+	/**
+	 * Not allowed, as two maximally specific validators exist.
+	 */
+	@Size
+	public SerializableCollection<?> serializableCollection;
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/nouniquevalidatorresolution/SerializableCollection.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/nouniquevalidatorresolution/SerializableCollection.java
new file mode 100644
index 0000000..9ba77d2
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/nouniquevalidatorresolution/SerializableCollection.java
@@ -0,0 +1,25 @@
+// $Id: SerializableCollection.java 18897 2010-02-25 19:12:35Z hardy.ferentschik $
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.nouniquevalidatorresolution;
+
+import java.io.Serializable;
+import java.util.Collection;
+
+public interface SerializableCollection<T> extends Serializable, Collection<T> {
+
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/nouniquevalidatorresolution/Size.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/nouniquevalidatorresolution/Size.java
new file mode 100644
index 0000000..4bb4ee5
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/nouniquevalidatorresolution/Size.java
@@ -0,0 +1,43 @@
+// $Id: Size.java 18897 2010-02-25 19:12:35Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.nouniquevalidatorresolution;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+ at Target({ METHOD, FIELD, ANNOTATION_TYPE })
+ at Retention(RUNTIME)
+ at Constraint(validatedBy = {
+		SizeValidatorForCollection.class, SizeValidatorForSerializable.class, SizeValidatorForSet.class
+})
+ at Documented
+public @interface Size {
+	String message() default "";
+
+	Class<?>[] groups() default { };
+
+	Class<? extends Payload>[] payload() default { };
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/nouniquevalidatorresolution/SizeValidatorForCollection.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/nouniquevalidatorresolution/SizeValidatorForCollection.java
new file mode 100644
index 0000000..0cda1b6
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/nouniquevalidatorresolution/SizeValidatorForCollection.java
@@ -0,0 +1,32 @@
+// $Id: SizeValidatorForCollection.java 18897 2010-02-25 19:12:35Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.nouniquevalidatorresolution;
+
+import java.util.Collection;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+public class SizeValidatorForCollection implements ConstraintValidator<Size, Collection> {
+
+	public void initialize(Size constraintAnnotation) {
+	}
+
+	public boolean isValid(Collection object, ConstraintValidatorContext constraintContext) {
+		return true;
+	}
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/nouniquevalidatorresolution/SizeValidatorForSerializable.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/nouniquevalidatorresolution/SizeValidatorForSerializable.java
new file mode 100644
index 0000000..2737368
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/nouniquevalidatorresolution/SizeValidatorForSerializable.java
@@ -0,0 +1,32 @@
+// $Id: SizeValidatorForSerializable.java 18897 2010-02-25 19:12:35Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.nouniquevalidatorresolution;
+
+import java.io.Serializable;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+public class SizeValidatorForSerializable implements ConstraintValidator<Size, Serializable> {
+
+	public void initialize(Size constraintAnnotation) {
+	}
+
+	public boolean isValid(Serializable object, ConstraintValidatorContext constraintContext) {
+		return true;
+	}
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/nouniquevalidatorresolution/SizeValidatorForSet.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/nouniquevalidatorresolution/SizeValidatorForSet.java
new file mode 100644
index 0000000..1c753fe
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testmodel/nouniquevalidatorresolution/SizeValidatorForSet.java
@@ -0,0 +1,32 @@
+// $Id: SizeValidatorForSet.java 18897 2010-02-25 19:12:35Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testmodel.nouniquevalidatorresolution;
+
+import java.util.Set;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+public class SizeValidatorForSet implements ConstraintValidator<Size, Set> {
+
+	public void initialize(Size constraintAnnotation) {
+	}
+
+	public boolean isValid(Set object, ConstraintValidatorContext constraintContext) {
+		return true;
+	}
+}
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testutil/CompilerTestHelper.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testutil/CompilerTestHelper.java
new file mode 100644
index 0000000..781b12c
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/testutil/CompilerTestHelper.java
@@ -0,0 +1,178 @@
+// $Id: CompilerTestHelper.java 19525 2010-05-15 16:05:09Z gunnar.morling $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.testutil;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import javax.annotation.processing.Processor;
+import javax.tools.Diagnostic;
+import javax.tools.Diagnostic.Kind;
+import javax.tools.DiagnosticCollector;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaCompiler.CompilationTask;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+
+import org.hibernate.validator.ap.util.DiagnosticExpectation;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+/**
+ * Infrastructure for unit tests based on the Java Compiler API.
+ *
+ * @author Gunnar Morling
+ */
+public class CompilerTestHelper {
+
+	private final JavaCompiler compiler;
+
+	private final String sourceBaseDir;
+
+	private final String pathToBeanValidationApiJar;
+
+	public CompilerTestHelper(JavaCompiler compiler, String sourceBaseDir, String pathToBeanValidationApiJar) {
+
+		this.compiler = compiler;
+		this.sourceBaseDir = sourceBaseDir;
+		this.pathToBeanValidationApiJar = pathToBeanValidationApiJar;
+	}
+
+	/**
+	 * Retrieves a file object containing the source of the given class.
+	 *
+	 * @param clazz The class of interest.
+	 *
+	 * @return A file with the source of the given class.
+	 */
+	public File getSourceFile(Class<?> clazz) {
+
+		String sourceFileName =
+				File.separator + clazz.getName().replace( ".", File.separator ) + ".java";
+
+		return new File( sourceBaseDir + sourceFileName );
+	}
+
+	/**
+	 * @see CompilerTestHelper#compile(Processor, DiagnosticCollector, Kind, Boolean, File...)
+	 */
+	public boolean compile(
+			Processor annotationProcessor, DiagnosticCollector<JavaFileObject> diagnostics, File... sourceFiles) {
+
+		return compile( annotationProcessor, diagnostics, null, null, sourceFiles );
+	}
+
+	/**
+	 * @see CompilerTestHelper#compile(Processor, DiagnosticCollector, Kind, Boolean, File...)
+	 */
+	public boolean compile(
+			Processor annotationProcessor, DiagnosticCollector<JavaFileObject> diagnostics, Kind diagnosticKind, File... sourceFiles) {
+
+		return compile( annotationProcessor, diagnostics, diagnosticKind, null, sourceFiles );
+	}
+
+	/**
+	 * @see CompilerTestHelper#compile(Processor, DiagnosticCollector, Kind, Boolean, File...)
+	 */
+	public boolean compile(
+			Processor annotationProcessor, DiagnosticCollector<JavaFileObject> diagnostics, boolean verbose, File... sourceFiles) {
+
+		return compile( annotationProcessor, diagnostics, null, verbose, sourceFiles );
+	}
+
+	/**
+	 * Creates and executes a {@link CompilationTask} using the given input.
+	 *
+	 * @param annotationProcessor An annotation processor to be attached to the task.
+	 * @param diagnostics An diagnostics listener to be attached to the task.
+	 * @param diagnosticKind A value for the "diagnosticKind" option.
+	 * @param verbose A value for the "verbose" option.
+	 * @param sourceFiles The source files to be compiled.
+	 *
+	 * @return True, if the source files could be compiled successfully (meaning
+	 *         in especially, that the given annotation processor didn't raise
+	 *         any errors), false otherwise.
+	 */
+	public boolean compile(
+			Processor annotationProcessor, DiagnosticCollector<JavaFileObject> diagnostics, Kind diagnosticKind, Boolean verbose, File... sourceFiles) {
+
+		StandardJavaFileManager fileManager =
+				compiler.getStandardFileManager( null, null, null );
+
+		Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjects( sourceFiles );
+
+		List<String> options = new ArrayList<String>();
+
+		options.addAll( Arrays.asList( "-classpath", pathToBeanValidationApiJar, "-d", "target" ) );
+
+		if ( diagnosticKind != null ) {
+			options.add( "-AdiagnosticKind=" + diagnosticKind );
+		}
+
+		if ( verbose != null ) {
+			options.add( "-Averbose=" + verbose.toString() );
+		}
+
+		CompilationTask task = compiler.getTask( null, fileManager, diagnostics, options, null, compilationUnits );
+		task.setProcessors( Arrays.asList( annotationProcessor ) );
+
+		return task.call();
+	}
+
+	/**
+	 * <p>
+	 * Asserts, that the given diagnostics match with the given expectations.
+	 * </p>
+	 * <p>
+	 * First checks, whether the number of actual diagnostics matches with the
+	 * number of given expectations. If that's the case, {@link Kind} and line
+	 * number of each expectation are compared.
+	 * </p>
+	 *
+	 * @param diagnostics The actual diagnostics as populated by the executed
+	 * {@link CompilationTask}.
+	 * @param expectations The expectations to compare against.
+	 */
+	public static void assertThatDiagnosticsMatch(DiagnosticCollector<JavaFileObject> diagnostics, DiagnosticExpectation... expectations) {
+
+		List<Diagnostic<? extends JavaFileObject>> diagnosticsList = diagnostics.getDiagnostics();
+
+		if ( expectations == null ) {
+			assertTrue( diagnosticsList.isEmpty() );
+		}
+		else {
+
+			if ( diagnosticsList.size() != expectations.length ) {
+				System.out.println( diagnosticsList );
+			}
+
+			assertEquals( diagnosticsList.size(), expectations.length, "Wrong number of diagnostics." );
+
+			int i = 0;
+			for ( DiagnosticExpectation oneExpectation : expectations ) {
+
+				assertEquals( diagnosticsList.get( i ).getKind(), oneExpectation.getKind() );
+				assertEquals( diagnosticsList.get( i ).getLineNumber(), oneExpectation.getLineNumber() );
+
+				i++;
+			}
+		}
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/util/DiagnosticExpectation.java b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/util/DiagnosticExpectation.java
new file mode 100644
index 0000000..681a1d9
--- /dev/null
+++ b/hibernate-validator-annotation-processor/src/test/java/org/hibernate/validator/ap/util/DiagnosticExpectation.java
@@ -0,0 +1,51 @@
+// $Id: DiagnosticExpectation.java 19525 2010-05-15 16:05:09Z gunnar.morling $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.ap.util;
+
+import javax.tools.Diagnostic;
+import javax.tools.Diagnostic.Kind;
+
+/**
+ * Expectation value to be matched against a given {@link Diagnostic}.
+ *
+ * @author Gunnar Morling
+ */
+public class DiagnosticExpectation {
+
+	private final Kind kind;
+
+	private final long lineNumber;
+
+	public DiagnosticExpectation(Kind kind, long lineNumber) {
+		this.kind = kind;
+		this.lineNumber = lineNumber;
+	}
+
+	public Kind getKind() {
+		return kind;
+	}
+
+	public long getLineNumber() {
+		return lineNumber;
+	}
+
+	@Override
+	public String toString() {
+		return "DiagnosticExpectation [kind=" + kind + ", lineNumber=" + lineNumber + "]";
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator-archetype/pom.xml b/hibernate-validator-archetype/pom.xml
index 6986cbd..b34ff58 100644
--- a/hibernate-validator-archetype/pom.xml
+++ b/hibernate-validator-archetype/pom.xml
@@ -4,11 +4,12 @@
     <parent>
         <artifactId>hibernate-validator-parent</artifactId>
         <groupId>org.hibernate</groupId>
-        <version>4.0.2.GA</version>
+        <version>4.1.0.Final</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <groupId>org.hibernate</groupId>
     <artifactId>hibernate-validator-quickstart</artifactId>
+    <packaging>jar</packaging>
     <name>Hibernate Validator Quickstart</name>
     <dependencies>
         <dependency>
@@ -25,7 +26,21 @@
         <dependency>
             <groupId>org.hibernate</groupId>
             <artifactId>hibernate-validator</artifactId>
-            <version>${project.parent.version}</version>
+        </dependency>
+        <!--
+        Provided dependencies.
+        JAXB is needed when running on Java5. In this environment these dependencies have to be added
+        On Java6 jaxb is part of the runtime environment
+        -->
+        <dependency>
+            <groupId>javax.xml.bind</groupId>
+            <artifactId>jaxb-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.xml.bind</groupId>
+            <artifactId>jaxb-impl</artifactId>
+            <scope>provided</scope>
         </dependency>
     </dependencies>
     <build>
@@ -38,12 +53,22 @@
                     <target>1.5</target>
                 </configuration>
             </plugin>
+            <plugin>
+                <artifactId>maven-deploy-plugin</artifactId>
+                <configuration>
+                    <skip>true</skip>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-archetype-plugin</artifactId>
+            </plugin>
         </plugins>
     </build>
     <repositories>
         <repository>
             <id>jboss</id>
-            <url>http://repository.jboss.com/maven2</url>
+            <url>https://repository.jboss.org/nexus/content/repositories/public</url>
         </repository>
     </repositories>
 </project>
diff --git a/hibernate-validator-legacy/pom.xml b/hibernate-validator-legacy/pom.xml
index c86440b..da03052 100644
--- a/hibernate-validator-legacy/pom.xml
+++ b/hibernate-validator-legacy/pom.xml
@@ -1,16 +1,16 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <artifactId>hibernate-validator-parent</artifactId>
         <groupId>org.hibernate</groupId>
-        <version>4.0.2.GA</version>
+        <version>4.1.0.Final</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <artifactId>hibernate-validator-legacy</artifactId>
     <packaging>jar</packaging>
     <name>Hibernate Validator Legacy</name>
-    <version>4.0.2.GA</version>
+    <version>4.1.0.Final</version>
     <url>http://validator.hibernate.org</url>
     <licenses>
         <license>
@@ -21,7 +21,7 @@
     <description>Following the DRY (Don't Repeat Yourself) principle, Hibernate Validator let's you express your domain
         constraints once (and only once) and ensure their compliance at various level of your system automatically.
     </description>
-    
+
     <dependencies>
         <dependency>
             <groupId>org.hibernate</groupId>
@@ -104,6 +104,17 @@
         </dependency>
     </dependencies>
 
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-deploy-plugin</artifactId>
+                <configuration>
+                    <skip>true</skip>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
     <profiles>
         <profile>
             <id>dist</id>
@@ -121,7 +132,7 @@
                         <groupId>org.apache.maven.plugins</groupId>
                         <artifactId>maven-javadoc-plugin</artifactId>
                         <configuration>
-                            <stylesheetfile>${basedir}/src/main/javadoc/stylesheet.css</stylesheetfile>                            
+                            <stylesheetfile>${basedir}/src/main/javadoc/stylesheet.css</stylesheetfile>
                         </configuration>
                         <executions>
                             <execution>
diff --git a/hibernate-validator-legacy/src/main/resources/org/hibernate/validator/resources/DefaultValidatorMessages_mn_MN.properties b/hibernate-validator-legacy/src/main/resources/org/hibernate/validator/resources/DefaultValidatorMessages_mn_MN.properties
new file mode 100644
index 0000000..9421a01
--- /dev/null
+++ b/hibernate-validator-legacy/src/main/resources/org/hibernate/validator/resources/DefaultValidatorMessages_mn_MN.properties
@@ -0,0 +1,16 @@
+validator.assertFalse=\u0411\u0430\u0442\u0430\u043B\u0433\u0430\u0430\u0436\u0443\u0443\u043B\u0430\u043B\u0442 \u0430\u043C\u0436\u0438\u043B\u0442\u0433\u04AF\u0439 \u0431\u043E\u043B\u043B\u043E\u043E
+validator.assertTrue=\u0411\u0430\u0442\u0430\u043B\u0433\u0430\u0430\u0436\u0443\u0443\u043B\u0430\u043B\u0442 \u0430\u043C\u0436\u0438\u043B\u0442\u0433\u04AF\u0439 \u0431\u043E\u043B\u043B\u043E\u043E
+validator.future={value}-\u0441 \u0445\u043E\u0439\u0448\u0438\u0445 \u043E\u0433\u043D\u043E\u043E \u043E\u0440\u0443\u0443\u043B\u043D\u0430 \u0443\u0443
+validator.length=\u0422\u044D\u043C\u0434\u044D\u0433\u0442\u0438\u0439\u043D \u0443\u0440\u0442 {min}-\u0441 {max} \u0445\u043E\u043E\u0440\u043E\u043D\u0434 \u0431\u0430\u0439\u043D\u0430
+validator.max=\u0422\u044D\u043C\u0434\u044D\u0433\u0442\u0438\u0439\u043D \u0443\u0440\u0442 {value}-\u0441 \u0438\u0445\u0433\u04AF\u0439 \u0431\u0430\u0439\u043D\u0430
+validator.min=\u0422\u044D\u043C\u0434\u044D\u0433\u0442\u0438\u0439\u043D \u0443\u0440\u0442 {value}-\u0441 \u0431\u0430\u0433\u0430\u0433\u04AF\u0439 \u0431\u0430\u0439\u043D\u0430
+validator.notNull=\u0425\u043E\u043E\u0441\u043E\u043D \u0431\u0430\u0439\u0436 \u0431\u043E\u043B\u043E\u0445\u0433\u04AF\u0439
+validator.past={value}-\u0441 \u04E9\u043C\u043D\u04E9\u0445 \u043E\u0433\u043D\u043E\u043E \u043E\u0440\u0443\u0443\u043B\u043D\u0430 \u0443\u0443
+validator.pattern="{regex}"-\u0434 \u0442\u0430\u0430\u0440\u0430\u0445 \u0451\u0441\u0442\u043E\u0439
+validator.range=\u0423\u0442\u0433\u0430 {min}-\u0441 {max} \u0445\u043E\u043E\u0440\u043E\u043D\u0434 \u0431\u0430\u0439\u043D\u0430
+validator.size=\u0425\u044D\u043C\u0436\u044D\u044D {min}-\u0441 {max} \u0445\u043E\u043E\u0440\u043E\u043D\u0434 \u0431\u0430\u0439\u043D\u0430
+validator.email=\u0411\u0443\u0440\u0443\u0443 \u0438-\u043C\u044D\u0439\u043B \u0445\u0430\u044F\u0433 \u0431\u0430\u0439\u043D\u0430
+validator.notEmpty=\u0425\u043E\u043E\u0441\u043E\u043D \u0431\u0430\u0439\u0436 \u0431\u043E\u043B\u043E\u0445\u0433\u04AF\u0439
+validator.digits=\u0422\u043E\u043E\u043D\u044B \u0445\u044F\u0437\u0433\u0430\u0430\u0440\u0430\u0430\u0441 \u0445\u044D\u0442\u044D\u0440\u0441\u044D\u043D \u0431\u0430\u0439\u043D\u0430 (<{integerDigits} digits>.<{fractionalDigits} digits>)
+validator.creditCard=\u041A\u0440\u0435\u0434\u0438\u0442 \u043A\u0430\u0440\u0442\u044B\u043D \u0434\u0443\u0433\u0430\u0430\u0440 \u0431\u0443\u0440\u0443\u0443 \u0431\u0430\u0439\u043D\u0430
+validator.ean=\u0411\u0443\u0440\u0443\u0443 EAN \u043A\u043E\u0434 \u0431\u0430\u0439\u043D\u0430
\ No newline at end of file
diff --git a/hibernate-validator-tck-runner/pom.xml b/hibernate-validator-tck-runner/pom.xml
index 67dedb1..c02ba5b 100644
--- a/hibernate-validator-tck-runner/pom.xml
+++ b/hibernate-validator-tck-runner/pom.xml
@@ -1,10 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
     <parent>
         <artifactId>hibernate-validator-parent</artifactId>
         <groupId>org.hibernate</groupId>
-        <version>4.0.2.GA</version>
+        <version>4.1.0.Final</version>
     </parent>
-    <modelVersion>4.0.0</modelVersion>
     <artifactId>hibernate-validator-tck-runner</artifactId>
     <name>Hibernate Validator TCK Runner</name>
     <description>Aggregates dependencies and run's the JSR-303 TCK</description>
@@ -17,7 +18,6 @@
         <dependency>
             <groupId>org.hibernate</groupId>
             <artifactId>hibernate-validator</artifactId>
-            <version>${version}</version>
         </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>
@@ -32,12 +32,31 @@
         <dependency>
             <groupId>org.hibernate.jsr303.tck</groupId>
             <artifactId>jsr303-tck</artifactId>
-            <version>1.0.1.GA</version>
         </dependency>
         <dependency>
             <groupId>org.jboss.test-harness</groupId>
             <artifactId>jboss-test-harness-jboss-as-51</artifactId>
-            <version>1.0.0</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.hibernate</groupId>
+                    <artifactId>hibernate-entitymanager</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <!--
+        Provided dependencies.
+        JAXB is needed when running on Java5. In this environment these dependencies have to be added
+        On Java6 jaxb is part of the runtime environment
+        -->
+        <dependency>
+            <groupId>javax.xml.bind</groupId>
+            <artifactId>jaxb-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.xml.bind</groupId>
+            <artifactId>jaxb-impl</artifactId>
+            <scope>provided</scope>
         </dependency>
     </dependencies>
 
diff --git a/hibernate-validator/pom.xml b/hibernate-validator/pom.xml
index 7b00b6e..207d307 100644
--- a/hibernate-validator/pom.xml
+++ b/hibernate-validator/pom.xml
@@ -1,14 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <parent>
         <artifactId>hibernate-validator-parent</artifactId>
         <groupId>org.hibernate</groupId>
-        <version>4.0.2.GA</version>
+        <version>4.1.0.Final</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.hibernate</groupId>
     <artifactId>hibernate-validator</artifactId>
     <name>Hibernate Validator</name>
+    <description>
+        Hibernate's Bean Validation (JSR-303) reference implementation.
+    </description>
     <distributionManagement>
         <site>
             <id>site</id>
@@ -30,7 +34,6 @@
         <dependency>
             <groupId>com.googlecode.jtype</groupId>
             <artifactId>jtype</artifactId>
-            <version>0.1.0</version>
         </dependency>
 
         <!--
@@ -44,12 +47,28 @@
         </dependency>
 
         <!--
+        Provided dependencies.
+        JAXB is needed when running on Java5. In this environment these dependencies have to be added (unless
+        xml configuration is explicitly disabled via Configuration.ignoreXmlConfiguration)
+        On Java6 jaxb is part of the runtime environment                                                                                                           
+        -->
+        <dependency>
+            <groupId>javax.xml.bind</groupId>
+            <artifactId>jaxb-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.xml.bind</groupId>
+            <artifactId>jaxb-impl</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <!--
         Optional dependencies
         -->
         <dependency>
-            <groupId>org.hibernate.java-persistence</groupId>
-            <artifactId>jpa-api</artifactId>
-            <version>2.0.Beta-20090815</version>
+            <groupId>org.hibernate.javax.persistence</groupId>
+            <artifactId>hibernate-jpa-2.0-api</artifactId>
             <optional>true</optional>
         </dependency>
 
@@ -62,7 +81,32 @@
             <scope>test</scope>
             <classifier>jdk15</classifier>
         </dependency>
+        <dependency>
+          <groupId>org.easymock</groupId>
+          <artifactId>easymock</artifactId>
+          <scope>test</scope>
+        </dependency>        
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-entitymanager</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.h2database</groupId>
+            <artifactId>h2</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
+
+    <properties>
+        <db.dialect>org.hibernate.dialect.H2Dialect</db.dialect>
+        <jdbc.driver>org.h2.Driver</jdbc.driver>
+        <jdbc.url>jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1</jdbc.url>
+        <jdbc.user>sa</jdbc.user>
+        <jdbc.pass />
+        <jdbc.isolation />
+    </properties>
+
     <build>
         <defaultGoal>test</defaultGoal>
         <resources>
@@ -75,19 +119,20 @@
                 <targetPath>META-INF</targetPath>
             </resource>
         </resources>
+        <testResources>
+            <testResource>
+                <filtering>true</filtering>
+                <directory>src/test/resources</directory>
+                <includes>
+                    <include>**/*.properties</include>
+                    <include>**/*.xml</include>
+                </includes>
+            </testResource>
+        </testResources>
         <plugins>
             <plugin>
-                <inherited>true</inherited>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-source-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>attach-sources</id>
-                        <goals>
-                            <goal>jar</goal>
-                        </goals>
-                    </execution>
-                </executions>
             </plugin>
             <plugin>
                 <groupId>org.codehaus.mojo</groupId>
@@ -106,32 +151,57 @@
                 </configuration>
             </plugin>
             <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-surefire-plugin</artifactId>
+                <artifactId>maven-jar-plugin</artifactId>
                 <configuration>
-                    <suiteXmlFiles>
-                        <suiteXmlFile>${basedir}/src/test/suite/unit-tests.xml</suiteXmlFile>
-                    </suiteXmlFiles>
+                    <archive>
+                        <manifestFile>${pom.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
+                    </archive>
                 </configuration>
             </plugin>
             <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-surefire-report-plugin</artifactId>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Import-Package>
+                            javax.persistence.*;version="[2.0.0,3.0.0)";resolution:=optional,
+                            javax.validation.*;version="[1.0.0,2.0.0)",
+                            javax.xml.*;version="0",
+                            org.xml.sax.*;version="0",
+                            org.slf4j.*;version="[1.5.6,2.0.0)"
+                        </Import-Package>
+                        <Export-Package>
+                            org.hibernate.validator;version="${pom.version}",
+                            org.hibernate.validator.constraints;version="${pom.version}",
+                            org.hibernate.validator.messageinterpolation;version="${pom.version}",
+                            org.hibernate.validator.resourceloading;version="${pom.version}",
+                        </Export-Package>
+                    </instructions>
+                </configuration>
                 <executions>
                     <execution>
-                        <id>generate-test-report</id>
-                        <phase>test</phase>
+                        <id>bundle-manifest</id>
+                        <phase>process-classes</phase>
                         <goals>
-                            <goal>report-only</goal>
+                            <goal>manifest</goal>
                         </goals>
                     </execution>
                 </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
                 <configuration>
-                    <outputDirectory>${project.build.directory}/surefire-reports</outputDirectory>
-                    <outputName>test-report</outputName>
+                    <suiteXmlFiles>
+                        <suiteXmlFile>${basedir}/src/test/suite/unit-tests.xml</suiteXmlFile>
+                    </suiteXmlFiles>
                 </configuration>
             </plugin>
-
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-report-plugin</artifactId>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-shade-plugin</artifactId>
@@ -161,15 +231,31 @@
                 </executions>
             </plugin>
             <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <configuration>
+                    <docfilessubdirs>true</docfilessubdirs>
+                    <stylesheetfile>${basedir}/src/main/javadoc/stylesheet.css</stylesheetfile>
+                    <links>
+                        <link>http://java.sun.com/j2se/1.5.0/docs/api/</link>
+                        <link>http://docs.jboss.org/hibernate/stable/beanvalidation/api/</link>
+                    </links>
+                    <packagesheader>Hibernate Validator Packages</packagesheader>
+                    <doctitle>Hibernate Validator ${project.version}</doctitle>
+                    <windowtitle>Hibernate Validator ${project.version}</windowtitle>
+                    <bottom>
+                        <![CDATA[Copyright © ${inceptionYear}-{currentYear} <a href="http://redhat.com">Red Hat Middleware, LLC.</a>  All Rights Reserved]]></bottom>
+                </configuration>
+            </plugin>
+            <plugin>
                 <groupId>org.jboss.maven.plugins</groupId>
                 <artifactId>maven-jdocbook-plugin</artifactId>
-                <version>2.2.0</version>
                 <extensions>true</extensions>
                 <dependencies>
                     <dependency>
                         <groupId>org.hibernate</groupId>
                         <artifactId>hibernate-jdocbook-style</artifactId>
-                        <version>2.0.0</version>
+                        <version>2.0.1</version>
                         <type>jdocbook-style</type>
                     </dependency>
                 </dependencies>
@@ -184,7 +270,7 @@
                         <format>
                             <formatName>pdf</formatName>
                             <stylesheetResource>classpath:/xslt/org/hibernate/jdocbook/xslt/pdf.xsl</stylesheetResource>
-                            <finalName>hibernate_reference.pdf</finalName>
+                            <finalName>hibernate_validator_reference.pdf</finalName>
                         </format>
                         <format>
                             <formatName>html_single</formatName>
@@ -207,11 +293,14 @@
                         <docbookVersion>1.72.0</docbookVersion>
                         <localeSeparator>-</localeSeparator>
                     </options>
+                    <profiling>
+                        <enabled>true</enabled>
+                    </profiling>
                 </configuration>
                 <executions>
                     <execution>
                         <id>make-doc</id>
-                        <phase>site</phase>
+                        <phase>deploy</phase>
                         <goals>
                             <goal>resources</goal>
                             <goal>generate</goal>
@@ -222,29 +311,31 @@
             <plugin>
                 <groupId>org.jboss.maven.plugins</groupId>
                 <artifactId>maven-jdocbook-style-plugin</artifactId>
-                <version>2.0.0</version>
             </plugin>
             <plugin>
                 <artifactId>maven-assembly-plugin</artifactId>
                 <configuration>
                     <descriptors>
-                        <descriptor>src/main/assembly/dist.xml</descriptor>
+                        <descriptor>${basedir}/src/main/assembly/dist.xml</descriptor>
                     </descriptors>
                 </configuration>
                 <executions>
                     <execution>
                         <id>make-assembly</id>
-                        <phase>site</phase>
+                        <phase>deploy</phase>
                         <goals>
-                            <goal>assembly</goal>
+                            <goal>single</goal>
                         </goals>
                     </execution>
                 </executions>
             </plugin>
             <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-release-plugin</artifactId>
+            </plugin>
+            <plugin>
                 <groupId>org.twdata.maven</groupId>
                 <artifactId>maven-cli-plugin</artifactId>
-                <version>0.6.3.CR3</version>
             </plugin>
         </plugins>
     </build>
@@ -253,28 +344,7 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-project-info-reports-plugin</artifactId>
-                <version>2.0.1</version>
             </plugin>
         </plugins>
     </reporting>
-    <profiles>
-        <profile>
-            <id>jaxb</id>
-            <activation>
-                <jdk>1.5</jdk>
-            </activation>
-            <dependencies>
-                <dependency>
-                    <groupId>javax.xml.bind</groupId>
-                    <artifactId>jaxb-api</artifactId>
-                    <version>2.1</version>
-                </dependency>
-                <dependency>
-                    <groupId>com.sun.xml.bind</groupId>
-                    <artifactId>jaxb-impl</artifactId>
-                    <version>2.1.3</version>
-                </dependency>
-            </dependencies>
-        </profile>
-    </profiles>
 </project>
diff --git a/hibernate-validator/readme.txt b/hibernate-validator/readme.txt
index 5322f4d..d74ef63 100644
--- a/hibernate-validator/readme.txt
+++ b/hibernate-validator/readme.txt
@@ -16,22 +16,17 @@
   is not based on JSR 303. This code can be accessed via 
   http://anonsvn.jboss.org/repos/hibernate/validator/trunk/hibernate-validator-legacy
 
-  Status
-  ------
-
-  This is the first GA release of Hibernate Validator 4.
-
   Documentation
   -------------
 
   The documentation for this release is included in the docs directory of distribution package
-  or online under https://www.hibernate.org/5.html
+  or online under http://www.hibernate.org/subprojects/validator/docs.html
 
   Release Notes
   -------------
 
-  The full list of changes can be found at
-  http://opensource.atlassian.com/projects/hibernate/secure/ReleaseNote.jspa?projectId=10060&version=10982
+  The full list of changes for this release can be found at
+  http://opensource.atlassian.com/projects/hibernate/secure/ReleaseNote.jspa?projectId=10060&version=11091
 
   System Requirements
   -------------------
@@ -41,9 +36,13 @@
   Using Hibernate Validator
   -------------------------
 
-  - Copy hibernate-validator-*.jar together will all jar files from lib into the 
-    classpath of your application. In case you are running on JDK5 you have to also include
-    all the jar files from the jdk5 subdirectory.
+  - In case you use the distribution archive from the download site, copy hibernate-validator-*.jar together
+    with all jar files from lib into the classpath of your application. You can switch the slf4j binding
+    jars for log4j (log4j-<version>.jar and slf4j-log4j12-<version>.jar) with the slf4j binding files of
+    your choice. See http://www.slf4j.org/manual.html
+    In case you are using Java 5 you have to also include all the jar files from the jdk5 subdirectory.
+    The jar files contain the classes needed for using JAXB. If XML configuration is disabled via
+    Configuration.ignoreXmlConfiguration the jar files from the jdk5 subdirectory don't have to be added. 
 
   or 
 
@@ -55,7 +54,7 @@
         <version>${project.version}</version>
     </dependency>
 
-    Hibernate Validator can be found in this repository: http://repository.jboss.com/maven2/  
+    Hibernate Validator can be found in the JBoss Maven repository: http://repository.jboss.com/maven2/
 
   Licensing
   ---------
@@ -65,9 +64,8 @@
   Hibernate Validator URLs
   ------------------------
 
-  Home Page:          http://validator.hibernate.org/
-  Migration Guide:    http://www.hibernate.org/468.html
-  Downloads:          http://www.hibernate.org/6.html
-  Mailing Lists:      http://www.hibernate.org/20.html
+  Home Page:          http://validator.hibernate.org
+  Downloads:          http://www.hibernate.org/subprojects/validator/download.html
+  Mailing Lists:      http://www.hibernate.org/community/mailinglists.html
   Source Code:        http://anonsvn.jboss.org/repos/hibernate/validator/trunk/
   Issue Tracking:     http://opensource.atlassian.com/projects/hibernate/browse/HV
diff --git a/hibernate-validator/src/main/assembly/dist.xml b/hibernate-validator/src/main/assembly/dist.xml
index f374c27..6015fa4 100644
--- a/hibernate-validator/src/main/assembly/dist.xml
+++ b/hibernate-validator/src/main/assembly/dist.xml
@@ -22,7 +22,6 @@
     <id>dist</id>
     <formats>
         <format>tar.gz</format>
-        <format>tar.bz2</format>
         <format>zip</format>
     </formats>
 
@@ -37,19 +36,20 @@
                 <exclude>com.sun.xml.bind:jaxb-impl</exclude>
                 <exclude>javax.xml.stream:stax-api</exclude>
                 <exclude>javax.activation:activation</exclude>
+                <exclude>org.hibernate.java-persistence:jpa-api</exclude>
             </excludes>
         </dependencySet>
         <dependencySet>
             <useProjectArtifact>false</useProjectArtifact>
             <outputDirectory>lib/jdk5</outputDirectory>
-            <scope>runtime</scope>
+            <scope>provided</scope>
             <includes>
                 <include>javax.xml.bind:jaxb-api</include>
                 <include>com.sun.xml.bind:jaxb-impl</include>
                 <include>javax.xml.stream:stax-api</include>
                 <include>javax.activation:activation</include>
             </includes>
-        </dependencySet>        
+        </dependencySet>      
     </dependencySets>
 
     <files>
@@ -77,7 +77,7 @@
             </includes>
         </fileSet>
         <fileSet>
-            <directory>target/site/apidocs</directory>
+            <directory>target/apidocs</directory>
             <outputDirectory>docs/api</outputDirectory>
         </fileSet>  
         <fileSet>
diff --git a/hibernate-validator/src/main/docbook/en-US/hv.ent b/hibernate-validator/src/main/docbook/en-US/hv.ent
new file mode 100644
index 0000000..cd7d8f9
--- /dev/null
+++ b/hibernate-validator/src/main/docbook/en-US/hv.ent
@@ -0,0 +1,5 @@
+<!ENTITY version "WORKING">
+<!ENTITY bvVersion "1.0.0.GA">
+<!ENTITY today "TODAY">
+<!ENTITY copyrightYear "2009, 2010">
+<!ENTITY copyrightHolder "Red Hat, Inc. & Gunnar Morling">
\ No newline at end of file
diff --git a/hibernate-validator/src/main/docbook/en-US/images/annotation_processor_eclipse.png b/hibernate-validator/src/main/docbook/en-US/images/annotation_processor_eclipse.png
new file mode 100644
index 0000000..3965c03
Binary files /dev/null and b/hibernate-validator/src/main/docbook/en-US/images/annotation_processor_eclipse.png differ
diff --git a/hibernate-validator/src/main/docbook/en-US/images/annotation_processor_intellij.png b/hibernate-validator/src/main/docbook/en-US/images/annotation_processor_intellij.png
new file mode 100644
index 0000000..50ad204
Binary files /dev/null and b/hibernate-validator/src/main/docbook/en-US/images/annotation_processor_intellij.png differ
diff --git a/hibernate-validator/src/main/docbook/en-US/images/annotation_processor_netbeans.png b/hibernate-validator/src/main/docbook/en-US/images/annotation_processor_netbeans.png
new file mode 100644
index 0000000..a4f037a
Binary files /dev/null and b/hibernate-validator/src/main/docbook/en-US/images/annotation_processor_netbeans.png differ
diff --git a/hibernate-validator/src/main/docbook/en-US/master.xml b/hibernate-validator/src/main/docbook/en-US/master.xml
index adea1e1..7d195f9 100644
--- a/hibernate-validator/src/main/docbook/en-US/master.xml
+++ b/hibernate-validator/src/main/docbook/en-US/master.xml
@@ -1,76 +1,79 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- $Id: master.xml 17939 2009-11-06 11:02:36Z hardy.ferentschik $ -->
+<!-- $Id: master.xml 19639 2010-06-01 11:52:20Z hardy.ferentschik $ -->
 <!--
-  ~ Hibernate, Relational Persistence for Idiomatic Java
-  ~
-  ~ Copyright (c) 2009, Red Hat, Inc. and/or its affiliates or third-party contributors as
-  ~ indicated by the @author tags or express copyright attribution
-  ~ statements applied by the authors.  All third-party contributions are
-  ~ distributed under license by Red Hat, Inc.
-  ~
-  ~ This copyrighted material is made available to anyone wishing to use, modify,
-  ~ copy, or redistribute it subject to the terms and conditions of the GNU
-  ~ Lesser General Public License, as published by the Free Software Foundation.
-  ~
-  ~ This program is distributed in the hope that it will be useful,
-  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-  ~ for more details.
-  ~
-  ~ You should have received a copy of the GNU Lesser General Public License
-  ~ along with this distribution; if not, write to:
-  ~ Free Software Foundation, Inc.
-  ~ 51 Franklin Street, Fifth Floor
-  ~ Boston, MA  02110-1301  USA
-  -->
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
-"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY versionNumber "4.0.2.GA">
-<!ENTITY copyrightYear "2009">
-<!ENTITY copyrightHolder "Red Hat Middleware, LLC. & Gunnar Morling">
+	~ 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.
+-->
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "hv.ent">
+%BOOK_ENTITIES;
 ]>
-<book lang="en">
-  <bookinfo>
-    <title>Hibernate Validator</title>
 
-    <subtitle>JSR 303 Reference Implementation</subtitle>
+<book>
+    <bookinfo>
+        <title>Hibernate Validator</title>
+        <subtitle>JSR 303 Reference Implementation</subtitle>
+        <subtitle>Reference Guide</subtitle>
+        <releaseinfo>&version;</releaseinfo>
+        <pubdate>&today;</pubdate>
+        <productnumber>&version;</productnumber>
+        <copyright>
+            <year>©rightYear;</year>
+            <holder>©rightHolder;</holder>
+        </copyright>
+        <authorgroup>
+            <author>
+                <firstname>Hardy</firstname>
+                <surname>Ferentschik</surname>
+            </author>
+            <author>
+                <firstname>Gunnar</firstname>
+                <surname>Morling</surname>
+            </author>
+        </authorgroup>
+    </bookinfo>
 
-    <subtitle>Reference Guide</subtitle>
+    <toc></toc>
 
-    <releaseinfo>&versionNumber;</releaseinfo>
+    <xi:include href="modules/preface.xml"
+                xmlns:xi="http://www.w3.org/2001/XInclude"/>
 
-    <productnumber>&versionNumber;</productnumber>
+    <xi:include href="modules/gettingstarted.xml"
+                xmlns:xi="http://www.w3.org/2001/XInclude"/>
 
-    <copyright>
-      <year>©rightYear;</year>
+    <xi:include href="modules/usingvalidator.xml"
+                xmlns:xi="http://www.w3.org/2001/XInclude"/>
 
-      <holder>©rightHolder;</holder>
-    </copyright>
-  </bookinfo>
+    <xi:include href="modules/customconstraints.xml"
+                xmlns:xi="http://www.w3.org/2001/XInclude"/>
 
-  <toc></toc>
+    <xi:include href="modules/xmlconfiguration.xml"
+                xmlns:xi="http://www.w3.org/2001/XInclude"/>
 
-  <xi:include href="modules/preface.xml" 
-               xmlns:xi="http://www.w3.org/2001/XInclude"/>
+    <xi:include href="modules/bootstrapping.xml"
+                xmlns:xi="http://www.w3.org/2001/XInclude"/>
 
-  <xi:include href="modules/gettingstarted.xml"
-              xmlns:xi="http://www.w3.org/2001/XInclude" />
+    <xi:include href="modules/integration.xml"
+                xmlns:xi="http://www.w3.org/2001/XInclude"/>
 
-  <xi:include href="modules/usingvalidator.xml"
-              xmlns:xi="http://www.w3.org/2001/XInclude" />
+    <xi:include href="modules/programmaticapi.xml"
+                xmlns:xi="http://www.w3.org/2001/XInclude"/>
 
-  <xi:include href="modules/customconstraints.xml"
-              xmlns:xi="http://www.w3.org/2001/XInclude" />
+	<xi:include href="modules/annotationprocessor.xml"
+			    xmlns:xi="http://www.w3.org/2001/XInclude"/>
 
-  <xi:include href="modules/xmlconfiguration.xml"
-              xmlns:xi="http://www.w3.org/2001/XInclude" />
-
-  <xi:include href="modules/bootstrapping.xml"
-              xmlns:xi="http://www.w3.org/2001/XInclude" />
-
-  <xi:include href="modules/integration.xml"
-              xmlns:xi="http://www.w3.org/2001/XInclude" />
-
-  <xi:include href="modules/furtherreading.xml"
-              xmlns:xi="http://www.w3.org/2001/XInclude" />
+    <xi:include href="modules/furtherreading.xml"
+                xmlns:xi="http://www.w3.org/2001/XInclude"/>
 </book>
diff --git a/hibernate-validator/src/main/docbook/en-US/modules/annotationprocessor.xml b/hibernate-validator/src/main/docbook/en-US/modules/annotationprocessor.xml
new file mode 100644
index 0000000..004e9ce
--- /dev/null
+++ b/hibernate-validator/src/main/docbook/en-US/modules/annotationprocessor.xml
@@ -0,0 +1,484 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- $Id: annotationprocessor.xml 19639 2010-06-01 11:52:20Z hardy.ferentschik $ -->
+<!--
+	~ 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.
+-->
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "../hv.ent">
+%BOOK_ENTITIES;
+]>
+<chapter>
+  <title id="annotation-processor">Annotation Processor (EXPERIMENTAL)</title>
+
+  <para>Have you ever caught yourself by unintentionally doing things
+  like</para>
+
+  <itemizedlist>
+    <listitem>
+      <para>annotating Strings with @Min to specify a minimum length (instead
+      of using @Size)</para>
+    </listitem>
+
+    <listitem>
+      <para>annotating the setter of a JavaBean property (instead of the
+      getter method)</para>
+    </listitem>
+
+    <listitem>
+      <para>annotating static fields/methods with constraint annotations
+      (which is not supported)?</para>
+    </listitem>
+  </itemizedlist>
+
+  <para>Then the Hibernate Validator Annotation Processor is the right thing
+  for you. It helps preventing such mistakes by plugging into the build
+  process and raising compilation errors whenever constraint annotations are
+  incorrectly used.</para>
+
+  <warning>
+    <para>A first version of the Hibernate Validator Annotation Processor is
+    part of Hibernate Validator since release 4.1. It is currently still under
+    development and should therefore be considered as an experimental feature.
+    Some <link linkend="section-known-issues">known issues</link> can be found
+    at the end of this chapter. In case any problems arise when using the
+    processor feel free to ask for help at the <ulink
+    url="https://forum.hibernate.org/viewforum.php?f=9">forum</ulink> or
+    create an issue within<ulink
+    url="http://opensource.atlassian.com/projects/hibernate/browse/HV/component/10356">
+    JIRA</ulink>.</para>
+  </warning>
+
+  <section>
+    <title>Prerequisites</title>
+
+    <para>The Hibernate Validator Annotation Processor is based on the
+    "Pluggable Annotation Processing API" as defined by <ulink
+    url="http://jcp.org/en/jsr/detail?id=269">JSR 269</ulink>. This API is
+    part of the Java Platform since Java 6. So be sure to use this or a later
+    version.</para>
+  </section>
+
+  <section id="section-features-of-the-ap">
+    <title>Features</title>
+
+    <para>As of Hibernate Validator 4.1 the Hibernate Validator Annotation
+    Processor checks that:</para>
+
+    <itemizedlist>
+      <listitem>
+        <para>constraint annotations are allowed for the type of the annotated
+        element</para>
+      </listitem>
+
+      <listitem>
+        <para>JavaBean getter methods are annotated in case of property
+        validation</para>
+      </listitem>
+
+      <listitem>
+        <para>only non-static fields or properties are annotated with
+        constraint annotations</para>
+      </listitem>
+
+      <listitem>
+        <para>only non-primitive fields or properties are annotated with
+        @Valid</para>
+      </listitem>
+
+      <listitem>
+        <para>only such annotation types are annotated with constraint
+        annotations which are constraint annotations themselves</para>
+      </listitem>
+    </itemizedlist>
+  </section>
+
+  <section>
+    <title>Options</title>
+
+    <para>The behavior of the Hibernate Validator Annotation Processor can be
+    controlled using the <ulink
+    url="http://java.sun.com/javase/6/docs/technotes/tools/windows/javac.html#options">processor
+    options</ulink> listed in table<xref
+    linkend="table_processor_options" />:</para>
+
+    <table id="table_processor_options">
+      <title>Hibernate Validator Annotation Processor options</title>
+
+      <tgroup cols="2">
+        <thead>
+          <row>
+            <entry align="center">Option</entry>
+
+            <entry align="center">Explanation</entry>
+          </row>
+        </thead>
+
+        <tbody>
+          <row>
+            <entry><varname>diagnosticKind</varname></entry>
+
+            <entry>Controls how constraint problems are reported. Must be the
+            string representation of one of the values from the enum
+            <classname>javax.tools.Diagnostic.Kind</classname>, e.g.
+            <classname>WARNING</classname>. A value of
+            <classname>ERROR</classname> will cause compilation to halt
+            whenever the AP detects a constraint problem. Defaults to
+            <classname>ERROR</classname>.</entry>
+          </row>
+
+          <row>
+            <entry><varname>verbose</varname></entry>
+
+            <entry>Controls whether detailed processing information shall be
+            displayed or not, useful for debugging purposes. Must be either
+            <varname>true</varname> or<varname>false</varname>. Defaults to
+            <varname>false</varname>.</entry>
+          </row>
+        </tbody>
+      </tgroup>
+    </table>
+  </section>
+
+  <section>
+    <title>Using the Annotation Processor</title>
+
+    <para>This section shows in detail how to integrate the Hibernate
+    Validator Annotation Processor into command line builds (javac, Ant,
+    Maven) as well as IDE-based builds (Eclipse, IntelliJ IDEA,
+    NetBeans).</para>
+
+    <section>
+      <title>Command line builds</title>
+
+      <section>
+        <title>javac</title>
+
+        <para>When compiling on the command line using <ulink
+        url="http://java.sun.com/javase/6/docs/technotes/guides/javac/index.html">javac</ulink>,
+        specify the following JARs using the "processorpath" option:</para>
+
+        <itemizedlist>
+          <listitem>
+            <para>validation-api-&bvVersion;.jar</para>
+          </listitem>
+
+          <listitem>
+            <para>hibernate-validator-annotation-processor-&version;.jar</para>
+          </listitem>
+        </itemizedlist>
+
+        <para>The following listing shows an example. The processor will be
+        detected automatically by the compiler and invoked during
+        compilation.</para>
+
+        <example>
+          <title>Using the annotation processor with javac</title>
+
+          <programlisting>javac src/main/java/org/hibernate/validator/ap/demo/Car.java \
+   -cp /path/to/validation-api-&bvVersion;.jar \ 
+   -processorpath /path/to/validation-api-&bvVersion;.jar:/path/to/hibernate-validator-annotation-processor-&version;.jar                  </programlisting>
+        </example>
+      </section>
+
+      <section>
+        <title>Apache Ant</title>
+
+        <para>Similar to directly working with javac, the annotation processor
+        can be added as as compiler argument when invoking the <ulink
+        url="http://ant.apache.org/manual/CoreTasks/javac.html">javac
+        task</ulink> for <ulink url="http://ant.apache.org/">Apache
+        Ant</ulink>:</para>
+
+        <example>
+          <title>Using the annotation processor with Ant</title>
+
+          <programlisting><javac srcdir="src/main"
+       destdir="build/classes"
+       classpath="/path/to/validation-api-&bvVersion;.jar">
+       <compilerarg value="-processorpath" />
+       <compilerarg value="/path/to/validation-api-&bvVersion;.jar:/path/to/hibernate-validator-annotation-processor-&version;.jar"/>
+</javac></programlisting>
+        </example>
+      </section>
+
+      <section>
+        <title>Maven</title>
+
+        <para>There are several options for integrating the annotation
+        processor with <ulink url="http://maven.apache.org/">Apache
+        Maven</ulink>. Generally it is sufficient to add the Hibernate
+        Validator Annotation Processor as dependency to your project:</para>
+
+        <example>
+          <title>Adding the HV Annotation Processor as dependency</title>
+
+          <programlisting>...
+<dependency>
+    <groupId>org.hibernate</groupId>
+    <artifactId>hibernate-validator-annotation-processor</artifactId>
+    <version>&version;</version>
+    <scope>compile</scope>
+</dependency>
+...        </programlisting>
+        </example>
+
+        <para>The processor will then be executed automatically by the
+        compiler. This basically works, but comes with the disadavantage that
+        in some cases messages from the annotation processor are not displayed
+        (see <ulink
+        url="http://jira.codehaus.org/browse/MCOMPILER-66">MCOMPILER-66</ulink>).</para>
+
+        <para>Another option is using the <ulink
+        url="http://code.google.com/p/maven-annotation-plugin/">Maven
+        Annotation Plugin</ulink>. At the time of this writing the plugin is
+        not yet available in any of the well-known repositories. Therefore you
+        have to add the project's own repository to your settings.xml or
+        pom.xml:</para>
+
+        <para><example>
+            <title>Adding the Maven Annotation Plugin repository</title>
+
+            <programlisting>...
+<pluginRepositories>
+    <pluginRepository>
+        <id>maven-annotation-plugin-repo</id>
+        <url>http://maven-annotation-plugin.googlecode.com/svn/trunk/mavenrepo</url>
+    </pluginRepository>
+</pluginRepositories>
+...                      </programlisting>
+          </example> Now disable the standard annotation processing performed
+        by the compiler plugin and configure the annotation plugin by
+        specifying an execution and adding the Hibernate Validator Annotation
+        Processor as plugin dependency (that way the AP is not visible on the
+        project's actual classpath):</para>
+
+        <example>
+          <title>Configuring the Maven Annotation Plugin</title>
+
+          <programlisting>...
+<plugin>
+    <artifactId>maven-compiler-plugin</artifactId>
+    <configuration>
+        <source>1.6</source>
+        <target>1.6</target>
+        <compilerArgument>-proc:none</compilerArgument>
+    </configuration>
+</plugin>
+<plugin>
+    <groupId>org.bsc.maven</groupId>
+    <artifactId>maven-processor-plugin</artifactId>
+    <version>1.3.4</version>
+    <executions>
+        <execution>
+            <id>process</id>
+            <goals>
+                <goal>process</goal>
+            </goals>
+            <phase>process-sources</phase>
+        </execution>
+    </executions>
+    <dependencies>
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-validator-annotation-processor</artifactId>
+            <version>&version;</version>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
+</plugin>
+...
+                    </programlisting>
+        </example>
+      </section>
+    </section>
+
+    <section>
+      <title>IDE builds</title>
+
+      <section>
+        <title>Eclipse</title>
+
+        <para>Do the following to use the annotation processor within the
+        <ulink url="http://www.eclipse.org/">Eclipse</ulink> IDE:</para>
+
+        <itemizedlist>
+          <listitem>
+            <para>Right-click your project, choose "Properties"</para>
+          </listitem>
+
+          <listitem>
+            <para>Go to "Java Compiler" and make sure, that "Compiler
+            compliance level" is set to "1.6". Otherwise the processor won't
+            be activated</para>
+          </listitem>
+
+          <listitem>
+            <para>Go to "Java Compiler - Annotation Processing" and choose
+            "Enable annotation processing"</para>
+          </listitem>
+
+          <listitem>
+            <para>Go to "Java Compiler - Annotation Processing - Factory Path"
+            and add the following JARs:</para>
+
+            <itemizedlist>
+              <listitem>
+                <para>validation-api-&bvVersion;.jar</para>
+              </listitem>
+
+              <listitem>
+                <para>hibernate-validator-annotation-processor-&version;.jar</para>
+              </listitem>
+            </itemizedlist>
+          </listitem>
+
+          <listitem>
+            <para>Confirm the workspace rebuild</para>
+          </listitem>
+        </itemizedlist>
+
+        <para>You now should see any annotation problems as regular error
+        markers within the editor and in the "Problem" view:</para>
+
+        <mediaobject>
+          <imageobject>
+            <imagedata align="center" arch="" contentwidth="150mm"
+                       fileref="annotation_processor_eclipse.png" />
+          </imageobject>
+        </mediaobject>
+      </section>
+
+      <section>
+        <title>IntelliJ IDEA</title>
+
+        <para>The following steps must be followed to use the annotation
+        processor within <ulink url="http://www.jetbrains.com/idea/">IntelliJ
+        IDEA</ulink> (version 9 and above):</para>
+
+        <itemizedlist>
+          <listitem>
+            <para>Go to "File", then "Settings",</para>
+          </listitem>
+
+          <listitem>
+            <para>Expand the node "Compiler", then "Annotation
+            Processors"</para>
+          </listitem>
+
+          <listitem>
+            <para>Choose "Enable annotation processing" and enter the
+            following as "Processor path":
+            /path/to/validation-api-&bvVersion;.jar:/path/to/hibernate-validator-annotation-processor-&version;.jar</para>
+          </listitem>
+
+          <listitem>
+            <para>Add the processor's fully qualified name
+            <classname>org.hibernate.validator.ap.ConstraintValidationProcessor</classname>
+            to the "Annotation Processors" list</para>
+          </listitem>
+
+          <listitem>
+            <para>If applicable add you module to the "Processed Modules"
+            list</para>
+          </listitem>
+        </itemizedlist>
+
+        <para>Rebuilding your project then should show any erronous constraint
+        annotations:</para>
+
+        <mediaobject>
+          <imageobject>
+            <imagedata align="center" arch="" contentwidth="150mm"
+                       fileref="annotation_processor_intellij.png" />
+          </imageobject>
+        </mediaobject>
+      </section>
+
+      <section>
+        <title>NetBeans</title>
+
+        <para>Starting with version 6.9, also the <ulink
+        url="http://www.netbeans.org/">NetBeans</ulink> IDE supports using
+        annotation processors within the IDE build. To do so, do the
+        following:</para>
+
+        <itemizedlist>
+          <listitem>
+            <para>Right-click your project, choose "Properties"</para>
+          </listitem>
+
+          <listitem>
+            <para>Go to "Libraries", tab "Processor", and add the following
+            two JARs:</para>
+
+            <itemizedlist>
+              <listitem>
+                <para>validation-api-&bvVersion;.jar</para>
+              </listitem>
+
+              <listitem>
+                <para>hibernate-validator-annotation-processor-&version;.jar</para>
+              </listitem>
+            </itemizedlist>
+          </listitem>
+
+          <listitem>
+            <para>Go to "Build - Compiling", select "Enable Annotation
+            Processing" and "Enable Annotation Processing in Editor". Add the
+            annotation processor by specifying its fully qualified name
+            <classname>org.hibernate.validator.ap.ConstraintValidationProcessor</classname></para>
+          </listitem>
+        </itemizedlist>
+
+        <para>Any constraint annotation problems will then be marked directly
+        within the editor:</para>
+
+        <mediaobject>
+          <imageobject>
+            <imagedata align="center" arch="" contentwidth="150mm"
+                       fileref="annotation_processor_netbeans.png" />
+          </imageobject>
+        </mediaobject>
+      </section>
+    </section>
+  </section>
+
+  <section id="section-known-issues">
+    <title>Known issues</title>
+
+    <para>The following known issues exist as of May 2010:</para>
+
+    <itemizedlist>
+      <listitem>
+        <para><ulink
+        url="http://opensource.atlassian.com/projects/hibernate/browse/HV-308">HV-308</ulink>:
+        Additional validators registered for a constraint <ulink
+        url="http://docs.jboss.org/hibernate/stable/validator/reference/en/html_single/#d0e1957">using
+        XML</ulink> are not evaluated by the annotation processor.</para>
+      </listitem>
+
+      <listitem>
+        <para>Sometimes custom constraints can't be <ulink
+        url="http://opensource.atlassian.com/projects/hibernate/browse/HV-293">properly
+        evaluated</ulink> when using the processor within Eclipse. Cleaning
+        the project can help in these situations. This seems to be an issue
+        with the Eclipse JSR 269 API implementation, but further investigation
+        is required here.</para>
+      </listitem>
+    </itemizedlist>
+  </section>
+</chapter>
diff --git a/hibernate-validator/src/main/docbook/en-US/modules/bootstrapping.xml b/hibernate-validator/src/main/docbook/en-US/modules/bootstrapping.xml
index e8d193b..9a59cb3 100644
--- a/hibernate-validator/src/main/docbook/en-US/modules/bootstrapping.xml
+++ b/hibernate-validator/src/main/docbook/en-US/modules/bootstrapping.xml
@@ -1,30 +1,26 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- $Id: bootstrapping.xml 17620 2009-10-04 19:19:28Z hardy.ferentschik $ -->
+<!-- $Id: bootstrapping.xml 19512 2010-05-14 10:27:26Z hardy.ferentschik $ -->
 <!--
-  ~ Hibernate, Relational Persistence for Idiomatic Java
-  ~
-  ~ Copyright (c) 2009, Red Hat, Inc. and/or its affiliates  or third-party contributors as
-  ~ indicated by the @author tags or express copyright attribution
-  ~ statements applied by the authors.  All third-party contributions are
-  ~ distributed under license by Red Hat, Inc.
-  ~
-  ~ This copyrighted material is made available to anyone wishing to use, modify,
-  ~ copy, or redistribute it subject to the terms and conditions of the GNU
-  ~ Lesser General Public License, as published by the Free Software Foundation.
-  ~
-  ~ This program is distributed in the hope that it will be useful,
-  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-  ~ for more details.
-  ~
-  ~ You should have received a copy of the GNU Lesser General Public License
-  ~ along with this distribution; if not, write to:
-  ~ Free Software Foundation, Inc.
-  ~ 51 Franklin Street, Fifth Floor
-  ~ Boston, MA  02110-1301  USA
-  -->
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
-"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+	~ 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.
+-->
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "../hv.ent">
+%BOOK_ENTITIES;
+]>
 <chapter id="validator-bootstrapping">
   <title>Bootstrapping</title>
 
@@ -35,7 +31,7 @@
   <classname>javax.validation.Validation</classname> and how they allow to
   configure several aspects of Bean Validation at bootstrapping time.</para>
 
-  <para>The different bootstrapping options allwow, amongst other things, to
+  <para>The different bootstrapping options allow, amongst other things, to
   bootstrap any Bean Validation implementation on the classpath. Generally, an
   available provider is discovered by the <ulink
   url="http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Service%20Provider">Java
@@ -47,14 +43,14 @@
   implementation. In the case of Hibernate Validator this is
   <classname>org.hibernate.validator.HibernateValidator</classname>.</para>
 
-  <para><note>
-      <para>If there are more than one Bean Validation implementation
-      providers in the classpath and
-      <methodname>Validation.buildDefaultValidatorFactory()</methodname> is
-      used, there is no guarantee which provider will be chosen. To enforce
-      the provider <methodname>Validation.byProvider()</methodname> should be
-      used.</para>
-    </note></para>
+  <note>
+    <para>If there are more than one Bean Validation implementation providers
+    in the classpath and
+    <methodname>Validation.buildDefaultValidatorFactory()</methodname> is
+    used, there is no guarantee which provider will be chosen. To enforce the
+    provider <methodname>Validation.byProvider()</methodname> should be
+    used.</para>
+  </note>
 
   <section id="section-validator-instance">
     <title><classname>Configuration</classname> and
@@ -62,19 +58,23 @@
 
     <para>There are three different methods in the Validation class to create
     a Validator instance. The easiest in shown in <xref
-    linkend="example-build-default-validator-factory" />.<example
-        id="example-build-default-validator-factory">
-        <title>Validation.buildDefaultValidatorFactory()</title>
+    linkend="example-build-default-validator-factory" />.</para>
 
-        <programlisting>ValidatorFactory factory = <emphasis role="bold">Validation.buildDefaultValidatorFactory()</emphasis>;
+    <example id="example-build-default-validator-factory">
+      <title>Validation.buildDefaultValidatorFactory()</title>
+
+      <programlisting language="JAVA" role="JAVA">ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
 Validator validator = factory.getValidator();</programlisting>
-      </example>You can also use the method
+    </example>
+
+    <para>You can also use the method
     <methodname>Validation.byDefaultProvider()</methodname> which will allow
-    you to configure several aspects of the created Validator
-    instance:<example>
-        <title>Validation.byDefaultProvider()</title>
+    you to configure several aspects of the created Validator instance:</para>
 
-        <programlisting>Configuration<?> config = <emphasis role="bold">Validation.byDefaultProvider()</emphasis>.configure();
+    <example>
+      <title>Validation.byDefaultProvider()</title>
+
+      <programlisting language="JAVA" role="JAVA">Configuration<?> config = Validation.byDefaultProvider().configure();
 config.messageInterpolator(new MyMessageInterpolator())
     .traversableResolver( new MyTraversableResolver())
     .constraintValidatorFactory(new MyConstraintValidatorFactory());
@@ -82,8 +82,9 @@ config.messageInterpolator(new MyMessageInterpolator())
 ValidatorFactory factory = config.buildValidatorFactory();
 Validator validator = factory.getValidator();
 </programlisting>
-      </example>We will learn more about
-    <classname>MessageInterpolator</classname>,
+    </example>
+
+    <para>We will learn more about <classname>MessageInterpolator</classname>,
     <classname>TraversableResolver</classname> and
     <classname>ConstraintValidatorFactory</classname> in the following
     sections.</para>
@@ -93,17 +94,19 @@ Validator validator = factory.getValidator();
     one Bean Validation provider in your classpath. In this situation you can
     make an explicit choice about which implementation to use. In the case of
     Hibernate Validator the <classname>Validator</classname> creation looks
-    like:<example>
-        <title>Validation.byProvider( HibernateValidator.class )</title>
+    like:</para>
+
+    <example>
+      <title>Validation.byProvider( HibernateValidator.class )</title>
 
-        <programlisting>ValidatorConfiguration config = <emphasis role="bold">Validation.byProvider( HibernateValidator.class )</emphasis>.configure();
+      <programlisting language="JAVA" role="JAVA">HibernateValidatorConfiguration config = Validation.byProvider( HibernateValidator.class ).configure();
 config.messageInterpolator(new MyMessageInterpolator())
     .traversableResolver( new MyTraversableResolver())
     .constraintValidatorFactory(new MyConstraintValidatorFactory());
 
 ValidatorFactory factory = config.buildValidatorFactory();
 Validator validator = factory.getValidator();</programlisting>
-      </example></para>
+    </example>
 
     <para><tip>
         <para>The generated <classname>Validator</classname> instance is
@@ -120,24 +123,26 @@ Validator validator = factory.getValidator();</programlisting>
     example in an OSGi environment you could plug your custom provider
     resolver like seen in <xref linkend="example-provider-resolver" />.</para>
 
-    <para><example id="example-provider-resolver">
-        <title>Providing a custom ValidationProviderResolver</title>
+    <example id="example-provider-resolver">
+      <title>Providing a custom ValidationProviderResolver</title>
 
-        <programlisting>Configuration<?> config = Validation.byDefaultProvider()
-    <emphasis role="bold">.providerResolver( new OSGiServiceDiscoverer() )</emphasis>
+      <programlisting language="JAVA" role="JAVA">Configuration<?> config = Validation.byDefaultProvider()
+    .providerResolver( new OSGiServiceDiscoverer() )
     .configure();
 
 ValidatorFactory factory = config.buildValidatorFactory();
 Validator validator = factory.getValidator();
 </programlisting>
-      </example>Your <classname>OSGiServiceDiscoverer</classname> must in this
-    case implement the interface
+    </example>
+
+    <para>Your <classname>OSGiServiceDiscoverer</classname> must in this case
+    implement the interface
     <classname>ValidationProviderResolver</classname>:</para>
 
     <example>
       <title>ValidationProviderResolver interface</title>
 
-      <programlisting>public interface ValidationProviderResolver {
+      <programlisting language="JAVA" role="JAVA">public interface ValidationProviderResolver {
     /**
      * Returns a list of ValidationProviders available in the runtime environment.
      *
@@ -165,9 +170,9 @@ Validator validator = factory.getValidator();
     <example id="example-message-interpolator">
       <title>Providing a custom MessageInterpolator</title>
 
-      <programlisting>Configuration<?> configuration = Validation.byDefaultProvider().configure();
+      <programlisting language="JAVA" role="JAVA">Configuration<?> configuration = Validation.byDefaultProvider().configure();
 ValidatorFactory factory = configuration
-    <emphasis role="bold">.messageInterpolator(new ContextualMessageInterpolator(configuration.getDefaultMessageInterpolator()))</emphasis>
+    .messageInterpolator(new ContextualMessageInterpolator(configuration.getDefaultMessageInterpolator()))
     .buildValidatorFactory();
 
 Validator validator = factory.getValidator();
@@ -182,6 +187,48 @@ Validator validator = factory.getValidator();
       implementation is accessible through
       <methodname>Configuration.getDefaultMessageInterpolator()</methodname>.</para>
     </tip>
+
+    <section>
+      <title>ResourceBundleLocator</title>
+
+      <para>A common use case is the ability to specify your own resource
+      bundles for message interpolation. The default
+      <classname>MessageInterpolator</classname> implementation in Hibernate
+      Validator is called
+      <classname>ResourceBundleMessageInterpolator</classname> and per default
+      loads resource bundles via
+      <methodname>ResourceBundle.getBundle</methodname>. However,
+      <classname>ResourceBundleMessageInterpolator</classname> also allows you
+      to specify a custom implementation of
+      <classname>ResourceBundleLocator</classname> allowing you to provide
+      your own resource bundles. <xref
+      linkend="example-resource-bundle-locator" /> shows an example. In the
+      example<methodname>
+      HibernateValidatorConfiguration.getDefaultResourceBundleLocator</methodname>
+      is used to retrieve the default
+      <classname>ResourceBundleLocator</classname> which then can be passed to
+      the custom implementation in order implement delegation. </para>
+
+      <example id="example-resource-bundle-locator">
+        <title>Providing a custom ResourceBundleLocator</title>
+
+        <programlisting language="JAVA" role="JAVA">HibernateValidatorConfiguration configure = Validation.byProvider(HibernateValidator.class).configure();
+
+ResourceBundleLocator defaultResourceBundleLocator = configure.getDefaultResourceBundleLocator(); 
+ResourceBundleLocator myResourceBundleLocator = new MyCustomResourceBundleLocator(defaultResourceBundleLocator);
+
+configure.messageInterpolator(new ResourceBundleMessageInterpolator(myResourceBundleLocator));
+</programlisting>
+      </example>
+
+      <para>Hibernate Validator provides the following implementation of
+      <classname>ResourceBundleLocator</classname> -
+      <classname>PlatformResourceBundleLocator</classname> (the default) and
+      <classname>AggregateResourceBundleLocator</classname>. The latter can be
+      used to specify a list of resource bundle names which will get loaded
+      and merged into a single resource bundle. Refer to the JavaDoc
+      documentation for more information.</para>
+    </section>
   </section>
 
   <section>
@@ -195,11 +242,13 @@ Validator validator = factory.getValidator();
     would have to be accessed triggering a load from the database. Bean
     Validation controls which property can and cannot be accessed via the
     <classname>TraversableResolver</classname> interface (see <xref
-    linkend="example-traversable-resolver" />).<example
-        id="example-traversable-resolver">
-        <title>TraversableResolver interface</title>
+    linkend="example-traversable-resolver" />). In the example
+    HibernateValidatorConfiguration.</para>
+
+    <example id="example-traversable-resolver">
+      <title>TraversableResolver interface</title>
 
-        <programlisting>/**
+      <programlisting language="JAVA" role="JAVA">/**
  * Contract determining if a property can be accessed by the Bean Validation provider
  * This contract is called for each property that is being either validated or cascaded.
  *
@@ -254,7 +303,9 @@ public interface TraversableResolver {
                           ElementType elementType);
 }
 </programlisting>
-      </example>Hibernate Validator provides two
+    </example>
+
+    <para>Hibernate Validator provides two
     <classname>TraversableResolver</classname>s out of the box which will be
     enabled automatically depending on your environment. The first is the
     <classname>DefaultTraversableResolver</classname> which will always return
@@ -264,18 +315,19 @@ public interface TraversableResolver {
     Hibernate Validator gets used in combination with JPA 2. In case you have
     to provide your own resolver you can do so again using the
     <classname>Configuration</classname> object as seen in <xref
-    linkend="example-traversable-resolver-config" />.<example
-        id="example-traversable-resolver-config">
-        <title>Providing a custom TraversableResolver</title>
+    linkend="example-traversable-resolver-config" />.</para>
+
+    <example id="example-traversable-resolver-config">
+      <title>Providing a custom TraversableResolver</title>
 
-        <programlisting>Configuration<?> configuration = Validation.byDefaultProvider().configure();
+      <programlisting language="JAVA" role="JAVA">Configuration<?> configuration = Validation.byDefaultProvider().configure();
 ValidatorFactory factory = configuration
-    <emphasis role="bold">.traversableResolver(new MyTraversableResolver())</emphasis>
+    .traversableResolver(new MyTraversableResolver())
     .buildValidatorFactory();
 
 Validator validator = factory.getValidator();
 </programlisting>
-      </example></para>
+    </example>
   </section>
 
   <section>
@@ -293,22 +345,24 @@ Validator validator = factory.getValidator();
     <classname>Configuration</classname> (<xref
     linkend="example-constraint-validator-factory" />).</para>
 
-    <para><example id="example-constraint-validator-factory">
-        <title>Providing a custom ConstraintValidatorFactory</title>
+    <example id="example-constraint-validator-factory">
+      <title>Providing a custom ConstraintValidatorFactory</title>
 
-        <programlisting>Configuration<?> configuration = Validation.byDefaultProvider().configure();
+      <programlisting language="JAVA" role="JAVA">Configuration<?> configuration = Validation.byDefaultProvider().configure();
 ValidatorFactory factory = configuration
-    <emphasis role="bold">.constraintValidatorFactory(new IOCConstraintValidatorFactory())</emphasis>
+    .constraintValidatorFactory(new IOCConstraintValidatorFactory())
     .buildValidatorFactory();
 
 Validator validator = factory.getValidator();
 </programlisting>
-      </example>The interface you have to implement is:</para>
+    </example>
+
+    <para>The interface you have to implement is:</para>
 
-    <para><example>
-        <title>ConstraintValidatorFactory interface</title>
+    <example>
+      <title>ConstraintValidatorFactory interface</title>
 
-        <programlisting>public interface ConstraintValidatorFactory {
+      <programlisting language="JAVA" role="JAVA">public interface ConstraintValidatorFactory {
     /**
      * @param key The class of the constraint validator to instantiate.
      *
@@ -317,14 +371,18 @@ Validator validator = factory.getValidator();
      <T extends ConstraintValidator<?,?>> T getInstance(Class<T> key);
 }
 </programlisting>
-      </example><warning>
-        <para>Any constraint implementation relying on
-        <classname>ConstraintValidatorFactory</classname> behaviors specific
-        to an implementation (dependency injection, no no-arg constructor and
-        so on) are not considered portable.</para>
-      </warning><note>
-        <para>ConstraintValidatorFactory should not cache instances as the
-        state of each instance can be altered in the initialize method.</para>
-      </note></para>
+    </example>
+
+    <warning>
+      <para>Any constraint implementation relying on
+      <classname>ConstraintValidatorFactory</classname> behaviors specific to
+      an implementation (dependency injection, no no-arg constructor and so
+      on) are not considered portable.</para>
+    </warning>
+
+    <note>
+      <para>ConstraintValidatorFactory should not cache instances as the state
+      of each instance can be altered in the initialize method.</para>
+    </note>
   </section>
 </chapter>
diff --git a/hibernate-validator/src/main/docbook/en-US/modules/customconstraints.xml b/hibernate-validator/src/main/docbook/en-US/modules/customconstraints.xml
index da8869f..0f22b8c 100644
--- a/hibernate-validator/src/main/docbook/en-US/modules/customconstraints.xml
+++ b/hibernate-validator/src/main/docbook/en-US/modules/customconstraints.xml
@@ -1,30 +1,26 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- $Id: customconstraints.xml 17844 2009-10-26 17:08:09Z hardy.ferentschik $ -->
+<!-- $Id: customconstraints.xml 19521 2010-05-15 12:33:09Z gunnar.morling $ -->
 <!--
-  ~ Hibernate, Relational Persistence for Idiomatic Java
-  ~
-  ~ Copyright (c) 2009, Red Hat, Inc. and/or its affiliates  or third-party contributors as
-  ~ indicated by the @author tags or express copyright attribution
-  ~ statements applied by the authors.  All third-party contributions are
-  ~ distributed under license by Red Hat, Inc.
-  ~
-  ~ This copyrighted material is made available to anyone wishing to use, modify,
-  ~ copy, or redistribute it subject to the terms and conditions of the GNU
-  ~ Lesser General Public License, as published by the Free Software Foundation.
-  ~
-  ~ This program is distributed in the hope that it will be useful,
-  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-  ~ for more details.
-  ~
-  ~ You should have received a copy of the GNU Lesser General Public License
-  ~ along with this distribution; if not, write to:
-  ~ Free Software Foundation, Inc.
-  ~ 51 Franklin Street, Fifth Floor
-  ~ Boston, MA  02110-1301  USA
-  -->
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
-"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+	~ 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.
+-->
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "../hv.ent">
+%BOOK_ENTITIES;
+]>
 <chapter id="validator-customconstraints">
   <title>Creating custom constraints</title>
 
@@ -34,7 +30,7 @@
   custom constraints tailored to your specific validation requirements in a
   simple manner.</para>
 
-  <section id="validator-customconstraints-simple" revision="1">
+  <section id="validator-customconstraints-simple">
     <title>Creating a simple constraint</title>
 
     <para>To create a custom constraint, the following three steps are
@@ -54,8 +50,7 @@
       </listitem>
     </itemizedlist>
 
-    <section id="validator-customconstraints-constraintannotation"
-             revision="1">
+    <section id="validator-customconstraints-constraintannotation">
       <title>The constraint annotation</title>
 
       <para>Let's write a constraint annotation, that can be used to express
@@ -73,7 +68,7 @@
         <title>Enum <classname>CaseMode</classname> to express upper vs. lower
         case</title>
 
-        <programlisting>package com.mycompany;
+        <programlisting language="JAVA" role="JAVA">package com.mycompany;
 
 public enum CaseMode {
     UPPER, 
@@ -88,7 +83,7 @@ public enum CaseMode {
       <example>
         <title>Defining CheckCase constraint annotation</title>
 
-        <programlisting>package com.mycompany;
+        <programlisting language="JAVA" role="JAVA">package com.mycompany;
 
 import static java.lang.annotation.ElementType.*;
 import static java.lang.annotation.RetentionPolicy.*;
@@ -98,7 +93,7 @@ import java.lang.annotation.Retention;
 import java.lang.annotation.Target;
 
 import javax.validation.Constraint;
-import javax.validation.ConstraintPayload;
+import javax.validation.Payload;
 
 @Target( { METHOD, FIELD, ANNOTATION_TYPE })
 @Retention(RUNTIME)
@@ -139,13 +134,15 @@ public @interface CheckCase {
 
         <listitem>
           <para>an attribute <classname>payload</classname> that can be used
-          by clients of the Bean Validation API to asign custom payload
+          by clients of the Bean Validation API to assign custom payload
           objects to a constraint. This attribute is not used by the API
           itself. <tip>
-              <para>An examle for a custom payload could be the definition of
-              a severity. <programlisting>public class Severity {
-    public static class Info extends ConstraintPayload {};
-    public static class Error extends ConstraintPayload {};
+              <para>An example for a custom payload could be the definition of
+              a severity.</para>
+
+              <programlisting>public class Severity {
+    public static class Info extends Payload {};
+    public static class Error extends Payload {};
 }
 
 public class ContactDetails {
@@ -156,7 +153,9 @@ public class ContactDetails {
     private String phoneNumber;
 
     // ...
-}</programlisting>Now a client can after the validation of a
+}</programlisting>
+
+              <para>Now a client can after the validation of a
               <classname>ContactDetails</classname> instance access the
               severity of a constraint using
               <methodname>ConstraintViolation.getConstraintDescriptor().getPayload()</methodname>
@@ -166,7 +165,7 @@ public class ContactDetails {
       </itemizedlist>
 
       <para>Besides those three mandatory attributes
-      (<property>messge</property>, <property>groups</property> and
+      (<property>message</property>, <property>groups</property> and
       <property>payload</property>) we add another one allowing for the
       required case mode to be specified. The name <property>value</property>
       is a special one, which can be omitted upon using the annotation, if it
@@ -203,7 +202,7 @@ public class ContactDetails {
       </itemizedlist>
     </section>
 
-    <section id="validator-customconstraints-validator" revision="1">
+    <section id="validator-customconstraints-validator">
       <title id="section-constraint-validator">The constraint
       validator</title>
 
@@ -212,11 +211,11 @@ public class ContactDetails {
       To do so, we implement the interface ConstraintValidator as shown
       below:</para>
 
-      <example>
+      <example id="example-constraint-validator">
         <title>Implementing a constraint validator for the constraint
         <classname>CheckCase</classname></title>
 
-        <programlisting>package com.mycompany;
+        <programlisting language="JAVA" role="JAVA">package com.mycompany;
 
 import javax.validation.ConstraintValidator;
 import javax.validation.ConstraintValidatorContext;
@@ -268,14 +267,103 @@ public class CheckCaseValidator implements ConstraintValidator<CheckCase, Str
       <classname>initialize()</classname>. As the Bean Validation
       specification recommends, we consider <code>null</code> values as being
       valid. If <code>null</code> is not a valid value for an element, it
-      should be annotated with <code>@NotNull</code> explicitely.</para>
+      should be annotated with <code>@NotNull</code> explicitly.</para>
+
+      <section>
+        <title>The ConstraintValidatorContext</title>
+
+        <para><xref linkend="example-constraint-validator" /> relies on the
+        default error message generation by just returning
+        <constant>true</constant> or <constant>false</constant> from the
+        <methodname>isValid</methodname> call. Using the passed
+        <classname>ConstraintValidatorContext</classname> object it is
+        possible to either add additional error messages or completely disable
+        the default error message generation and solely define custom error
+        messages. The <classname>ConstraintValidatorContext</classname> API is
+        modeled as fluent interface and is best demonstrated with an
+        example:</para>
+
+        <example id="example-constraint-validator-context">
+          <title>Use of ConstraintValidatorContext to define custom error
+          messages</title>
+
+          <programlisting language="JAVA" role="JAVA">package com.mycompany;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+public class CheckCaseValidator implements ConstraintValidator<CheckCase, String> {
+
+    private CaseMode caseMode;
+
+    public void initialize(CheckCase constraintAnnotation) {
+        this.caseMode = constraintAnnotation.value();
+    }
+
+    public boolean isValid(String object, ConstraintValidatorContext constraintContext) {
+
+        if (object == null)
+            return true;
+        
+        boolean isValid;
+        if (caseMode == CaseMode.UPPER) {
+            isValid = object.equals(object.toUpperCase());
+        }
+        else {
+            isValid = object.equals(object.toLowerCase());
+        }
+        
+        if(!isValid) {
+            constraintContext.disableDefaultConstraintViolation();
+            constraintContext.buildConstraintViolationWithTemplate( "{com.mycompany.constraints.CheckCase.message}"  ).addConstraintViolation();
+        }
+        return result;
+    }
+
+}</programlisting>
+        </example>
+
+        <para><xref linkend="example-constraint-validator-context" os="" />
+        shows how you can disable the default error message generation and add
+        a custom error message using a specified message template. In this
+        example the use of the
+        <classname>ConstraintValidatorContext</classname> results in the same
+        error message as the default error message generation. <tip>
+            <para>It is important to end each new constraint violation with
+            <methodname>addConstraintViolation</methodname>. Only after that
+            the new constraint violation will be created.</para>
+          </tip></para>
+
+        <para>In case you are implementing a
+        <classname>ConstraintValidator</classname> a class level constraint it
+        is also possible to adjust set the property path for the created
+        constraint violations. This is important for the case where you
+        validate multiple properties of the class or even traverse the object
+        graph. A custom property path creation could look like <xref
+        linkend="example-custom-error" />.</para>
+
+        <example id="example-custom-error">
+          <title>Adding new <classname>ConstraintViolation</classname> with
+          custom property path</title>
+
+          <programlisting language="JAVA" role="JAVA">public boolean isValid(Group group, ConstraintValidatorContext constraintValidatorContext) {
+    boolean isValid = false;
+    ...
+
+    if(!isValid) {
+        constraintValidatorContext
+            .buildConstraintViolationWithTemplate( "{my.custom.template}" )
+            .addNode( "myProperty" ).addConstraintViolation();
+    }
+    return isValid;
+}
 
-      <para>The passed-in <classname>ConstraintValidatorContext</classname>
-      could be used to raise any custom validation errors, but as we are fine
-      with the default behavior, we can ignore that parameter for now.</para>
+</programlisting>
+        </example>
+      </section>
     </section>
 
-    <section id="validator-customconstraints-errormessage" revision="1">
+    <section id="validator-customconstraints-errormessage">
       <title>The error message</title>
 
       <para>Finally we need to specify the error message, that shall be used,
@@ -297,7 +385,7 @@ public class CheckCaseValidator implements ConstraintValidator<CheckCase, Str
       message in this file.</para>
     </section>
 
-    <section id="validator-customconstraints-using" revision="1">
+    <section id="validator-customconstraints-using">
       <title>Using the constraint</title>
 
       <para>Now that our first custom constraint is completed, we can use it
@@ -310,7 +398,7 @@ public class CheckCaseValidator implements ConstraintValidator<CheckCase, Str
         <title>Applying the <classname>CheckCase</classname>
         constraint</title>
 
-        <programlisting>package com.mycompany;
+        <programlisting language="JAVA" role="JAVA">package com.mycompany;
 
 import javax.validation.constraints.Min;
 import javax.validation.constraints.NotNull;
@@ -349,7 +437,7 @@ public class Car {
         <title>Testcase demonstrating the <classname>CheckCase</classname>
         validation</title>
 
-        <programlisting>package com.mycompany;
+        <programlisting language="JAVA" role="JAVA">package com.mycompany;
 
 import static org.junit.Assert.*;
 
@@ -401,7 +489,7 @@ public class CarTest {
     </section>
   </section>
 
-  <section id="validator-customconstraints-compound" revision="1">
+  <section id="validator-customconstraints-compound">
     <title>Constraint composition</title>
 
     <para>Looking at the <property>licensePlate</property> field of the
@@ -423,7 +511,7 @@ public class CarTest {
       <title>Creating a composing constraint
       <classname>ValidLicensePlate</classname></title>
 
-      <programlisting>package com.mycompany;
+      <programlisting language="JAVA" role="JAVA">package com.mycompany;
 
 import static java.lang.annotation.ElementType.*;
 import static java.lang.annotation.RetentionPolicy.*;
@@ -433,7 +521,7 @@ import java.lang.annotation.Retention;
 import java.lang.annotation.Target;
 
 import javax.validation.Constraint;
-import javax.validation.ConstraintPayload;
+import javax.validation.Payload;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 
@@ -472,7 +560,7 @@ public @interface ValidLicensePlate {
       <title>Application of composing constraint
       <classname>ValidLicensePlate</classname></title>
 
-      <programlisting>package com.mycompany;
+      <programlisting language="JAVA" role="JAVA">package com.mycompany;
 
 public class Car {
 
@@ -496,7 +584,7 @@ public class Car {
     <example>
       <title>Usage of <classname>@ReportAsSingleViolation</classname></title>
 
-      <programlisting>//...
+      <programlisting language="JAVA" role="JAVA">//...
 @ReportAsSingleViolation
 public @interface ValidLicensePlate {
 
diff --git a/hibernate-validator/src/main/docbook/en-US/modules/defineconstraints.xml b/hibernate-validator/src/main/docbook/en-US/modules/defineconstraints.xml
deleted file mode 100644
index 01e8b93..0000000
--- a/hibernate-validator/src/main/docbook/en-US/modules/defineconstraints.xml
+++ /dev/null
@@ -1,494 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- $Id: defineconstraints.xml 17620 2009-10-04 19:19:28Z hardy.ferentschik $ -->
-<!--
-  ~ Hibernate, Relational Persistence for Idiomatic Java
-  ~
-  ~ Copyright (c) 2009, Red Hat, Inc. and/or its affiliates  or third-party contributors as
-  ~ indicated by the @author tags or express copyright attribution
-  ~ statements applied by the authors.  All third-party contributions are
-  ~ distributed under license by Red Hat, Inc.
-  ~
-  ~ This copyrighted material is made available to anyone wishing to use, modify,
-  ~ copy, or redistribute it subject to the terms and conditions of the GNU
-  ~ Lesser General Public License, as published by the Free Software Foundation.
-  ~
-  ~ This program is distributed in the hope that it will be useful,
-  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-  ~ for more details.
-  ~
-  ~ You should have received a copy of the GNU Lesser General Public License
-  ~ along with this distribution; if not, write to:
-  ~ Free Software Foundation, Inc.
-  ~ 51 Franklin Street, Fifth Floor
-  ~ Boston, MA  02110-1301  USA
-  -->
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
-"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
-<chapter id="validator-defineconstraints">
-  <title>Defining constraints</title>
-
-  <section id="validator-defineconstraints-definition" revision="1">
-    <title>What is a constraint?</title>
-
-    <para>A constraint is a rule that a given element (field, property or
-    bean) has to comply to. The rule semantic is expressed by an annotation. A
-    constraint usually has some attributes used to parameterize the
-    constraints limits. The constraint applies to the annotated
-    element.</para>
-  </section>
-
-  <section id="foo" revision="2">
-    <title>Built in constraints</title>
-
-    <para>Hibernate Validator comes with some built-in constraints, which
-    covers most basic data checks. As we'll see later, you're not limited to
-    them, you can literally in a minute write your own constraints.</para>
-
-    <table>
-      <title>Built-in constraints</title>
-
-      <tgroup cols="4">
-        <colspec align="center" />
-
-        <thead>
-          <row>
-            <entry>Annotation</entry>
-
-            <entry>Apply on</entry>
-
-            <entry>Runtime checking</entry>
-
-            <entry>Hibernate Metadata impact</entry>
-          </row>
-        </thead>
-
-        <tbody>
-          <row>
-            <entry>@Length(min=, max=)</entry>
-
-            <entry>property (String)</entry>
-
-            <entry>check if the string length match the range</entry>
-
-            <entry>Column length will be set to max</entry>
-          </row>
-
-          <row>
-            <entry>@Max(value=)</entry>
-
-            <entry>property (numeric or string representation of a
-            numeric)</entry>
-
-            <entry>check if the value is less than or equals to max</entry>
-
-            <entry>Add a check constraint on the column</entry>
-          </row>
-
-          <row>
-            <entry>@Min(value=)</entry>
-
-            <entry>property (numeric or string representation of a
-            numeric)</entry>
-
-            <entry>check if the value is more than or equals to min</entry>
-
-            <entry>Add a check constraint on the column</entry>
-          </row>
-
-          <row>
-            <entry>@NotNull</entry>
-
-            <entry>property</entry>
-
-            <entry>check if the value is not null</entry>
-
-            <entry>Column(s) are not null</entry>
-          </row>
-
-          <row>
-            <entry>@NotEmpty</entry>
-
-            <entry>property</entry>
-
-            <entry>check if the string is not null nor empty. Check if the
-            connection is not null nor empty</entry>
-
-            <entry>Column(s) are not null (for String)</entry>
-          </row>
-
-          <row>
-            <entry>@Past</entry>
-
-            <entry>property (date or calendar)</entry>
-
-            <entry>check if the date is in the past</entry>
-
-            <entry>Add a check constraint on the column</entry>
-          </row>
-
-          <row>
-            <entry>@Future</entry>
-
-            <entry>property (date or calendar)</entry>
-
-            <entry>check if the date is in the future</entry>
-
-            <entry>none</entry>
-          </row>
-
-          <row>
-            <entry>@Pattern(regex="regexp", flag=) or @Patterns(
-            {@Pattern(...)} )</entry>
-
-            <entry>property (string)</entry>
-
-            <entry>check if the property match the regular expression given a
-            match flag (see <classname>java.util.regex.Pattern </classname>
-            )</entry>
-
-            <entry>none</entry>
-          </row>
-
-          <row>
-            <entry>@Range(min=, max=)</entry>
-
-            <entry>property (numeric or string representation of a
-            numeric)</entry>
-
-            <entry>check if the value is between min and max
-            (included)</entry>
-
-            <entry>Add a check constraint on the column</entry>
-          </row>
-
-          <row>
-            <entry>@Size(min=, max=)</entry>
-
-            <entry>property (array, collection, map)</entry>
-
-            <entry>check if the element size is between min and max
-            (included)</entry>
-
-            <entry>none</entry>
-          </row>
-
-          <row>
-            <entry>@AssertFalse</entry>
-
-            <entry>property</entry>
-
-            <entry>check that the method evaluates to false (useful for
-            constraints expressed in code rather than annotations)</entry>
-
-            <entry>none</entry>
-          </row>
-
-          <row>
-            <entry>@AssertTrue</entry>
-
-            <entry>property</entry>
-
-            <entry>check that the method evaluates to true (useful for
-            constraints expressed in code rather than annotations)</entry>
-
-            <entry>none</entry>
-          </row>
-
-          <row>
-            <entry>@Valid</entry>
-
-            <entry>property (object)</entry>
-
-            <entry>perform validation recursively on the associated object. If
-            the object is a Collection or an array, the elements are validated
-            recursively. If the object is a Map, the value elements are
-            validated recursively.</entry>
-
-            <entry>none</entry>
-          </row>
-
-          <row>
-            <entry>@Email</entry>
-
-            <entry>property (String)</entry>
-
-            <entry>check whether the string is conform to the email address
-            specification</entry>
-
-            <entry>none</entry>
-          </row>
-
-          <row>
-            <entry>@CreditCardNumber</entry>
-
-            <entry>property (String)</entry>
-
-            <entry>check whether the string is a well formated credit card
-            number (derivative of the Luhn algorithm)</entry>
-
-            <entry>none</entry>
-          </row>
-
-          <row>
-            <entry>@Digits</entry>
-
-            <entry>property (numeric or string representation of a
-            numeric)</entry>
-
-            <entry>check whether the property is a number having up to
-            <literal>integerDigits</literal> integer digits and
-            <literal>fractionalDigits</literal> fractonal digits</entry>
-
-            <entry>define column precision and scale</entry>
-          </row>
-
-          <row>
-            <entry>@EAN</entry>
-
-            <entry>property (string)</entry>
-
-            <entry>check whether the string is a properly formated EAN or
-            UPC-A code</entry>
-
-            <entry>none</entry>
-          </row>
-        </tbody>
-      </tgroup>
-    </table>
-  </section>
-
-  <section id="validator-defineconstraints-error" xreflabel="Error messages">
-    <title>Error messages</title>
-
-    <para>Hibernate Validator comes with a default set of error messages
-    translated in about ten languages (if yours is not part of it, please sent
-    us a patch). You can override those messages by creating a
-    <filename>ValidatorMessages.properties</filename> or (
-    <filename>ValidatorMessages_loc.properties</filename> ) and override the
-    needed keys. You can even add your own additional set of messages while
-    writing your validator annotations. If Hibernate Validator cannot resolve
-    a key from your resourceBundle nor from ValidatorMessage, it falls back to
-    the default built-in values.</para>
-
-    <para>Alternatively you can provide a
-    <classname>ResourceBundle</classname> while checking programmatically the
-    validation rules on a bean or if you want a completly different
-    interpolation mechanism, you can provide an implementation of
-    <literal>org.hibernate.validator.MessageInterpolator</literal> (check the
-    JavaDoc for more informations).</para>
-  </section>
-
-  <section id="validator-defineconstraints-own" revision="1">
-    <title>Writing your own constraints</title>
-
-    <para>Extending the set of built-in constraints is extremely easy. Any
-    constraint consists of two pieces: the constraint
-    <emphasis>descriptor</emphasis> (the annotation) and the constraint
-    <emphasis>validator</emphasis> (the implementation class). Here is a
-    simple user-defined descriptor:</para>
-
-    <programlisting>@ValidatorClass(CapitalizedValidator.class)
- at Target(METHOD)
- at Retention(RUNTIME)
- at Documented
-public @interface Capitalized {
-    CapitalizeType type() default Capitalize.FIRST;
-    String message() default "has incorrect capitalization"
-}        </programlisting>
-
-    <para><literal>type</literal> is a parameter describing how the property
-    should to be capitalized. This is a user parameter fully dependant on the
-    annotation business.</para>
-
-    <para><literal>message</literal> is the default string used to describe
-    the constraint violation and is mandatory. You can hard code the string or
-    you can externalize part/all of it through the Java ResourceBundle
-    mechanism. Parameters values are going to be injected inside the message
-    when the <literal>{parameter}</literal> string is found (in our example
-    <literal>Capitalization is not {type}</literal> would generate
-    <literal>Capitalization is not FIRST</literal> ), externalizing the whole
-    string in <filename>ValidatorMessages.properties</filename> is considered
-    good practice. See <xref linkend="validator-defineconstraints-error" />
-    .</para>
-
-    <programlisting>@ValidatorClass(CapitalizedValidator.class)
- at Target(METHOD)
- at Retention(RUNTIME)
- at Documented
-public @interface Capitalized {
-    CapitalizeType type() default Capitalize.FIRST;
-    String message() default "{validator.capitalized}";
-}
-
-
-#in ValidatorMessages.properties
-validator.capitalized = <literal>Capitalization is not {type}</literal>
-        </programlisting>
-
-    <para>As you can see the {} notation is recursive.</para>
-
-    <para>To link a descriptor to its validator implementation, we use the
-    <literal>@ValidatorClass</literal> meta-annotation. The validator class
-    parameter must name a class which implements
-    <literal>Validator<ConstraintAnnotation></literal> .</para>
-
-    <para>We now have to implement the validator (ie. the rule checking
-    implementation). A validation implementation can check the value of the a
-    property (by implementing <literal>PropertyConstraint</literal> ) and/or
-    can modify the hibernate mapping metadata to express the constraint at the
-    database level (by implementing
-    <literal>PersistentClassConstraint</literal> )</para>
-
-    <programlisting>public class CapitalizedValidator
-        implements Validator<Capitalized>, PropertyConstraint {
-    private CapitalizeType type;
-
-    //part of the Validator<Annotation> contract,
-    //allows to get and use the annotation values
-    public void initialize(Capitalized parameters) {
-        type = parameters.type();
-    }
-
-    //part of the property constraint contract
-    public boolean isValid(Object value) {
-        if (value==null) return true;
-        if ( !(value instanceof String) ) return false;
-        String string = (String) value;
-        if (type == CapitalizeType.ALL) {
-            return string.equals( string.toUpperCase() );
-        }
-        else {
-            String first = string.substring(0,1);
-            return first.equals( first.toUpperCase();
-        }
-    }
-}        </programlisting>
-
-    <para>The <literal>isValid()</literal> method should return false if the
-    constraint has been violated. For more examples, refer to the built-in
-    validator implementations.</para>
-
-    <para>We only have seen property level validation, but you can write a
-    Bean level validation annotation. Instead of receiving the return instance
-    of a property, the bean itself will be passed to the validator. To
-    activate the validation checking, just annotated the bean itself instead.
-    A small sample can be found in the unit test suite.</para>
-
-    <para>If your constraint can be applied multiple times (with different
-    parameters) on the same property or type, you can use the following
-    annotation form:</para>
-
-    <programlisting>@Target(METHOD)
- at Retention(RUNTIME)
- at Documented
-<emphasis role="bold">public @interface Patterns {</emphasis>
-    Pattern[] value();
-}
-
- at Target(METHOD)
- at Retention(RUNTIME)
- at Documented
- at ValidatorClass(PatternValidator.class)
-public @interface Pattern {
-    String regexp();
-}</programlisting>
-
-    <para>Basically an annotation containing the value attribute as an array
-    of validator annotations.</para>
-  </section>
-
-  <section>
-    <title>Annotating your domain model</title>
-
-    <para>Since you are already familiar with annotations now, the syntax
-    should be very familiar</para>
-
-    <programlisting>public class Address {
-    private String line1;
-    private String line2;
-    private String zip;
-    private String state;
-    private String country;
-    private long id;
-
-    // a not null string of 20 characters maximum
-    @Length(max=20)
-    @NotNull
-    public String getCountry() {
-        return country;
-    }
-
-    // a non null string
-    @NotNull
-    public String getLine1() {
-        return line1;
-    }
-
-    //no constraint
-    public String getLine2() {
-        return line2;
-    }
-
-    // a not null string of 3 characters maximum
-    @Length(max=3) @NotNull
-    public String getState() {
-        return state;
-    }
-
-    // a not null numeric string of 5 characters maximum
-    // if the string is longer, the message will
-    //be searched in the resource bundle at key 'long'
-    @Length(max=5, message="{long}")
-    @Pattern(regex="[0-9]+")
-    @NotNull
-    public String getZip() {
-        return zip;
-    }
-
-    // should always be true
-    @AssertTrue
-    public boolean isValid() {
-        return true;
-    }
-
-    // a numeric between 1 and 2000
-    @Id @Min(1)
-    @Range(max=2000)
-    public long getId() {
-        return id;
-    }
-}        </programlisting>
-
-    <para>While the example only shows public property validation, you can
-    also annotate fields of any kind of visibility</para>
-
-    <programlisting>@MyBeanConstraint(max=45
-public class Dog {
-    @AssertTrue private boolean isMale;
-    @NotNull protected String getName() { ... };
-    ...
-}        </programlisting>
-
-    <para>You can also annotate interfaces. Hibernate Validator will check all
-    superclasses and interfaces extended or implemented by a given bean to
-    read the appropriate validator annotations.</para>
-
-    <programlisting>public interface Named {
-    @NotNull String getName();
-    ...
-}
-
-public class Dog implements Named {
-
-    @AssertTrue private boolean isMale;
-
-    public String getName() { ... };
-
-}
-        </programlisting>
-
-    <para>The name property will be checked for nullity when the Dog bean is
-    validated.</para>
-  </section>
-</chapter>
diff --git a/hibernate-validator/src/main/docbook/en-US/modules/furtherreading.xml b/hibernate-validator/src/main/docbook/en-US/modules/furtherreading.xml
index 7c0cc12..9739820 100644
--- a/hibernate-validator/src/main/docbook/en-US/modules/furtherreading.xml
+++ b/hibernate-validator/src/main/docbook/en-US/modules/furtherreading.xml
@@ -1,30 +1,26 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- $Id: bootstrapping.xml 17523 2009-09-16 15:51:58Z hardy.ferentschik $ -->
+<!-- $Id: furtherreading.xml 19637 2010-05-31 14:55:26Z hardy.ferentschik $ -->
 <!--
-  ~ Hibernate, Relational Persistence for Idiomatic Java
-  ~
-  ~ Copyright (c) 2009, Red Hat, Inc. and/or its affiliates  or third-party contributors as
-  ~ indicated by the @author tags or express copyright attribution
-  ~ statements applied by the authors.  All third-party contributions are
-  ~ distributed under license by Red Hat, Inc.
-  ~
-  ~ This copyrighted material is made available to anyone wishing to use, modify,
-  ~ copy, or redistribute it subject to the terms and conditions of the GNU
-  ~ Lesser General Public License, as published by the Free Software Foundation.
-  ~
-  ~ This program is distributed in the hope that it will be useful,
-  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-  ~ for more details.
-  ~
-  ~ You should have received a copy of the GNU Lesser General Public License
-  ~ along with this distribution; if not, write to:
-  ~ Free Software Foundation, Inc.
-  ~ 51 Franklin Street, Fifth Floor
-  ~ Boston, MA  02110-1301  USA
-  -->
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
-"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+	~ 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.
+-->
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "../hv.ent">
+%BOOK_ENTITIES;
+]>
 <chapter>
   <title id="chapter-further-reading">Further reading</title>
 
@@ -39,11 +35,12 @@
   itself is also a great way to deepen your understanding of Bean Validation
   resp. Hibernate Validator.</para>
 
-  <para>If you have any furhter questions to Hibernate Validator or want to
+  <para>If you have any further questions to Hibernate Validator or want to
   share some of your use cases have a look at the <ulink
-  url="http://www.hibernate.org/469.html">Hibernate Validator Wiki</ulink> and
-  the <ulink url="https://forum.hibernate.org/viewforum.php?f=9">Hibernate
-  Validator Forum</ulink>.</para>
+  url="http://community.jboss.org/en/hibernate/validator">Hibernate Validator
+  Wiki</ulink> and the <ulink
+  url="https://forum.hibernate.org/viewforum.php?f=9">Hibernate Validator
+  Forum</ulink>.</para>
 
   <para>In case you would like to report a bug use <ulink
   url="http://opensource.atlassian.com/projects/hibernate/browse/HV">Hibernate's
diff --git a/hibernate-validator/src/main/docbook/en-US/modules/gettingstarted.xml b/hibernate-validator/src/main/docbook/en-US/modules/gettingstarted.xml
index f66e52f..517ce53 100644
--- a/hibernate-validator/src/main/docbook/en-US/modules/gettingstarted.xml
+++ b/hibernate-validator/src/main/docbook/en-US/modules/gettingstarted.xml
@@ -1,30 +1,26 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- $Id: gettingstarted.xml 17620 2009-10-04 19:19:28Z hardy.ferentschik $ -->
+<!-- $Id: gettingstarted.xml 19641 2010-06-01 12:46:16Z hardy.ferentschik $ -->
 <!--
-  ~ Hibernate, Relational Persistence for Idiomatic Java
-  ~
-  ~ Copyright (c) 2009, Red Hat, Inc. and/or its affiliates  or third-party contributors as
-  ~ indicated by the @author tags or express copyright attribution
-  ~ statements applied by the authors.  All third-party contributions are
-  ~ distributed under license by Red Hat, Inc.
-  ~
-  ~ This copyrighted material is made available to anyone wishing to use, modify,
-  ~ copy, or redistribute it subject to the terms and conditions of the GNU
-  ~ Lesser General Public License, as published by the Free Software Foundation.
-  ~
-  ~ This program is distributed in the hope that it will be useful,
-  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-  ~ for more details.
-  ~
-  ~ You should have received a copy of the GNU Lesser General Public License
-  ~ along with this distribution; if not, write to:
-  ~ Free Software Foundation, Inc.
-  ~ 51 Franklin Street, Fifth Floor
-  ~ Boston, MA  02110-1301  USA
-  -->
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
-"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+	~ 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.
+-->
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "../hv.ent">
+%BOOK_ENTITIES;
+]>
 <chapter id="validator-gettingstarted">
   <title id="getting-started">Getting started</title>
 
@@ -71,7 +67,30 @@
     </listitem>
   </itemizedlist>
 
-  <section id="validator-gettingstarted-createproject" revision="1">
+  <note>
+    <para>Hibernate Validator uses JAXB for XML parsing. JAXB is part of the
+    Java Class Library since Java 6 which means that if you run Hibernate
+    Validator with Java 5 you will have to add additional JAXB dependencies.
+    Using maven you have to add the following dependencies:<programlisting><dependency>
+    <groupId>javax.xml.bind</groupId>
+    <artifactId>jaxb-api</artifactId>
+    <version>2.2</version>
+</dependency>
+<dependency>
+    <groupId>com.sun.xml.bind</groupId>
+    <artifactId>jaxb-impl</artifactId>
+    <version>2.1.12</version>
+</dependency>
+</programlisting> if you are using the SourceForge package you find the
+    necessary libraries in the <filename>lib/jdk5</filename> directory. In
+    case you are not using the XML configuration you can also disable it
+    explicitly by calling
+    <methodname>Configuration.ignoreXmlConfiguration()</methodname> during
+    <classname>ValidationFactory</classname> creation. In this case the JAXB
+    dependencies are not needed.</para>
+  </note>
+
+  <section id="validator-gettingstarted-createproject">
     <title>Setting up a new Maven project</title>
 
     <para>Start by creating new Maven project using the Maven archetype plugin
@@ -81,37 +100,31 @@
         <title>Using Maven's archetype plugin to create a sample project using
         Hibernate Validator</title>
 
-        <programlisting>mvn archetype:generate \
-  -DarchetypeCatalog=http://repository.jboss.com/maven2/archetype-catalog.xml \
-  -DgroupId=com.mycompany \
-  -DartifactId=beanvalidation-gettingstarted \
-  -Dversion=1.0-SNAPSHOT \
-  -Dpackage=com.mycompany</programlisting>
+        <programlisting>mvn archetype:create -DarchetypeGroupId=org.hibernate \
+                     -DarchetypeArtifactId=hibernate-validator-quickstart-archetype \
+                     -DarchetypeVersion=&version; \
+                     -DgroupId=com.mycompany 
+                     -DartifactId=hv-quickstart</programlisting>
       </example></para>
 
-    <para>When presented with the list of available archetypes in the JBoss
-    Maven Repository select the
-    <emphasis>hibernate-validator-quickstart-archetype. </emphasis>After Maven
-    has downloaded all dependencies confirm the settings by just pressing
-    enter. Maven will create your project in the directory
-    <filename>beanvalidation-gettingstarted</filename>. Change into this
-    directory and run:</para>
+    <para>Maven will create your project in the directory hv-quickstart.
+    Change into this directory and run:</para>
 
     <para><programlisting>mvn test</programlisting>Maven will compile the
     example code and run the implemented unit tests. Let's have a look at the
     actual code.</para>
   </section>
 
-  <section id="validator-gettingstarted-createmodel" revision="1">
+  <section id="validator-gettingstarted-createmodel">
     <title>Applying constraints</title>
 
     <para>Open the project in the IDE of your choice and have a look at the
     class <classname>Car</classname>:</para>
 
-    <para><example id="example-class-car" xreflabel="">
-        <title>Class Car annotated with constraints</title>
+    <example id="example-class-car">
+      <title>Class Car annotated with constraints</title>
 
-        <programlisting language="Java">package com.mycompany;
+      <programlisting language="JAVA" role="JAVA">package com.mycompany;
 
 import javax.validation.constraints.Min;
 import javax.validation.constraints.NotNull;
@@ -119,14 +132,14 @@ import javax.validation.constraints.Size;
 
 public class Car {
 
-    <emphasis role="bold">@NotNull</emphasis>
+    @NotNull
     private String manufacturer;
 
-    <emphasis role="bold">@NotNull</emphasis>
-    <emphasis role="bold">@Size(min = 2, max = 14)</emphasis>
+    @NotNull
+    @Size(min = 2, max = 14)
     private String licensePlate;
 
-    <emphasis role="bold">@Min(2)</emphasis>
+    @Min(2)
     private int seatCount;
     
     public Car(String manufacturer, String licencePlate, int seatCount) {
@@ -137,9 +150,11 @@ public class Car {
 
     //getters and setters ...
 }</programlisting>
-      </example><classname>@NotNull</classname>, <classname>@Size</classname>
-    and <classname>@Min</classname> are so-called constraint annotations, that
-    we use to declare constraints, which shall be applied to the fields of a
+    </example>
+
+    <para><classname>@NotNull</classname>, <classname>@Size</classname> and
+    <classname>@Min</classname> are so-called constraint annotations, that we
+    use to declare constraints, which shall be applied to the fields of a
     <classname>Car</classname> instance:</para>
 
     <itemizedlist>
@@ -165,10 +180,10 @@ public class Car {
     <classname>Validator</classname> instance. Let's have a look at the
     <classname>CarTest</classname> class:</para>
 
-    <example xreflabel="CarTest-example">
+    <example>
       <title>Class CarTest showing validation examples</title>
 
-      <programlisting language="Java">package com.mycompany;
+      <programlisting language="JAVA" role="JAVA">package com.mycompany;
 
 import static org.junit.Assert.*;
 
@@ -277,14 +292,14 @@ public class CarTest {
     arise.</para>
   </section>
 
-  <section id="validator-gettingstarted-whatsnext" revision="1">
+  <section id="validator-gettingstarted-whatsnext">
     <title>Where to go next?</title>
 
     <para>That concludes our 5 minute tour through the world of Hibernate
-    Validator. Continue exploring the code or look at further examples
-    referenced in <xref linkend="chapter-further-reading" />. To get a deeper
-    understanding of the Bean Validation just continue reading.<xref
-    linkend="validator-usingvalidator" />. In case your application has
+    Validator. Continue exploring the code examples or look at further
+    examples referenced in <xref linkend="chapter-further-reading" />. To
+    deepen your understanding of Hibernate Validator just continue reading
+    <xref linkend="validator-usingvalidator" />. In case your application has
     specific validation requirements have a look at <xref
     linkend="validator-customconstraints" />.</para>
   </section>
diff --git a/hibernate-validator/src/main/docbook/en-US/modules/integration.xml b/hibernate-validator/src/main/docbook/en-US/modules/integration.xml
index 22bd2cc..3d706fd 100644
--- a/hibernate-validator/src/main/docbook/en-US/modules/integration.xml
+++ b/hibernate-validator/src/main/docbook/en-US/modules/integration.xml
@@ -1,30 +1,26 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- $Id: integration.xml 17620 2009-10-04 19:19:28Z hardy.ferentschik $ -->
+<!-- $Id: integration.xml 19521 2010-05-15 12:33:09Z gunnar.morling $ -->
 <!--
-  ~ Hibernate, Relational Persistence for Idiomatic Java
-  ~
-  ~ Copyright (c) 2009, Red Hat, Inc. and/or its affiliates  or third-party contributors as
-  ~ indicated by the @author tags or express copyright attribution
-  ~ statements applied by the authors.  All third-party contributions are
-  ~ distributed under license by Red Hat, Inc.
-  ~
-  ~ This copyrighted material is made available to anyone wishing to use, modify,
-  ~ copy, or redistribute it subject to the terms and conditions of the GNU
-  ~ Lesser General Public License, as published by the Free Software Foundation.
-  ~
-  ~ This program is distributed in the hope that it will be useful,
-  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-  ~ for more details.
-  ~
-  ~ You should have received a copy of the GNU Lesser General Public License
-  ~ along with this distribution; if not, write to:
-  ~ Free Software Foundation, Inc.
-  ~ 51 Franklin Street, Fifth Floor
-  ~ Boston, MA  02110-1301  USA
-  -->
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
-"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+	~ 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.
+-->
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "../hv.ent">
+%BOOK_ENTITIES;
+]>
 <chapter id="validator-checkconstraints">
   <title>Integration with other frameworks</title>
 
@@ -33,7 +29,20 @@
   annotated domain model) and checked in various different layers of the
   application.</para>
 
-  <section id="validator-checkconstraints-db" revision="2">
+  <section>
+    <title>OSGi</title>
+
+    <para>The Hibernate Validator jar file is conform to the OSGi
+    specification and can be used within any OSGi container. The classes in
+    the following packages are exported by Hibernate Validator and are
+    considered part of the public API -
+    <package>org.hibernate.validator</package>,
+    <package>org.hibernate.validator.constraints</package>,
+    <package>org.hibernate.validator.messageinterpolation</package> and
+    <package>org.hibernate.validator.resourceloading</package>.</para>
+  </section>
+
+  <section id="validator-checkconstraints-db">
     <title>Database schema-level validation</title>
 
     <para>Out of the box, Hibernate Annotations (as of Hibernate 3.5.x) will
@@ -50,7 +59,7 @@
     <para>You can also limit the DDL constraint generation to a subset of the
     defined constraints by setting the property
     <property>org.hibernate.validator.group.ddl</property>. The property
-    specifies the comma seperated, fully specified classnames of the groups a
+    specifies the comma-separated, fully specified class names of the groups a
     constraint has to be part of in order to be considered for DDL schema
     generation.</para>
   </section>
@@ -61,7 +70,7 @@
     <para>Hibernate Validator integrates with both Hibernate and all pure Java
     Persistence providers.</para>
 
-    <section id="validator-checkconstraints-orm-hibernateevent" revision="1">
+    <section id="validator-checkconstraints-orm-hibernateevent">
       <title>Hibernate event-based validation</title>
 
       <para>Hibernate Validator has a built-in Hibernate event listener -
@@ -79,7 +88,7 @@
       <property>javax.persistence.validation.group.pre-persist</property>,
       <property>javax.persistence.validation.group.pre-update</property> and
       <property>javax.persistence.validation.group.pre-remove</property>. The
-      values of these properties are the comma seperated, fully specified
+      values of these properties are the comma-separated, fully specified
       class names of the groups to validate. <xref
       linkend="example-beanvalidationeventlistener-config" /> shows the
       default values for these properties. In this case they could also be
@@ -109,28 +118,29 @@
         <title>Manual configuration of
         <classname>BeanValidationEvenListener</classname></title>
 
-        <programlisting><hibernate-configuration>
+        <programlisting language="XML" role="XML"><hibernate-configuration>
     <session-factory>
        ...
-       <property name="javax.persistence.validation.group.pre-persist">javax.validation.Default</property>
-       <property name="javax.persistence.validation.group.pre-update">javax.validation.Default</property>
+       <property name="javax.persistence.validation.group.pre-persist">javax.validation.groups.Default</property>
+       <property name="javax.persistence.validation.group.pre-update">javax.validation.groups.Default</property>
        <property name="javax.persistence.validation.group.pre-remove"></property>
+       ...
+       <event type="pre-update">
+         <listener class="org.hibernate.cfg.beanvalidation.BeanValidationEventListener"/>
+       </event>
+       <event type="pre-insert">
+         <listener class="org.hibernate.cfg.beanvalidation.BeanValidationEventListener"/>
+       </event>
+       <event type="pre-delete">
+         <listener class="org.hibernate.cfg.beanvalidation.BeanValidationEventListener"/>
+       </event>
     </session-factory>
-    <event type="pre-update">
-       <listener class="<classname>org.hibernate.cfg.beanvalidation.BeanValidationEventListener</classname>"/>
-    </event>
-    <event type="pre-insert">
-        <listener class="<classname>org.hibernate.cfg.beanvalidation.BeanValidationEventListener</classname>"/>
-    </event>
-    <event type="pre-delete">
-        <listener class="<classname>org.hibernate.cfg.beanvalidation.BeanValidationEventListener</classname>"/>
-    </event>
 </hibernate-configuration></programlisting>
       </example>
     </section>
 
     <section>
-      <title>JPA </title>
+      <title>JPA</title>
 
       <para>If you are using JPA 2 and Hibernate Validator is in the classpath
       the JPA2 specification requires that Bean Validation gets enabled. The
@@ -144,7 +154,7 @@
       <filename>persistence.xml</filename> also defines a node validation-mode
       while can be set to <constant>AUTO</constant>,
       <constant>CALLBACK</constant>, <constant>NONE</constant>. The default is
-      <constant>AUTO</constant>. </para>
+      <constant>AUTO</constant>.</para>
 
       <para>In a JPA 1 you will have to create and register Hibernate
       Validator yourself. In case you are using Hibernate EntityManager you
@@ -161,7 +171,7 @@
     <para>When working with JSF2 or <productname>JBoss Seam</productname> and
     Hibernate Validator (Bean Validation) is present in the runtime
     environment validation is triggered for every field in the application.
-    <xref linkend="example-jsf" /> shows an example of the f:validateBean tag
+    <xref linkend="example-jsf2" /> shows an example of the f:validateBean tag
     in a JSF page. For more information refer to the Seam documentation or the
     JSF 2 specification.</para>
 
diff --git a/hibernate-validator/src/main/docbook/en-US/modules/introduction.xml b/hibernate-validator/src/main/docbook/en-US/modules/introduction.xml
deleted file mode 100644
index 65698d6..0000000
--- a/hibernate-validator/src/main/docbook/en-US/modules/introduction.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- $Id: introduction.xml 17620 2009-10-04 19:19:28Z hardy.ferentschik $ -->
-<!--
-  ~ Hibernate, Relational Persistence for Idiomatic Java
-  ~
-  ~ Copyright (c) 2009, Red Hat, Inc. and/or its affiliates  or third-party contributors as
-  ~ indicated by the @author tags or express copyright attribution
-  ~ statements applied by the authors.  All third-party contributions are
-  ~ distributed under license by Red Hat, Inc.
-  ~
-  ~ This copyrighted material is made available to anyone wishing to use, modify,
-  ~ copy, or redistribute it subject to the terms and conditions of the GNU
-  ~ Lesser General Public License, as published by the Free Software Foundation.
-  ~
-  ~ This program is distributed in the hope that it will be useful,
-  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-  ~ for more details.
-  ~
-  ~ You should have received a copy of the GNU Lesser General Public License
-  ~ along with this distribution; if not, write to:
-  ~ Free Software Foundation, Inc.
-  ~ 51 Franklin Street, Fifth Floor
-  ~ Boston, MA  02110-1301  USA
-  -->
-
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
-
-<chapter id="validator-introduction">
-	<title>Introduction</title>
-
-	<section id="validator-introduction-whatisit" revision="1">
-	    <title>What is it about?</title>
-
-	    <para></para>
-	</section>
-
-	<section id="validator-introduction-installation" revision="1">
-	    <title>Installation</title>
-
-	    <para>
-
-			<section revision="1">
-				<title>Prerequisites</title>
-
-				<para></para>
-			</section>
-			<section revision="1">
-				<title>Running Bean Validation RI with downloaded JARs</title>
- 
-				<para></para>
-			</section>
-			<section revision="1">
-				<title>Running Bean Validation RI using Maven</title>
-
-				<para></para>
-			</section>
-			<section revision="1">
-				<title>Building Bean Validation RI from the sources</title>
-
-				<para></para>
-			</section>
-		</para>
-	</section>
-
-</chapter>
diff --git a/hibernate-validator/src/main/docbook/en-US/modules/preface.xml b/hibernate-validator/src/main/docbook/en-US/modules/preface.xml
index 046db31..f3ddaec 100644
--- a/hibernate-validator/src/main/docbook/en-US/modules/preface.xml
+++ b/hibernate-validator/src/main/docbook/en-US/modules/preface.xml
@@ -1,31 +1,27 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- $Id: bootstrapping.xml 17523 2009-09-16 15:51:58Z hardy.ferentschik $ -->
+<!-- $Id: preface.xml 19520 2010-05-15 12:27:18Z gunnar.morling $ -->
 <!--
-  ~ Hibernate, Relational Persistence for Idiomatic Java
-  ~
-  ~ Copyright (c) 2009, Red Hat, Inc. and/or its affiliates  or third-party contributors as
-  ~ indicated by the @author tags or express copyright attribution
-  ~ statements applied by the authors.  All third-party contributions are
-  ~ distributed under license by Red Hat, Inc.
-  ~
-  ~ This copyrighted material is made available to anyone wishing to use, modify,
-  ~ copy, or redistribute it subject to the terms and conditions of the GNU
-  ~ Lesser General Public License, as published by the Free Software Foundation.
-  ~
-  ~ This program is distributed in the hope that it will be useful,
-  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-  ~ for more details.
-  ~
-  ~ You should have received a copy of the GNU Lesser General Public License
-  ~ along with this distribution; if not, write to:
-  ~ Free Software Foundation, Inc.
-  ~ 51 Franklin Street, Fifth Floor
-  ~ Boston, MA  02110-1301  USA
-  -->
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
-"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
-  <preface id="preface" revision="2">
+	~ 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.
+-->
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "../hv.ent">
+%BOOK_ENTITIES;
+]>
+  <preface id="preface">
     <title>Preface</title>
 
     <para>Validating data is a common task that occurs throughout any
diff --git a/hibernate-validator/src/main/docbook/en-US/modules/programmaticapi.xml b/hibernate-validator/src/main/docbook/en-US/modules/programmaticapi.xml
new file mode 100644
index 0000000..62fc3c9
--- /dev/null
+++ b/hibernate-validator/src/main/docbook/en-US/modules/programmaticapi.xml
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- $Id: programmaticapi.xml 19639 2010-06-01 11:52:20Z hardy.ferentschik $ -->
+<!--
+	~ 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.
+-->
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "../hv.ent">
+%BOOK_ENTITIES;
+]>
+<chapter id="programmaticapi">
+  <title>Programmatic constraint definition</title>
+
+  <note>
+    <para>Use of the features described in the following sections is not
+    portable between Bean Validation providers/implementations.</para>
+  </note>
+
+  <para>Hibernate Validator allows to configure constraints not only via
+  annotations and xml, but also via a programmatic API. This API can be used
+  exclusively or in combination with annotations and xml. If used in
+  combination programmatic constraints are additive to otherwise configured
+  constraints.</para>
+
+  <para>The programmatic API is centered around the
+  <classname>ConstraintMapping</classname> class which can be found together
+  with its supporting classes in the
+  <package>org.hibernate.validator.cfg</package> package.
+  <classname>ConstraintMapping</classname> is the entry point to a fluent API
+  allowing the definition of constraints. <xref lang=""
+  linkend="example-constraint-mapping" /> shows how the API can be
+  used.</para>
+
+  <para><example id="example-constraint-mapping">
+      <title>Programmatic constraint definition</title>
+
+      <programlisting>ConstraintMapping mapping = new ConstraintMapping();
+mapping.type( Car.class )
+    .property( "manufacturer", FIELD )
+        .constraint( NotNullDef.class )
+    .property( "licensePlate", FIELD )
+        .constraint( NotNullDef.class )
+        .constraint( SizeDef.class )
+            .min( 2 )
+            .max( 14 )
+    .property( "seatCount", FIELD )
+        .constraint( MinDef.class )
+            .value ( 2 )
+.type( RentalCar.class )
+    .property( "rentalStation", METHOD)
+        .constraint( NotNullDef.class );      </programlisting>
+    </example></para>
+
+  <para>As you can see you can configure constraints on multiple classes and
+  properties using method chaining. The constraint definition classes
+  <classname>NotNullDef</classname>, <classname>SizeDef</classname> and
+  <classname>MinDef</classname> are helper classes which allow to configure
+  constraint parameters in a type-safe fashion. Definition classes exists for
+  all built-in constraints in the
+  <classname>org.hibernate.validator.cfg.defs</classname> package. For a
+  custom constraint you can either create your own definition class extending
+  <classname>ConstraintDef</classname> or you can use
+  <classname>GenericConstraintDef</classname> as seen in <xref
+  linkend="example-generic-constraint-mapping" />.</para>
+
+  <para><example id="example-generic-constraint-mapping">
+      <title>Programmatic constraint definition using
+      <classname>GenericConstraintDef</classname></title>
+
+      <programlisting>ConstraintMapping mapping = new ConstraintMapping();
+mapping.type( Car.class )
+    .property( "licensePlate", FIELD )
+        .constraint( GenericConstraintDef.class )
+            .constraintType( CheckCase.class )
+            .param( "value", CaseMode.UPPER );   </programlisting>
+    </example></para>
+
+  <para>Last but not least, you can also define cascading constraints as well
+  as the default group sequence of an entity.</para>
+
+  <para><example>
+      <title>Cascading constraints and group redefinition</title>
+
+      <programlisting>ConstraintMapping mapping = new ConstraintMapping();
+mapping.type( Car.class )
+    .valid( "driver", FIELD )
+.type( RentalCar.class)
+    .defaultGroupSequence( RentalCar.class, CarChecks.class ); </programlisting>
+    </example></para>
+
+  <para>Once you have your <classname>ConstraintMapping</classname> you will
+  have to pass it to the configuration. Since the programmatic configuration
+  is not part of the official Bean Validation specification you will have to
+  get hold of the Hibernate Validator specific configuration instance. See
+  <xref linkend="example-hibernate-specific-config" />.</para>
+
+  <para><example id="example-hibernate-specific-config">
+      <title>Creating a Hibernate Validator specific configuration</title>
+
+      <programlisting>ConstraintMapping mapping = new ConstraintMapping();
+// configure mapping instance
+
+HibernateValidatorConfiguration config = Validation.byProvider( HibernateValidator.class ).configure();
+config.addMapping( mapping );
+ValidatorFactory factory = config.buildValidatorFactory();
+Validator validator = factory.getValidator();</programlisting>
+    </example></para>
+</chapter>
diff --git a/hibernate-validator/src/main/docbook/en-US/modules/usingvalidator.xml b/hibernate-validator/src/main/docbook/en-US/modules/usingvalidator.xml
index 0234f9f..57239e3 100644
--- a/hibernate-validator/src/main/docbook/en-US/modules/usingvalidator.xml
+++ b/hibernate-validator/src/main/docbook/en-US/modules/usingvalidator.xml
@@ -1,30 +1,26 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- $Id: usingvalidator.xml 17842 2009-10-26 16:45:45Z hardy.ferentschik $ -->
+<!-- $Id: usingvalidator.xml 19778 2010-06-21 13:50:17Z hardy.ferentschik $ -->
 <!--
-  ~ Hibernate, Relational Persistence for Idiomatic Java
-  ~
-  ~ Copyright (c) 2009, Red Hat, Inc. and/or its affiliates  or third-party contributors as
-  ~ indicated by the @author tags or express copyright attribution
-  ~ statements applied by the authors.  All third-party contributions are
-  ~ distributed under license by Red Hat, Inc.
-  ~
-  ~ This copyrighted material is made available to anyone wishing to use, modify,
-  ~ copy, or redistribute it subject to the terms and conditions of the GNU
-  ~ Lesser General Public License, as published by the Free Software Foundation.
-  ~
-  ~ This program is distributed in the hope that it will be useful,
-  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-  ~ for more details.
-  ~
-  ~ You should have received a copy of the GNU Lesser General Public License
-  ~ along with this distribution; if not, write to:
-  ~ Free Software Foundation, Inc.
-  ~ 51 Franklin Street, Fifth Floor
-  ~ Boston, MA  02110-1301  USA
-  -->
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
-"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+	~ 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.
+-->
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "../hv.ent">
+%BOOK_ENTITIES;
+]>
 <chapter id="validator-usingvalidator">
   <title>Validation step by step</title>
 
@@ -34,7 +30,7 @@
   and which additional constraints are only provided by Hibernate Validator.
   Let's start with how to add constraints to an entity.</para>
 
-  <section id="validator-usingvalidator-annotate" revision="1">
+  <section id="validator-usingvalidator-annotate">
     <title>Defining constraints</title>
 
     <para>Constraints in Bean Validation are expressed via Java annotations.
@@ -62,16 +58,16 @@
       <example id="example-field-level">
         <title>Field level constraint</title>
 
-        <programlisting>package com.mycompany;
+        <programlisting language="JAVA" role="JAVA">package com.mycompany;
 
 import javax.validation.constraints.NotNull;
 
 public class Car {
 
-    <emphasis role="bold">@NotNull</emphasis>
+    @NotNull
     private String manufacturer;
 
-    <emphasis role="bold">@AssertTrue</emphasis>
+    @AssertTrue
     private boolean isRegistered;
 
     public Car(String manufacturer, boolean isRegistered) {
@@ -83,8 +79,9 @@ public class Car {
       </example>
 
       <para>When using field level constraints field access strategy is used
-      to access the value to be validated. This means the instance variable
-      directly independed of the access type.</para>
+      to access the value to be validated. This means the bean validation
+      provider directly accesses the instance variable and does not invoke the
+      property accessor method also if such a method exists.</para>
 
       <note>
         <para>The access type (private, protected or public) does not
@@ -112,7 +109,7 @@ public class Car {
       <example id="example-property-level">
         <title>Property level constraint</title>
 
-        <programlisting>package com.mycompany;
+        <programlisting language="JAVA" role="JAVA">package com.mycompany;
 
 import javax.validation.constraints.AssertTrue;
 import javax.validation.constraints.NotNull;
@@ -129,7 +126,7 @@ public class Car {
         this.isRegistered = isRegistered;
     }
 
-    <emphasis role="bold">@NotNull</emphasis>
+    @NotNull
     public String getManufacturer() {
         return manufacturer;
     }
@@ -138,7 +135,7 @@ public class Car {
         this.manufacturer = manufacturer;
     }
 
-    <emphasis role="bold">@AssertTrue</emphasis>
+    @AssertTrue
     public boolean isRegistered() {
         return isRegistered;
     }
@@ -181,16 +178,16 @@ public class Car {
       know that <classname>PassengerCount</classname> will ensure that there
       cannot be more passengers in a car than there are seats.</para>
 
-      <para><example id="example-class-level">
-          <title>Class level constraint</title>
+      <example id="example-class-level">
+        <title>Class level constraint</title>
 
-          <programlisting language="Java">package com.mycompany;
+        <programlisting language="JAVA" role="JAVA">package com.mycompany;
 
 import javax.validation.constraints.Min;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 
-<emphasis role="bold">@PassengerCount</emphasis>
+ at PassengerCount
 public class Car {
 
     @NotNull
@@ -213,7 +210,7 @@ public class Car {
 
     //getters and setters ...
 }</programlisting>
-        </example></para>
+      </example>
     </section>
 
     <section>
@@ -228,7 +225,7 @@ public class Car {
       <example>
         <title>Constraint inheritance using RentalCar</title>
 
-        <programlisting>package com.mycompany;
+        <programlisting language="JAVA" role="JAVA">package com.mycompany;
 
 import javax.validation.constraints.NotNull;
 
@@ -241,7 +238,7 @@ public class RentalCar extends Car {
         this.rentalStation = rentalStation;
     }
     
-    <emphasis role="bold">@NotNull</emphasis>
+    @NotNull
     public String getRentalStation() {
         return rentalStation;
     }
@@ -252,8 +249,7 @@ public class RentalCar extends Car {
 }</programlisting>
       </example>
 
-      <para>Our well-known class <classname>Car</classname> from <xref
-      linkend="Car-example" /> is now extended by
+      <para>Our well-known class <classname>Car</classname> is now extended by
       <classname>RentalCar</classname> with the additional property
       <property>rentalStation</property>. If an instance of
       <classname>RentalCar</classname> is validated, not only the
@@ -286,13 +282,13 @@ public class RentalCar extends Car {
       <example>
         <title>Class Person</title>
 
-        <programlisting>package com.mycompany;
+        <programlisting language="JAVA" role="JAVA">package com.mycompany;
 
 import javax.validation.constraints.NotNull;
 
 public class Person {
 
-    <emphasis role="bold">@NotNull</emphasis>
+    @NotNull
     private String name;
     
     public Person(String name) {
@@ -313,15 +309,15 @@ public class Person {
       <example id="example-car-with-driver">
         <title>Adding a driver to the car</title>
 
-        <programlisting>package com.mycompany;
+        <programlisting language="JAVA" role="JAVA">package com.mycompany;
 
 import javax.validation.Valid;
 import javax.validation.constraints.NotNull;
 
 public class Car {
 
-    <emphasis role="bold">@NotNull</emphasis>
-    <emphasis role="bold">@Valid</emphasis>
+    @NotNull
+    @Valid
     private Person driver;
     
     public Car(Person driver) {
@@ -341,11 +337,11 @@ public class Car {
       <code>null</code>.</para>
 
       <para>Object graph validation also works for collection-typed fields.
-      That means any attributes that are</para>
+      That means any attributes that</para>
 
       <itemizedlist>
         <listitem>
-          <para>arrays</para>
+          <para>are arrays</para>
         </listitem>
 
         <listitem>
@@ -366,7 +362,7 @@ public class Car {
       <example>
         <title>Car with a list of passengers</title>
 
-        <programlisting>package com.mycompany;
+        <programlisting language="JAVA" role="JAVA">package com.mycompany;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -377,8 +373,8 @@ import javax.validation.constraints.NotNull;
 public class Car {
 
     @NotNull
-    <emphasis role="bold">@Valid
-    private List<Person> passengers = new ArrayList<Person>();</emphasis>
+    @Valid
+    private List<Person> passengers = new ArrayList<Person>();
 
     public Car(List<Person> passengers) {
         this.passengers = passengers;
@@ -398,7 +394,7 @@ public class Car {
     </section>
   </section>
 
-  <section id="validator-usingvalidator-validate" revision="1">
+  <section id="validator-usingvalidator-validate">
     <title>Validating constraints</title>
 
     <para>The <classname>Validator</classname> interface is the main entry
@@ -416,12 +412,16 @@ public class Car {
       <classname>ValidatorFactory</classname>. The easiest way is to use the
       static
       <methodname>Validation.buildDefaultValidatorFactory()</methodname>
-      method:<example>
-          <title>Validation.buildDefaultValidatorFactory()</title>
+      method:</para>
+
+      <example>
+        <title>Validation.buildDefaultValidatorFactory()</title>
 
-          <programlisting>ValidatorFactory factory = <emphasis role="bold">Validation.buildDefaultValidatorFactory()</emphasis>;
+        <programlisting language="JAVA" role="JAVA">ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
 Validator validator = factory.getValidator();</programlisting>
-        </example>For other ways of obtaining a Validator instance see <xref
+      </example>
+
+      <para>For other ways of obtaining a Validator instance see <xref
       linkend="validator-bootstrapping" />. For now we just want to see how we
       can use the <classname>Validator</classname> instance to validate entity
       instances.</para>
@@ -443,9 +443,10 @@ Validator validator = factory.getValidator();</programlisting>
       <para>All the validation methods have a var-args parameter which can be
       used to specify, which validation groups shall be considered when
       performing the validation. If the parameter is not specified the default
-      validation group (<classname>javax.validation.Default</classname>) will
-      be used. We will go into more detail on the topic of validation groups
-      in <xref linkend="validator-usingvalidator-validationgroups" /></para>
+      validation group
+      (<classname>javax.validation.groups.Default</classname>) will be used.
+      We will go into more detail on the topic of validation groups in <xref
+      linkend="validator-usingvalidator-validationgroups" /></para>
 
       <section>
         <title><methodname>validate</methodname></title>
@@ -458,13 +459,12 @@ Validator validator = factory.getValidator();</programlisting>
           <title>Usage of
           <methodname>Validator.validate()</methodname></title>
 
-          <programlisting>ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
+          <programlisting language="JAVA" role="JAVA">ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
 Validator validator = factory.getValidator();
 
 Car car = new Car(null);
 
-Set<ConstraintViolation<Car>> constraintViolations = <emphasis
-              role="bold">validator.validate(car)</emphasis>;
+Set<ConstraintViolation<Car>> constraintViolations = validator.validate(car);
 
 assertEquals(1, constraintViolations.size());
 assertEquals("may not be null", constraintViolations.iterator().next().getMessage());</programlisting>
@@ -482,12 +482,11 @@ assertEquals("may not be null", constraintViolations.iterator().next().getMessag
           <title>Usage of
           <methodname>Validator.validateProperty()</methodname></title>
 
-          <programlisting>Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
+          <programlisting language="JAVA" role="JAVA">Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
 
 Car car = new Car(null);
 
-Set<ConstraintViolation<Car>> constraintViolations = <emphasis
-              role="bold">validator.validateProperty(car, "manufacturer")</emphasis>;
+Set<ConstraintViolation<Car>> constraintViolations = validator.validateProperty(car, "manufacturer");
 
 assertEquals(1, constraintViolations.size());
 assertEquals("may not be null", constraintViolations.iterator().next().getMessage());</programlisting>
@@ -509,10 +508,9 @@ assertEquals("may not be null", constraintViolations.iterator().next().getMessag
           <title>Usage of
           <methodname>Validator.validateValue()</methodname></title>
 
-          <programlisting>Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
+          <programlisting language="JAVA" role="JAVA">Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
 
-Set<ConstraintViolation<Car>> constraintViolations = <emphasis
-              role="bold">validator.validateValue(Car.class, "manufacturer", null)</emphasis>;
+Set<ConstraintViolation<Car>> constraintViolations = validator.validateValue(Car.class, "manufacturer", null);
 
 assertEquals(1, constraintViolations.size());
 assertEquals("may not be null", constraintViolations.iterator().next().getMessage());</programlisting>
@@ -547,7 +545,7 @@ assertEquals("may not be null", constraintViolations.iterator().next().getMessag
 
               <entry>Usage</entry>
 
-              <entry>Example (refering to <xref
+              <entry>Example (referring to <xref
               linkend="example-validator-validate" />)</entry>
             </row>
           </thead>
@@ -673,7 +671,7 @@ assertEquals("may not be null", constraintViolations.iterator().next().getMessag
     </section>
   </section>
 
-  <section id="validator-usingvalidator-validationgroups" revision="1">
+  <section id="validator-usingvalidator-validationgroups">
     <title>Validating groups</title>
 
     <para>Groups allow you to restrict the set of constraints applied during
@@ -688,20 +686,20 @@ assertEquals("may not be null", constraintViolations.iterator().next().getMessag
     linkend="example-person" />) which has a <classname>@NotNull
     </classname>constraint on <property>name</property>. Since no group is
     specified for this annotation its default group is
-    <classname>javax.validation.Default</classname>.</para>
+    <classname>javax.validation.groups.Default</classname>.</para>
 
     <note>
       <para>When more than one group is requested, the order in which the
       groups are evaluated is not deterministic. If no group is specified the
-      default group <classname>javax.validation.Default</classname> is
+      default group <classname>javax.validation.groups.Default</classname> is
       assumed.</para>
     </note>
 
-    <para><example id="example-person">
-        <title>Person</title>
+    <example id="example-person">
+      <title>Person</title>
 
-        <programlisting>public class Person {
-    <emphasis role="bold">@NotNull</emphasis>
+      <programlisting language="JAVA" role="JAVA">public class Person {
+    @NotNull
     private String name;
 
     public Person(String name) {
@@ -709,7 +707,9 @@ assertEquals("may not be null", constraintViolations.iterator().next().getMessag
     }
     // getters and setters ...
 }</programlisting>
-      </example>Next we have the class <classname>Driver</classname> (<xref
+    </example>
+
+    <para>Next we have the class <classname>Driver</classname> (<xref
     linkend="example-driver" />) extending <classname>Person</classname>. Here
     we are adding the properties <property>age</property> and
     <property>hasDrivingLicense</property>. In order to drive you must be at
@@ -720,18 +720,22 @@ assertEquals("may not be null", constraintViolations.iterator().next().getMessag
     <classname>DriverChecks</classname> is just a simple tagging interface.
     Using interfaces makes the usage of groups type safe and allows for easy
     refactoring. It also means that groups can inherit from each other via
-    class inheritance.<note>
-        <para>The Bean Validation specification does not enforce that groups
-        have to be interfaces. Non interface classes could be used as well,
-        but we recommend to stick to interfaces.</para>
-      </note><example id="example-driver">
-        <title>Driver</title>
-
-        <programlisting>public class Driver extends Person {
-    <emphasis role="bold">@Min(value = 18, message = "You have to be 18 to drive a car", groups = DriverChecks.class)</emphasis>
+    class inheritance.</para>
+
+    <note>
+      <para>The Bean Validation specification does not enforce that groups
+      have to be interfaces. Non interface classes could be used as well, but
+      we recommend to stick to interfaces.</para>
+    </note>
+
+    <example id="example-driver">
+      <title>Driver</title>
+
+      <programlisting language="JAVA" role="JAVA">public class Driver extends Person {
+    @Min(value = 18, message = "You have to be 18 to drive a car", groups = DriverChecks.class)
     public int age;
 
-    <emphasis role="bold">@AssertTrue(message = "You first have to pass the driving test", groups = DriverChecks.class)</emphasis>
+    @AssertTrue(message = "You first have to pass the driving test", groups = DriverChecks.class)
     public boolean hasDrivingLicense;
 
     public Driver(String name) {
@@ -750,22 +754,27 @@ assertEquals("may not be null", constraintViolations.iterator().next().getMessag
         this.age = age;
     }
 }</programlisting>
-      </example><example id="example-group-interfaces">
-        <title>Group interfaces</title>
+    </example>
+
+    <example id="example-group-interfaces">
+      <title>Group interfaces</title>
 
-        <programlisting>public interface DriverChecks {
+      <programlisting language="JAVA" role="JAVA">public interface DriverChecks {
 }
 
 public interface CarChecks {
 }</programlisting>
-      </example>Last but not least we add the property
+    </example>
+
+    <para>Last but not least we add the property
     <property>passedVehicleInspection</property> to the
     <classname>Car</classname> class (<xref linkend="example-car" />)
-    indicating whether a car passed the road worthy tests.<example
-        id="example-car">
-        <title>Car</title>
+    indicating whether a car passed the road worthy tests.</para>
 
-        <programlisting>public class Car {
+    <example id="example-car">
+      <title>Car</title>
+
+      <programlisting language="JAVA" role="JAVA">public class Car {
     @NotNull
     private String manufacturer;
 
@@ -776,7 +785,7 @@ public interface CarChecks {
     @Min(2)
     private int seatCount;
 
-    <emphasis role="bold">@AssertTrue(message = "The car has to pass the vehicle inspection first", groups = CarChecks.class)</emphasis>
+    @AssertTrue(message = "The car has to pass the vehicle inspection first", groups = CarChecks.class)
     private boolean passedVehicleInspection;
 
     @Valid
@@ -788,7 +797,9 @@ public interface CarChecks {
         this.seatCount = seatCount;
     }
 }</programlisting>
-      </example>Overall three different groups are used in our example.
+    </example>
+
+    <para>Overall three different groups are used in our example.
     <property>Person.name</property>, <property>Car.manufacturer</property>,
     <property>Car.licensePlate</property> and
     <property>Car.seatCount</property> all belong to the
@@ -799,10 +810,12 @@ public interface CarChecks {
     <classname>CarChecks</classname>. <xref linkend="example-drive-away" />
     shows how passing different group combinations to the
     <methodname>Validator.validate</methodname> method result in different
-    validation results.<example id="example-drive-away">
-        <title>Drive away</title>
+    validation results.</para>
 
-        <programlisting>public class GroupTest {
+    <example id="example-drive-away">
+      <title>Drive away</title>
+
+      <programlisting language="JAVA" role="JAVA">public class GroupTest {
 
     private static Validator validator;
 
@@ -844,26 +857,25 @@ public interface CarChecks {
         assertEquals( 0, validator.validate( car, Default.class, CarChecks.class, DriverChecks.class ).size() );
     }
 }</programlisting>
-      </example>First we create a car and validate it using no explicit group.
-    There are no validation errors, even though the property
+    </example>
+
+    <para>First we create a car and validate it using no explicit group. There
+    are no validation errors, even though the property
     <property>passedVehicleInspection</property> is per default
     <constant>false</constant>. However, the constraint defined on this
-    property does not belong to the default group.</para>
-
-    <para>Next we just validate the <classname>CarChecks</classname> group
-    which will fail until we make sure that the car passes the vehicle
-    inspection.</para>
-
-    <para>When we then add a driver to the car and validate against
-    <classname>DriverChecks</classname> we get again a constraint violation
-    due to the fact that the driver has not yet passed the driving test. Only
-    after setting <property>passedDrivingTest</property> to true the
-    validation against <classname>DriverChecks</classname> will pass.</para>
+    property does not belong to the default group. Next we just validate the
+    <classname>CarChecks</classname> group which will fail until we make sure
+    that the car passes the vehicle inspection. When we then add a driver to
+    the car and validate against <classname>DriverChecks</classname> we get
+    again a constraint violation due to the fact that the driver has not yet
+    passed the driving test. Only after setting
+    <property>passedDrivingTest</property> to true the validation against
+    <classname>DriverChecks</classname> will pass.</para>
 
     <para>Last but not least, we show that all constraints are passing by
     validating against all defined groups.</para>
 
-    <section revision="1">
+    <section>
       <title>Group sequences</title>
 
       <para>By default, constraints are evaluated in no particular order and
@@ -880,17 +892,17 @@ public interface CarChecks {
 
       <note>
         <para>If at least one constraints fails in a sequenced group none of
-        the constraints of the follwoing groups in the sequence get
+        the constraints of the following groups in the sequence get
         validated.</para>
       </note>
 
-      <para><example>
-          <title>Interface with @GroupSequence</title>
+      <example>
+        <title>Interface with @GroupSequence</title>
 
-          <programlisting><emphasis role="bold">@GroupSequence({Default.class, CarChecks.class, DriverChecks.class})</emphasis>
+        <programlisting language="JAVA" role="JAVA">@GroupSequence({Default.class, CarChecks.class, DriverChecks.class})
 public interface OrderedChecks {
 }</programlisting>
-        </example></para>
+      </example>
 
       <para><warning>
           <para>Groups defining a sequence and groups composing a sequence
@@ -904,7 +916,7 @@ public interface OrderedChecks {
       <example id="example-group-sequence">
         <title>Usage of a group sequence</title>
 
-        <programlisting>@Test
+        <programlisting language="JAVA" role="JAVA">@Test
 public void testOrderedChecks() {
     Car car = new Car( "Morris", "DD-AB-123", 2 );
     car.setPassedVehicleInspection( true );
@@ -936,7 +948,7 @@ public void testOrderedChecks() {
       <example id="example-rental-car">
         <title>RentalCar</title>
 
-        <programlisting>@GroupSequence({ RentalCar.class, CarChecks.class })
+        <programlisting language="JAVA" role="JAVA">@GroupSequence({ RentalCar.class, CarChecks.class })
 public class RentalCar extends Car {
     public RentalCar(String manufacturer, String licencePlate, int seatCount) {
         super( manufacturer, licencePlate, seatCount );
@@ -947,7 +959,7 @@ public class RentalCar extends Car {
       <example id="example-testOrderedChecksWithRedefinedDefault">
         <title>testOrderedChecksWithRedefinedDefault</title>
 
-        <programlisting>@Test
+        <programlisting language="JAVA" role="JAVA">@Test
 public void testOrderedChecksWithRedefinedDefault() {
     RentalCar rentalCar = new RentalCar( "Morris", "DD-AB-123", 2 );
     rentalCar.setPassedVehicleInspection( true );
@@ -971,7 +983,7 @@ public void testOrderedChecksWithRedefinedDefault() {
     </section>
   </section>
 
-  <section id="validator-defineconstraints-builtin" revision="2">
+  <section id="validator-defineconstraints-builtin">
     <title>Built-in constraints</title>
 
     <para>Hibernate Validator implements all of the default constraints
@@ -1007,7 +1019,7 @@ public void testOrderedChecksWithRedefinedDefault() {
 
             <entry>field/property</entry>
 
-            <entry>check that the annotated element is
+            <entry>Check that the annotated element is
             <constant>false</constant>.</entry>
 
             <entry>none</entry>
@@ -1020,13 +1032,30 @@ public void testOrderedChecksWithRedefinedDefault() {
 
             <entry>field/property</entry>
 
-            <entry>check that the annotated element is
+            <entry>Check that the annotated element is
             <constant>true</constant>.</entry>
 
             <entry>none</entry>
           </row>
 
           <row>
+            <entry>@CreditCardNumber</entry>
+
+            <entry>no</entry>
+
+            <entry>field/property. The supported type is
+            <classname>String</classname>.</entry>
+
+            <entry>Check that the annotated string passes the Luhn checksum
+            test. Note, this validation aims to check for user mistake, not
+            credit card validity! See also <ulink
+            url="http://www.merriampark.com/anatomycc.htm">Anatomy of Credit
+            Card Numbers</ulink>.</entry>
+
+            <entry>none</entry>
+          </row>
+
+          <row>
             <entry>@DecimalMax</entry>
 
             <entry>yes</entry>
@@ -1123,7 +1152,7 @@ public void testOrderedChecksWithRedefinedDefault() {
             <parameter>min</parameter> and <parameter>max</parameter>
             included.</entry>
 
-            <entry>none</entry>
+            <entry>Column length will be set to max.</entry>
           </row>
 
           <row>
@@ -1156,7 +1185,7 @@ public void testOrderedChecksWithRedefinedDefault() {
             <classname>int</classname>, <classname>long</classname> and the
             respective wrappers of the primitive types.</entry>
 
-            <entry>Check whether the annotated value is higher than or equal
+            <entry>Checks whether the annotated value is higher than or equal
             to the specified minimum.</entry>
 
             <entry>Add a check constraint on the column.</entry>
@@ -1176,14 +1205,30 @@ public void testOrderedChecksWithRedefinedDefault() {
           </row>
 
           <row>
+            <entry>@NotBlank</entry>
+
+            <entry>no</entry>
+
+            <entry>field/property</entry>
+
+            <entry>Check that the annotated string is not null and the trimmed
+            length is greater than 0. The difference to @NotEmpty is that this
+            constraint can only be applied on strings and that trailing
+            whitespaces are ignored.</entry>
+
+            <entry>none</entry>
+          </row>
+
+          <row>
             <entry>@NotEmpty</entry>
 
             <entry>no</entry>
 
-            <entry>field/property. Needs to be a string.</entry>
+            <entry>field/property. Supported types are String, Collection, Map
+            and arrays.</entry>
 
-            <entry>Check if the string is not <constant>null</constant> nor
-            empty.</entry>
+            <entry>Check whether the annotated element is not
+            <constant>null</constant> nor empty.</entry>
 
             <entry>none</entry>
           </row>
@@ -1222,8 +1267,9 @@ public void testOrderedChecksWithRedefinedDefault() {
 
             <entry>field/property. Needs to be a string.</entry>
 
-            <entry>Check if the annotated string match the regular expression
-            <parameter>regex</parameter>.</entry>
+            <entry>Checks if the annotated string matches the regular
+            expression <parameter>regex</parameter> considering the given flag
+            <parameter>match</parameter>.</entry>
 
             <entry>none</entry>
           </row>
@@ -1263,14 +1309,55 @@ public void testOrderedChecksWithRedefinedDefault() {
           </row>
 
           <row>
+            <entry>@ScriptAssert(lang=, script=, alias=)</entry>
+
+            <entry>no</entry>
+
+            <entry>type</entry>
+
+            <entry>Checks whether the given script can successfully be
+            evaluated against the annotated element. In order to use this
+            constraint, an implementation of the Java Scripting API as defined
+            by JSR 223 ("Scripting for the Java<superscript>TM</superscript>
+            Platform") must part of the class path. This is automatically the
+            case when running on Java 6. For older Java versions, the JSR 223
+            RI can be added manually to the class path.The expressions to be
+            evaluated can be written in any scripting or expression language,
+            for which a JSR 223 compatible engine can be found in the class
+            path.</entry>
+
+            <entry>none</entry>
+          </row>
+
+          <row>
+            <entry>@URL(protocol=, host=, port=)</entry>
+
+            <entry>no</entry>
+
+            <entry>field/property. The supported type is
+            <classname>String</classname>.</entry>
+
+            <entry>Check if the annotated string is a valid URL. If any of
+            parameters <parameter>protocol</parameter>,
+            <parameter>host</parameter> or <parameter>port</parameter> is
+            specified the URL must match the specified values in the according
+            part.</entry>
+
+            <entry>none</entry>
+          </row>
+
+          <row>
             <entry>@Valid</entry>
 
             <entry>yes</entry>
 
-            <entry>field/property</entry>
+            <entry>field/property. Any non-primitive types are
+            supported.</entry>
 
-            <entry>Perform validation recursively on the associated
-            object.</entry>
+            <entry>Performs validation recursively on the associated object.
+            If the object is a collection or an array, the elements are
+            validated recursively. If the object is a map, the value elements
+            are validated recursively.</entry>
 
             <entry>none</entry>
           </row>
diff --git a/hibernate-validator/src/main/docbook/en-US/modules/xmlconfiguration.xml b/hibernate-validator/src/main/docbook/en-US/modules/xmlconfiguration.xml
index 36425dd..c504e3d 100644
--- a/hibernate-validator/src/main/docbook/en-US/modules/xmlconfiguration.xml
+++ b/hibernate-validator/src/main/docbook/en-US/modules/xmlconfiguration.xml
@@ -1,30 +1,26 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- $Id: xmlconfiguration.xml 17620 2009-10-04 19:19:28Z hardy.ferentschik $ -->
+<!-- $Id: xmlconfiguration.xml 19521 2010-05-15 12:33:09Z gunnar.morling $ -->
 <!--
-  ~ Hibernate, Relational Persistence for Idiomatic Java
-  ~
-  ~ Copyright (c) 2009, Red Hat, Inc. and/or its affiliates  or third-party contributors as
-  ~ indicated by the @author tags or express copyright attribution
-  ~ statements applied by the authors.  All third-party contributions are
-  ~ distributed under license by Red Hat, Inc.
-  ~
-  ~ This copyrighted material is made available to anyone wishing to use, modify,
-  ~ copy, or redistribute it subject to the terms and conditions of the GNU
-  ~ Lesser General Public License, as published by the Free Software Foundation.
-  ~
-  ~ This program is distributed in the hope that it will be useful,
-  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-  ~ for more details.
-  ~
-  ~ You should have received a copy of the GNU Lesser General Public License
-  ~ along with this distribution; if not, write to:
-  ~ Free Software Foundation, Inc.
-  ~ 51 Franklin Street, Fifth Floor
-  ~ Boston, MA  02110-1301  USA
-  -->
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
-"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+	~ 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.
+-->
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "../hv.ent">
+%BOOK_ENTITIES;
+]>
 <chapter id="validator-xmlconfiguration">
   <title>XML configuration</title>
 
@@ -59,7 +55,7 @@
     <example id="example-validation-xml">
       <title>validation.xml</title>
 
-      <programlisting><validation-config xmlns="http://jboss.org/xml/ns/javax/validation/configuration"
+      <programlisting role="XML" language="XML"><validation-config xmlns="http://jboss.org/xml/ns/javax/validation/configuration"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/configuration">
     <default-provider>org.hibernate.validator.HibernateValidator</default-provider>
@@ -90,7 +86,7 @@
     <classname>javax.validation.ConstraintValidatorFactory</classname>. The
     same configuration options are also available programmatically through the
     <classname>javax.validation.Configuration</classname>. In fact XML
-    configuration will be overriden by values explicitly specified via the
+    configuration will be overridden by values explicitly specified via the
     API. It is even possible to ignore the XML configuration completely via
     <methodname> Configuration.ignoreXmlConfiguration()</methodname>. See also
     <xref linkend="validator-bootstrapping" />.</para>
@@ -136,7 +132,7 @@
     <example id="example-constraints-car">
       <title>constraints-car.xml</title>
 
-      <programlisting><constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+      <programlisting role="XML" language="XML"><constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                      xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd"
                      xmlns="http://jboss.org/xml/ns/javax/validation/mapping">
     <default-package>org.hibernate.validator.quickstart</default-package>
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/HibernateValidator.java b/hibernate-validator/src/main/java/org/hibernate/validator/HibernateValidator.java
index 6f31d06..fa5717b 100755
--- a/hibernate-validator/src/main/java/org/hibernate/validator/HibernateValidator.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/HibernateValidator.java
@@ -1,4 +1,4 @@
-// $Id: HibernateValidator.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: HibernateValidator.java 19553 2010-05-19 15:47:21Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -28,7 +28,7 @@ import org.hibernate.validator.HibernateValidatorConfiguration;
 import org.hibernate.validator.engine.ValidatorFactoryImpl;
 
 /**
- * Default implementation of <code>ValidationProvider</code> within Hibernate validator.
+ * Default implementation of {@code ValidationProvider} within Hibernate Validator.
  *
  * @author Emmanuel Bernard
  * @author Hardy Ferentschik
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/HibernateValidatorConfiguration.java b/hibernate-validator/src/main/java/org/hibernate/validator/HibernateValidatorConfiguration.java
index 33ad501..afd7e4a 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/HibernateValidatorConfiguration.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/HibernateValidatorConfiguration.java
@@ -1,4 +1,4 @@
-// $Id: HibernateValidatorConfiguration.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: HibernateValidatorConfiguration.java 19639 2010-06-01 11:52:20Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -19,11 +19,59 @@ package org.hibernate.validator;
 
 import javax.validation.Configuration;
 
+import org.hibernate.validator.cfg.ConstraintMapping;
+import org.hibernate.validator.resourceloading.ResourceBundleLocator;
+
 /**
- * Uniquely identify Hibernate Validator in the Bean Validation bootstrap strategy
- * Also contains Hibernate Validator specific configurations
- * 
+ * Uniquely identifies Hibernate Validator in the Bean Validation bootstrap
+ * strategy. Also contains Hibernate Validator specific configurations.
+ *
  * @author Emmanuel Bernard
+ * @author Gunnar Morling
  */
 public interface HibernateValidatorConfiguration extends Configuration<HibernateValidatorConfiguration> {
+
+	/**
+	 * <p>
+	 * Returns the {@link ResourceBundleLocator} used by the
+	 * {@link Configuration#getDefaultMessageInterpolator() default message
+	 * interpolator} to load user-provided resource bundles. In conformance with
+	 * the specification this default locator retrieves the bundle
+	 * "ValidationMessages".
+	 * </p>
+	 * <p>
+	 * This locator can be used as delegate for custom locators when setting a
+	 * customized {@link org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator}:
+	 * </p>
+	 * <p/>
+	 * <pre>
+	 * {@code
+	 * 	HibernateValidatorConfiguration configure =
+	 *    Validation.byProvider(HibernateValidator.class).configure();
+	 * <p/>
+	 *  ResourceBundleLocator defaultResourceBundleLocator =
+	 *    configure.getDefaultResourceBundleLocator();
+	 *  ResourceBundleLocator myResourceBundleLocator =
+	 *    new MyResourceBundleLocator(defaultResourceBundleLocator);
+	 * <p/>
+	 *  configure.messageInterpolator(
+	 *    new ResourceBundleMessageInterpolator(myResourceBundleLocator));
+	 * }
+	 * </pre>
+	 *
+	 * @return The default {@link ResourceBundleLocator}. Never null.
+	 */
+	ResourceBundleLocator getDefaultResourceBundleLocator();
+
+	/**
+	 * Adds the specified {@link ConstraintMapping} instance to the configuration. Constraints configured in {@code mapping}
+	 * will be added to the constraints configured via annotations and/or xml.
+	 *
+	 * @param mapping {@code ConstraintMapping} instance containing programmatic configured constraints
+	 *
+	 * @return {@code this} following the chaining method pattern
+	 *
+	 * @throws IllegalArgumentException if {@code mapping} is {@code null}
+	 */
+	HibernateValidatorConfiguration addMapping(ConstraintMapping mapping);
 }
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/CascadeDef.java b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/CascadeDef.java
new file mode 100644
index 0000000..5eeafc6
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/CascadeDef.java
@@ -0,0 +1,78 @@
+// $Id: CascadeDef.java 19606 2010-05-25 18:21:27Z hardy.ferentschik $
+/*
+ * 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.cfg;
+
+import java.lang.annotation.ElementType;
+import javax.validation.ValidationException;
+
+import org.hibernate.validator.util.ReflectionHelper;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class CascadeDef {
+	private final Class<?> beanType;
+	private final ElementType elementType;
+	private final String property;
+
+	public CascadeDef(Class<?> beanType, String property, ElementType elementType) {
+		if ( beanType == null ) {
+			throw new ValidationException( "Null is not a valid bean type" );
+		}
+
+		if ( ElementType.FIELD.equals( elementType ) || ElementType.METHOD.equals( elementType ) ) {
+			if ( property == null || property.length() == 0 ) {
+				throw new ValidationException( "A valid property name has to be specified" );
+			}
+
+			if ( !ReflectionHelper.propertyExists( beanType, property, elementType ) ) {
+				throw new ValidationException(
+						"The class " + beanType + " does not have a property '"
+								+ property + "' with access " + elementType
+				);
+			}
+		}
+
+		this.beanType = beanType;
+		this.property = property;
+		this.elementType = elementType;
+	}
+
+	public ElementType getElementType() {
+		return elementType;
+	}
+
+	public Class<?> getBeanType() {
+		return beanType;
+	}
+
+	public String getProperty() {
+		return property;
+	}
+
+	@Override
+	public String toString() {
+		final StringBuilder sb = new StringBuilder();
+		sb.append( "CascadeDefinition" );
+		sb.append( "{beanType=" ).append( beanType );
+		sb.append( ", elementType=" ).append( elementType );
+		sb.append( ", property='" ).append( property ).append( '\'' );
+		sb.append( '}' );
+		return sb.toString();
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/ConstraintDef.java b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/ConstraintDef.java
new file mode 100644
index 0000000..e019818
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/ConstraintDef.java
@@ -0,0 +1,133 @@
+// $Id: ConstraintDef.java 19639 2010-06-01 11:52:20Z hardy.ferentschik $
+/*
+ * 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.cfg;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.ElementType;
+import java.lang.reflect.Constructor;
+import java.util.HashMap;
+import java.util.Map;
+import javax.validation.Payload;
+import javax.validation.ValidationException;
+
+import org.hibernate.validator.util.ReflectionHelper;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public abstract class ConstraintDef<A extends Annotation> {
+	protected Class<A> constraintType;
+	protected final Map<String, Object> parameters;
+	protected final Class<?> beanType;
+	protected final ElementType elementType;
+	protected final String property;
+	protected final ConstraintMapping mapping;
+
+	public ConstraintDef(Class<?> beanType, Class<A> constraintType, String property, ElementType elementType, ConstraintMapping mapping) {
+		this( beanType, constraintType, property, elementType, new HashMap<String, Object>(), mapping );
+	}
+
+	protected ConstraintDef(Class<?> beanType, Class<A> constraintType, String property, ElementType elementType, Map<String, Object> parameters, ConstraintMapping mapping) {
+		if ( beanType == null ) {
+			throw new ValidationException( "Null is not a valid bean type" );
+		}
+
+		if ( mapping == null ) {
+			throw new ValidationException( "ConstraintMapping cannot be null" );
+		}
+
+		if ( ElementType.FIELD.equals( elementType ) || ElementType.METHOD.equals( elementType ) ) {
+			if ( property == null || property.length() == 0 ) {
+				throw new ValidationException( "A property level constraint cannot have a null or empty property name" );
+			}
+
+			if ( !ReflectionHelper.propertyExists( beanType, property, elementType ) ) {
+				throw new ValidationException(
+						"The class " + beanType + " does not have a property '"
+								+ property + "' with access " + elementType
+				);
+			}
+		}
+
+		this.beanType = beanType;
+		this.constraintType = constraintType;
+		this.parameters = parameters;
+		this.property = property;
+		this.elementType = elementType;
+		this.mapping = mapping;
+	}
+
+	protected ConstraintDef addParameter(String key, Object value) {
+		parameters.put( key, value );
+		return this;
+	}
+
+	public ConstraintDef message(String message) {
+		addParameter( "message", message );
+		return this;
+	}
+
+	public ConstraintDef groups(Class<?>... groups) {
+		addParameter( "groups", groups );
+		return this;
+	}
+
+	public ConstraintDef payload(Class<? extends Payload>... payload) {
+		addParameter( "payload", payload );
+		return this;
+	}
+
+	public <A extends Annotation, T extends ConstraintDef<A>> T constraint(Class<T> definition) {
+		final Constructor<T> constructor = ReflectionHelper.getConstructor(
+				definition, Class.class, String.class, ElementType.class, ConstraintMapping.class
+		);
+
+		final T constraintDefinition = ReflectionHelper.newConstructorInstance(
+				constructor, beanType, property, elementType, mapping
+		);
+
+		mapping.addConstraintConfig( constraintDefinition );
+		return constraintDefinition;
+	}
+
+	public ConstraintsForType property(String property, ElementType type) {
+		return new ConstraintsForType( beanType, property, type, mapping );
+	}
+
+	public ConstraintsForType type(Class<?> type) {
+		return new ConstraintsForType( type, mapping );
+	}
+
+	public ConstraintsForType valid(String property, ElementType type) {
+		mapping.addCascadeConfig( new CascadeDef( beanType, property, type ) );
+		return new ConstraintsForType( beanType, mapping );
+	}
+
+	@Override
+	public String toString() {
+		final StringBuilder sb = new StringBuilder();
+		sb.append( this.getClass().getName() );
+		sb.append( "{beanType=" ).append( beanType );
+		sb.append( ", constraintType=" ).append( constraintType );
+		sb.append( ", parameters=" ).append( parameters );
+		sb.append( ", elementType=" ).append( elementType );
+		sb.append( ", property='" ).append( property ).append( '\'' );
+		sb.append( '}' );
+		return sb.toString();
+	}
+}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/ConstraintDefWrapper.java b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/ConstraintDefWrapper.java
new file mode 100644
index 0000000..98940b3
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/ConstraintDefWrapper.java
@@ -0,0 +1,52 @@
+// $Id: ConstraintDefWrapper.java 19635 2010-05-31 14:03:26Z hardy.ferentschik $
+/*
+ * 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.cfg;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.ElementType;
+import java.util.Map;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class ConstraintDefWrapper<A extends Annotation> extends ConstraintDef<A> {
+
+	public ConstraintDefWrapper(Class<?> beanType, Class<A> constraintType, String property, ElementType elementType, Map<String, Object> parameters, ConstraintMapping mapping) {
+		super( beanType, constraintType, property, elementType, parameters, mapping );
+	}
+
+	public Class<A> getConstraintType() {
+		return constraintType;
+	}
+
+	public Map<String, Object> getParameters() {
+		return this.parameters;
+	}
+
+	public ElementType getElementType() {
+		return elementType;
+	}
+
+	public Class<?> getBeanType() {
+		return beanType;
+	}
+
+	public String getProperty() {
+		return property;
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/ConstraintMapping.java b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/ConstraintMapping.java
new file mode 100644
index 0000000..c708b60
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/ConstraintMapping.java
@@ -0,0 +1,143 @@
+// $Id: ConstraintMapping.java 19635 2010-05-31 14:03:26Z hardy.ferentschik $
+/*
+ * 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.cfg;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Top level class for constraints configured via the programmatic API.
+ *
+ * @author Hardy Ferentschik
+ */
+public class ConstraintMapping {
+	private final Map<Class<?>, List<ConstraintDef<?>>> constraintConfig;
+	private final Map<Class<?>, List<CascadeDef>> cascadeConfig;
+	private final Set<Class<?>> configuredClasses;
+	private final Map<Class<?>, List<Class<?>>> defaultGroupSequences;
+
+	public ConstraintMapping() {
+		this.constraintConfig = new HashMap<Class<?>, List<ConstraintDef<?>>>();
+		this.cascadeConfig = new HashMap<Class<?>, List<CascadeDef>>();
+		this.configuredClasses = new HashSet<Class<?>>();
+		this.defaultGroupSequences = new HashMap<Class<?>, List<Class<?>>>();
+	}
+
+	/**
+	 * Starts defining constraints on the specified bean class.
+	 *
+	 * @param beanClass The bean class on which to define constraints. All constraints defined after calling this method
+	 * are added to the bean of the type {@code beanClass} until the next call of {@code type}.
+	 *
+	 * @return Instance allowing for defining constraints on the specified class.
+	 */
+	public final ConstraintsForType type(Class<?> beanClass) {
+		return new ConstraintsForType( beanClass, this );
+	}
+
+	public final <A extends Annotation> Map<Class<?>, List<ConstraintDefWrapper<?>>> getConstraintConfig() {
+		Map<Class<?>, List<ConstraintDefWrapper<?>>> newDefinitions = new HashMap<Class<?>, List<ConstraintDefWrapper<?>>>();
+		for ( Map.Entry<Class<?>, List<ConstraintDef<?>>> entry : constraintConfig.entrySet() ) {
+
+			List<ConstraintDefWrapper<?>> newList = new ArrayList<ConstraintDefWrapper<?>>();
+			for ( ConstraintDef<?> definition : entry.getValue() ) {
+				Class<?> beanClass = definition.beanType;
+				@SuppressWarnings("unchecked")
+				ConstraintDefWrapper<A> defAccessor = new ConstraintDefWrapper<A>(
+						beanClass,
+						( Class<A> ) definition.constraintType,
+						definition.property,
+						definition.elementType,
+						definition.parameters,
+						this
+				);
+				newList.add( defAccessor );
+			}
+			newDefinitions.put( entry.getKey(), newList );
+		}
+		return newDefinitions;
+	}
+
+	public final Map<Class<?>, List<CascadeDef>> getCascadeConfig() {
+		return cascadeConfig;
+	}
+
+	public final Collection<Class<?>> getConfiguredClasses() {
+		return configuredClasses;
+	}
+
+	public final List<Class<?>> getDefaultSequence(Class<?> beanType) {
+		if ( defaultGroupSequences.containsKey( beanType ) ) {
+			return defaultGroupSequences.get( beanType );
+		}
+		else {
+			return Collections.emptyList();
+		}
+	}
+
+	@Override
+	public String toString() {
+		final StringBuilder sb = new StringBuilder();
+		sb.append( "ConstraintMapping" );
+		sb.append( "{cascadeConfig=" ).append( cascadeConfig );
+		sb.append( ", constraintConfig=" ).append( constraintConfig );
+		sb.append( ", configuredClasses=" ).append( configuredClasses );
+		sb.append( ", defaultGroupSequences=" ).append( defaultGroupSequences );
+		sb.append( '}' );
+		return sb.toString();
+	}
+
+	protected final void addCascadeConfig(CascadeDef cascade) {
+		Class<?> beanClass = cascade.getBeanType();
+		configuredClasses.add( beanClass );
+		if ( cascadeConfig.containsKey( beanClass ) ) {
+			cascadeConfig.get( beanClass ).add( cascade );
+		}
+		else {
+			List<CascadeDef> cascadeList = new ArrayList<CascadeDef>();
+			cascadeList.add( cascade );
+			cascadeConfig.put( beanClass, cascadeList );
+		}
+	}
+
+	protected final void addDefaultGroupSequence(Class<?> beanClass, List<Class<?>> defaultGroupSequence) {
+		defaultGroupSequences.put( beanClass, defaultGroupSequence );
+	}
+
+	protected final void addConstraintConfig(ConstraintDef<?> definition) {
+		Class<?> beanClass = definition.beanType;
+		configuredClasses.add( beanClass );
+		if ( constraintConfig.containsKey( beanClass ) ) {
+			constraintConfig.get( beanClass ).add( definition );
+		}
+		else {
+			List<ConstraintDef<?>> definitionList = new ArrayList<ConstraintDef<?>>();
+			definitionList.add( definition );
+			constraintConfig.put( beanClass, definitionList );
+		}
+	}
+}
+
+
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/ConstraintsForType.java b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/ConstraintsForType.java
new file mode 100644
index 0000000..104e150
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/ConstraintsForType.java
@@ -0,0 +1,114 @@
+// $Id: ConstraintsForType.java 19635 2010-05-31 14:03:26Z hardy.ferentschik $
+/*
+ * 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.cfg;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.ElementType;
+import java.lang.reflect.Constructor;
+import java.util.Arrays;
+
+import org.hibernate.validator.util.ReflectionHelper;
+
+import static java.lang.annotation.ElementType.TYPE;
+
+/**
+ * Via instances of this class constraints and cascading properties can be configured for a single bean class.
+ *
+ * @author Hardy Ferentschik
+ */
+public final class ConstraintsForType {
+	private static final String EMPTY_PROPERTY = "";
+
+	private final ConstraintMapping mapping;
+	private final Class<?> beanClass;
+	private String property;
+	private ElementType elementType;
+
+	public ConstraintsForType(Class<?> beanClass, ConstraintMapping mapping) {
+		this( beanClass, EMPTY_PROPERTY, TYPE, mapping );
+	}
+
+	public ConstraintsForType(Class<?> beanClass, String property, ElementType type, ConstraintMapping mapping) {
+		this.beanClass = beanClass;
+		this.mapping = mapping;
+		this.property = property;
+		this.elementType = type;
+	}
+
+	/**
+	 * Add a new constraint.
+	 *
+	 * @param definition The constraint definition class
+	 *
+	 * @return A constraint definition class allowing to specify additional constraint parameters.
+	 */
+	public <A extends Annotation, T extends ConstraintDef<A>> T constraint(Class<T> definition) {
+		final Constructor<T> constructor = ReflectionHelper.getConstructor(
+				definition, Class.class, String.class, ElementType.class, ConstraintMapping.class
+		);
+
+		final T constraintDefinition = ReflectionHelper.newConstructorInstance(
+				constructor, beanClass, property, elementType, mapping
+		);
+		mapping.addConstraintConfig( constraintDefinition );
+		return constraintDefinition;
+	}
+
+	/**
+	 * Changes the property for which added constraints apply. Until this method is called constraints apply on
+	 * class level. After calling this method constraints apply on the specified property with the given access type.
+	 *
+	 * @param property The property on which to apply the following constraints (Java Bean notation)
+	 * @param type The access type (field/property)
+	 *
+	 * @return Returns itself for method chaining
+	 */
+	public ConstraintsForType property(String property, ElementType type) {
+		return new ConstraintsForType( beanClass, property, type, mapping );
+	}
+
+	public ConstraintsForType valid(String property, ElementType type) {
+		mapping.addCascadeConfig( new CascadeDef( beanClass, property, type ) );
+		return this;
+	}
+
+	/**
+	 * Defines the default groups sequence for the bean class of this instance.
+	 *
+	 * @param defaultGroupSequence the default group sequence.
+	 *
+	 * @return Returns itself for method chaining.
+	 */
+	public ConstraintsForType defaultGroupSequence(Class<?>... defaultGroupSequence) {
+		mapping.addDefaultGroupSequence( beanClass, Arrays.asList( defaultGroupSequence ) );
+		return this;
+	}
+
+	/**
+	 * Creates a new {@code ConstraintsForType} in order to define constraints on a new bean type.
+	 *
+	 * @param type the bean type
+	 *
+	 * @return a new {@code ConstraintsForType} instance
+	 */
+	public ConstraintsForType type(Class<?> type) {
+		return new ConstraintsForType( type, mapping );
+	}
+}
+
+
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/AssertFalseDef.java b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/AssertFalseDef.java
new file mode 100644
index 0000000..62e1e17
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/AssertFalseDef.java
@@ -0,0 +1,33 @@
+// $Id: AssertFalseDef.java 19639 2010-06-01 11:52:20Z hardy.ferentschik $
+/*
+ * 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.cfg.defs;
+
+import java.lang.annotation.ElementType;
+import javax.validation.constraints.AssertFalse;
+
+import org.hibernate.validator.cfg.ConstraintDef;
+import org.hibernate.validator.cfg.ConstraintMapping;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class AssertFalseDef extends ConstraintDef<AssertFalse> {
+	public AssertFalseDef(Class<?> beanType, String property, ElementType elementType, ConstraintMapping mapping) {
+		super( beanType, AssertFalse.class, property, elementType, mapping );
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/AssertTrueDef.java b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/AssertTrueDef.java
new file mode 100644
index 0000000..33a37d6
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/AssertTrueDef.java
@@ -0,0 +1,33 @@
+// $Id: AssertTrueDef.java 19639 2010-06-01 11:52:20Z hardy.ferentschik $
+/*
+ * 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.cfg.defs;
+
+import java.lang.annotation.ElementType;
+import javax.validation.constraints.AssertTrue;
+
+import org.hibernate.validator.cfg.ConstraintDef;
+import org.hibernate.validator.cfg.ConstraintMapping;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class AssertTrueDef extends ConstraintDef<AssertTrue> {
+	public AssertTrueDef(Class<?> beanType, String property, ElementType elementType, ConstraintMapping mapping) {
+		super( beanType, AssertTrue.class, property, elementType, mapping );
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/CreditCardNumberDef.java b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/CreditCardNumberDef.java
new file mode 100644
index 0000000..94bd21b
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/CreditCardNumberDef.java
@@ -0,0 +1,34 @@
+// $Id: CreditCardNumberDef.java 19639 2010-06-01 11:52:20Z hardy.ferentschik $
+/*
+ * 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.cfg.defs;
+
+import java.lang.annotation.ElementType;
+
+import org.hibernate.validator.cfg.ConstraintDef;
+import org.hibernate.validator.cfg.ConstraintMapping;
+import org.hibernate.validator.constraints.CreditCardNumber;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class CreditCardNumberDef extends ConstraintDef<CreditCardNumber> {
+	public CreditCardNumberDef(Class<?> beanType, String property, ElementType elementType, ConstraintMapping mapping) {
+		super( beanType, CreditCardNumber.class, property, elementType, mapping );
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/DecimalMaxDef.java b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/DecimalMaxDef.java
new file mode 100644
index 0000000..169c0ad
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/DecimalMaxDef.java
@@ -0,0 +1,56 @@
+// $Id: DecimalMaxDef.java 19639 2010-06-01 11:52:20Z hardy.ferentschik $
+/*
+ * 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.cfg.defs;
+
+import java.lang.annotation.ElementType;
+import javax.validation.Payload;
+import javax.validation.constraints.DecimalMax;
+
+import org.hibernate.validator.cfg.ConstraintDef;
+import org.hibernate.validator.cfg.ConstraintMapping;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class DecimalMaxDef extends ConstraintDef<DecimalMax> {
+
+	public DecimalMaxDef(Class<?> beanType, String property, ElementType elementType, ConstraintMapping mapping) {
+		super( beanType, DecimalMax.class, property, elementType, mapping );
+	}
+
+	public DecimalMaxDef message(String message) {
+		super.message( message );
+		return this;
+	}
+
+	public DecimalMaxDef groups(Class<?>... groups) {
+		super.groups( groups );
+		return this;
+	}
+
+	public DecimalMaxDef payload(Class<? extends Payload>... payload) {
+		super.payload( payload );
+		return this;
+	}
+
+	public DecimalMaxDef value(String max) {
+		addParameter( "value", max );
+		return this;
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/DecimalMinDef.java b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/DecimalMinDef.java
new file mode 100644
index 0000000..5dfbbdb
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/DecimalMinDef.java
@@ -0,0 +1,55 @@
+// $Id: DecimalMinDef.java 19639 2010-06-01 11:52:20Z hardy.ferentschik $
+/*
+ * 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.cfg.defs;
+
+import java.lang.annotation.ElementType;
+import javax.validation.Payload;
+import javax.validation.constraints.DecimalMin;
+
+import org.hibernate.validator.cfg.ConstraintDef;
+import org.hibernate.validator.cfg.ConstraintMapping;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class DecimalMinDef extends ConstraintDef<DecimalMin> {
+
+	public DecimalMinDef(Class<?> beanType, String property, ElementType elementType, ConstraintMapping mapping) {
+		super( beanType, DecimalMin.class, property, elementType, mapping );
+	}
+
+	public DecimalMinDef message(String message) {
+		super.message( message );
+		return this;
+	}
+
+	public DecimalMinDef groups(Class<?>... groups) {
+		super.groups( groups );
+		return this;
+	}
+
+	public DecimalMinDef payload(Class<? extends Payload>... payload) {
+		super.payload( payload );
+		return this;
+	}
+
+	public DecimalMinDef value(String min) {
+		addParameter( "value", min );
+		return this;
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/DigitsDef.java b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/DigitsDef.java
new file mode 100644
index 0000000..05aade1
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/DigitsDef.java
@@ -0,0 +1,61 @@
+// $Id: DigitsDef.java 19639 2010-06-01 11:52:20Z hardy.ferentschik $
+/*
+ * 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.cfg.defs;
+
+import java.lang.annotation.ElementType;
+import javax.validation.Payload;
+import javax.validation.constraints.Digits;
+
+import org.hibernate.validator.cfg.ConstraintDef;
+import org.hibernate.validator.cfg.ConstraintMapping;
+
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class DigitsDef extends ConstraintDef<Digits> {
+
+	public DigitsDef(Class<?> beanType, String property, ElementType elementType, ConstraintMapping mapping) {
+		super( beanType, Digits.class, property, elementType, mapping );
+	}
+
+	public DigitsDef message(String message) {
+		super.message( message );
+		return this;
+	}
+
+	public DigitsDef groups(Class<?>... groups) {
+		super.groups( groups );
+		return this;
+	}
+
+	public DigitsDef payload(Class<? extends Payload>... payload) {
+		super.payload( payload );
+		return this;
+	}
+
+	public DigitsDef integer(int integer) {
+		addParameter( "integer", integer );
+		return this;
+	}
+
+	public DigitsDef fraction(int fraction) {
+		addParameter( "fraction", fraction );
+		return this;
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/EmailDef.java b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/EmailDef.java
new file mode 100644
index 0000000..eb6cce3
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/EmailDef.java
@@ -0,0 +1,34 @@
+// $Id: EmailDef.java 19639 2010-06-01 11:52:20Z hardy.ferentschik $
+/*
+ * 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.cfg.defs;
+
+import java.lang.annotation.ElementType;
+
+import org.hibernate.validator.cfg.ConstraintDef;
+import org.hibernate.validator.cfg.ConstraintMapping;
+import org.hibernate.validator.constraints.Email;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class EmailDef extends ConstraintDef<Email> {
+	public EmailDef(Class<?> beanType, String property, ElementType elementType, ConstraintMapping mapping) {
+		super( beanType, Email.class, property, elementType, mapping );
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/FutureDef.java b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/FutureDef.java
new file mode 100644
index 0000000..4c8865d
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/FutureDef.java
@@ -0,0 +1,33 @@
+// $Id: FutureDef.java 19639 2010-06-01 11:52:20Z hardy.ferentschik $
+/*
+ * 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.cfg.defs;
+
+import java.lang.annotation.ElementType;
+import javax.validation.constraints.Future;
+
+import org.hibernate.validator.cfg.ConstraintDef;
+import org.hibernate.validator.cfg.ConstraintMapping;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class FutureDef extends ConstraintDef<Future> {
+	public FutureDef(Class<?> beanType, String property, ElementType elementType, ConstraintMapping mapping) {
+		super( beanType, Future.class, property, elementType, mapping );
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/GenericConstraintDef.java b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/GenericConstraintDef.java
new file mode 100644
index 0000000..21a768d
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/GenericConstraintDef.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+// $Id: GenericConstraintDef.java 19639 2010-06-01 11:52:20Z hardy.ferentschik $
+
+package org.hibernate.validator.cfg.defs;
+
+import java.lang.annotation.ElementType;
+import javax.validation.Payload;
+
+import org.hibernate.validator.cfg.ConstraintDef;
+import org.hibernate.validator.cfg.ConstraintMapping;
+
+/**
+ * A {@code ConstraintDef} class which can be used to configure any constraint type. For this purpose the class defines
+ * a {@code constraintType}  method to specify the constraint type and a generic {@code param(String key,Object value)}
+ * to add arbitrary constraint parameters.
+ *
+ * @author Hardy Ferentschik
+ */
+public class GenericConstraintDef extends ConstraintDef {
+
+	public GenericConstraintDef(Class<?> beanType, String property, ElementType elementType, ConstraintMapping mapping) {
+		super( beanType, null, property, elementType, mapping );
+	}
+
+	public GenericConstraintDef message(String message) {
+		super.message( message );
+		return this;
+	}
+
+	public GenericConstraintDef groups(Class<?>... groups) {
+		super.groups( groups );
+		return this;
+	}
+
+	public GenericConstraintDef payload(Class<? extends Payload>... payload) {
+		super.payload( payload );
+		return this;
+	}
+
+	public GenericConstraintDef param(String key, Object value) {
+		addParameter( key, value );
+		return this;
+	}
+
+	public GenericConstraintDef constraintType(Class<?> constraintType) {
+		this.constraintType = constraintType;
+		return this;
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/LengthDef.java b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/LengthDef.java
new file mode 100644
index 0000000..2fdf5e0
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/LengthDef.java
@@ -0,0 +1,62 @@
+// $Id: LengthDef.java 19639 2010-06-01 11:52:20Z hardy.ferentschik $
+/*
+ * 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.cfg.defs;
+
+import java.lang.annotation.ElementType;
+import javax.validation.Payload;
+
+import org.hibernate.validator.cfg.ConstraintDef;
+import org.hibernate.validator.cfg.ConstraintMapping;
+import org.hibernate.validator.constraints.Length;
+
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class LengthDef extends ConstraintDef<Length> {
+
+	public LengthDef(Class<?> beanType, String property, ElementType elementType, ConstraintMapping mapping) {
+		super( beanType, Length.class, property, elementType, mapping );
+	}
+
+	public LengthDef message(String message) {
+		super.message( message );
+		return this;
+	}
+
+	public LengthDef groups(Class<?>... groups) {
+		super.groups( groups );
+		return this;
+	}
+
+	public LengthDef payload(Class<? extends Payload>... payload) {
+		super.payload( payload );
+		return this;
+	}
+
+	public LengthDef min(int min) {
+		addParameter( "min", min );
+		return this;
+	}
+
+	public LengthDef max(int max) {
+		addParameter( "max", max );
+		return this;
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/MaxDef.java b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/MaxDef.java
new file mode 100644
index 0000000..5b18e21
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/MaxDef.java
@@ -0,0 +1,55 @@
+// $Id: MaxDef.java 19639 2010-06-01 11:52:20Z hardy.ferentschik $
+/*
+ * 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.cfg.defs;
+
+import java.lang.annotation.ElementType;
+import javax.validation.Payload;
+import javax.validation.constraints.Max;
+
+import org.hibernate.validator.cfg.ConstraintDef;
+import org.hibernate.validator.cfg.ConstraintMapping;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class MaxDef extends ConstraintDef<Max> {
+
+	public MaxDef(Class<?> beanType, String property, ElementType elementType, ConstraintMapping mapping) {
+		super( beanType, Max.class, property, elementType, mapping );
+	}
+
+	public MaxDef message(String message) {
+		super.message( message );
+		return this;
+	}
+
+	public MaxDef groups(Class<?>... groups) {
+		super.groups( groups );
+		return this;
+	}
+
+	public MaxDef payload(Class<? extends Payload>... payload) {
+		super.payload( payload );
+		return this;
+	}
+
+	public MaxDef value(long max) {
+		addParameter( "value", max );
+		return this;
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/MinDef.java b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/MinDef.java
new file mode 100644
index 0000000..07cd076
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/MinDef.java
@@ -0,0 +1,55 @@
+// $Id: MinDef.java 19639 2010-06-01 11:52:20Z hardy.ferentschik $
+/*
+ * 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.cfg.defs;
+
+import java.lang.annotation.ElementType;
+import javax.validation.Payload;
+import javax.validation.constraints.Min;
+
+import org.hibernate.validator.cfg.ConstraintDef;
+import org.hibernate.validator.cfg.ConstraintMapping;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class MinDef extends ConstraintDef<Min> {
+
+	public MinDef(Class<?> beanType, String property, ElementType elementType, ConstraintMapping mapping) {
+		super( beanType, Min.class, property, elementType, mapping );
+	}
+
+	public MinDef message(String message) {
+		super.message( message );
+		return this;
+	}
+
+	public MinDef groups(Class<?>... groups) {
+		super.groups( groups );
+		return this;
+	}
+
+	public MinDef payload(Class<? extends Payload>... payload) {
+		super.payload( payload );
+		return this;
+	}
+
+	public MinDef value(long min) {
+		addParameter( "value", min );
+		return this;
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/NotBlankDef.java b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/NotBlankDef.java
new file mode 100644
index 0000000..cbf3bd9
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/NotBlankDef.java
@@ -0,0 +1,33 @@
+// $Id: NotBlankDef.java 19639 2010-06-01 11:52:20Z hardy.ferentschik $
+/*
+ * 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.cfg.defs;
+
+import java.lang.annotation.ElementType;
+
+import org.hibernate.validator.cfg.ConstraintDef;
+import org.hibernate.validator.cfg.ConstraintMapping;
+import org.hibernate.validator.constraints.NotBlank;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class NotBlankDef extends ConstraintDef<NotBlank> {
+	public NotBlankDef(Class<?> beanType, String property, ElementType elementType, ConstraintMapping mapping) {
+		super( beanType, NotBlank.class, property, elementType, mapping );
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/NotEmptyDef.java b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/NotEmptyDef.java
new file mode 100644
index 0000000..5c584e7
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/NotEmptyDef.java
@@ -0,0 +1,33 @@
+// $Id: NotEmptyDef.java 19639 2010-06-01 11:52:20Z hardy.ferentschik $
+/*
+ * 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.cfg.defs;
+
+import java.lang.annotation.ElementType;
+
+import org.hibernate.validator.cfg.ConstraintDef;
+import org.hibernate.validator.cfg.ConstraintMapping;
+import org.hibernate.validator.constraints.NotEmpty;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class NotEmptyDef extends ConstraintDef<NotEmpty> {
+	public NotEmptyDef(Class<?> beanType, String property, ElementType elementType, ConstraintMapping mapping) {
+		super( beanType, NotEmpty.class, property, elementType, mapping );
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/NotNullDef.java b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/NotNullDef.java
new file mode 100644
index 0000000..f6ddc00
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/NotNullDef.java
@@ -0,0 +1,33 @@
+// $Id: NotNullDef.java 19639 2010-06-01 11:52:20Z hardy.ferentschik $
+/*
+ * 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.cfg.defs;
+
+import java.lang.annotation.ElementType;
+import javax.validation.constraints.NotNull;
+
+import org.hibernate.validator.cfg.ConstraintDef;
+import org.hibernate.validator.cfg.ConstraintMapping;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class NotNullDef extends ConstraintDef<NotNull> {
+	public NotNullDef(Class<?> beanType, String property, ElementType elementType, ConstraintMapping mapping) {
+		super( beanType, NotNull.class, property, elementType, mapping );
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/NullDef.java b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/NullDef.java
new file mode 100644
index 0000000..8da048e
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/NullDef.java
@@ -0,0 +1,33 @@
+// $Id: NullDef.java 19639 2010-06-01 11:52:20Z hardy.ferentschik $
+/*
+ * 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.cfg.defs;
+
+import java.lang.annotation.ElementType;
+import javax.validation.constraints.Null;
+
+import org.hibernate.validator.cfg.ConstraintDef;
+import org.hibernate.validator.cfg.ConstraintMapping;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class NullDef extends ConstraintDef<Null> {
+	public NullDef(Class<?> beanType, String property, ElementType elementType, ConstraintMapping mapping) {
+		super( beanType, Null.class, property, elementType, mapping );
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/PastDef.java b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/PastDef.java
new file mode 100644
index 0000000..f741da3
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/PastDef.java
@@ -0,0 +1,33 @@
+// $Id: PastDef.java 19639 2010-06-01 11:52:20Z hardy.ferentschik $
+/*
+ * 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.cfg.defs;
+
+import java.lang.annotation.ElementType;
+import javax.validation.constraints.Past;
+
+import org.hibernate.validator.cfg.ConstraintDef;
+import org.hibernate.validator.cfg.ConstraintMapping;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class PastDef extends ConstraintDef<Past> {
+	public PastDef(Class<?> beanType, String property, ElementType elementType, ConstraintMapping mapping) {
+		super( beanType, Past.class, property, elementType, mapping );
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/PatternDef.java b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/PatternDef.java
new file mode 100644
index 0000000..c19dfd0
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/PatternDef.java
@@ -0,0 +1,61 @@
+// $Id: PatternDef.java 19639 2010-06-01 11:52:20Z hardy.ferentschik $
+/*
+ * 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.cfg.defs;
+
+import java.lang.annotation.ElementType;
+import javax.validation.Payload;
+import javax.validation.constraints.Pattern;
+
+import org.hibernate.validator.cfg.ConstraintDef;
+import org.hibernate.validator.cfg.ConstraintMapping;
+
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class PatternDef extends ConstraintDef<Pattern> {
+
+	public PatternDef(Class<?> beanType, String property, ElementType elementType, ConstraintMapping mapping) {
+		super( beanType, Pattern.class, property, elementType, mapping );
+	}
+
+	public PatternDef message(String message) {
+		super.message( message );
+		return this;
+	}
+
+	public PatternDef groups(Class<?>... groups) {
+		super.groups( groups );
+		return this;
+	}
+
+	public PatternDef payload(Class<? extends Payload>... payload) {
+		super.payload( payload );
+		return this;
+	}
+
+	public PatternDef flags(Pattern.Flag[] flags) {
+		addParameter( "flags", flags );
+		return this;
+	}
+
+	public PatternDef regexp(String regexp) {
+		addParameter( "regexp", regexp );
+		return this;
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/RangeDef.java b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/RangeDef.java
new file mode 100644
index 0000000..69d9a9e
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/RangeDef.java
@@ -0,0 +1,60 @@
+// $Id: RangeDef.java 19639 2010-06-01 11:52:20Z hardy.ferentschik $
+/*
+ * 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.cfg.defs;
+
+import java.lang.annotation.ElementType;
+import javax.validation.Payload;
+
+import org.hibernate.validator.cfg.ConstraintDef;
+import org.hibernate.validator.cfg.ConstraintMapping;
+import org.hibernate.validator.constraints.Range;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class RangeDef extends ConstraintDef<Range> {
+
+	public RangeDef(Class<?> beanType, String property, ElementType elementType, ConstraintMapping mapping) {
+		super( beanType, Range.class, property, elementType, mapping );
+	}
+
+	public RangeDef message(String message) {
+		super.message( message );
+		return this;
+	}
+
+	public RangeDef groups(Class<?>... groups) {
+		super.groups( groups );
+		return this;
+	}
+
+	public RangeDef payload(Class<? extends Payload>... payload) {
+		super.payload( payload );
+		return this;
+	}
+
+	public RangeDef min(long min) {
+		addParameter( "value", min );
+		return this;
+	}
+
+	public RangeDef max(long max) {
+		addParameter( "value", max );
+		return this;
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/ScriptAssertDef.java b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/ScriptAssertDef.java
new file mode 100644
index 0000000..da7c4a2
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/ScriptAssertDef.java
@@ -0,0 +1,65 @@
+// $Id: ScriptAssertDef.java 19639 2010-06-01 11:52:20Z hardy.ferentschik $
+/*
+ * 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.cfg.defs;
+
+import java.lang.annotation.ElementType;
+import javax.validation.Payload;
+
+import org.hibernate.validator.cfg.ConstraintDef;
+import org.hibernate.validator.cfg.ConstraintMapping;
+import org.hibernate.validator.constraints.ScriptAssert;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class ScriptAssertDef extends ConstraintDef<ScriptAssert> {
+
+	public ScriptAssertDef(Class<?> beanType, String property, ElementType elementType, ConstraintMapping mapping) {
+		super( beanType, ScriptAssert.class, property, elementType, mapping );
+	}
+
+	public ScriptAssertDef message(String message) {
+		super.message( message );
+		return this;
+	}
+
+	public ScriptAssertDef groups(Class<?>... groups) {
+		super.groups( groups );
+		return this;
+	}
+
+	public ScriptAssertDef payload(Class<? extends Payload>... payload) {
+		super.payload( payload );
+		return this;
+	}
+
+	public ScriptAssertDef lang(String lang) {
+		addParameter( "lang", lang );
+		return this;
+	}
+
+	public ScriptAssertDef script(String script) {
+		addParameter( "script", script );
+		return this;
+	}
+
+	public ScriptAssertDef alias(String alias) {
+		addParameter( "alias", alias );
+		return this;
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/SizeDef.java b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/SizeDef.java
new file mode 100644
index 0000000..46d9adf
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/SizeDef.java
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+
+// $Id: SizeDef.java 19639 2010-06-01 11:52:20Z hardy.ferentschik $
+package org.hibernate.validator.cfg.defs;
+
+import java.lang.annotation.ElementType;
+import javax.validation.Payload;
+import javax.validation.constraints.Size;
+
+import org.hibernate.validator.cfg.ConstraintDef;
+import org.hibernate.validator.cfg.ConstraintMapping;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class SizeDef extends ConstraintDef<Size> {
+
+	public SizeDef(Class<?> beanType, String property, ElementType elementType, ConstraintMapping mapping) {
+		super( beanType, Size.class, property, elementType, mapping );
+	}
+
+	public SizeDef message(String message) {
+		super.message( message );
+		return this;
+	}
+
+	public SizeDef groups(Class<?>... groups) {
+		super.groups( groups );
+		return this;
+	}
+
+	public SizeDef payload(Class<? extends Payload>... payload) {
+		super.payload( payload );
+		return this;
+	}
+
+	public SizeDef min(int min) {
+		addParameter( "min", min );
+		return this;
+	}
+
+	public SizeDef max(int max) {
+		addParameter( "max", max );
+		return this;
+	}
+}
+
+
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/URLDef.java b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/URLDef.java
new file mode 100644
index 0000000..b1ba8b7
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/URLDef.java
@@ -0,0 +1,64 @@
+// $Id: URLDef.java 19639 2010-06-01 11:52:20Z hardy.ferentschik $
+/* 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.cfg.defs;
+
+import java.lang.annotation.ElementType;
+import javax.validation.Payload;
+
+import org.hibernate.validator.cfg.ConstraintDef;
+import org.hibernate.validator.cfg.ConstraintMapping;
+import org.hibernate.validator.constraints.URL;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class URLDef extends ConstraintDef<URL> {
+
+	public URLDef(Class<?> beanType, String property, ElementType elementType, ConstraintMapping mapping) {
+		super( beanType, URL.class, property, elementType, mapping );
+	}
+
+	public URLDef message(String message) {
+		super.message( message );
+		return this;
+	}
+
+	public URLDef groups(Class<?>... groups) {
+		super.groups( groups );
+		return this;
+	}
+
+	public URLDef payload(Class<? extends Payload>... payload) {
+		super.payload( payload );
+		return this;
+	}
+
+	public URLDef protocol(String protocol) {
+		addParameter( "protocol", protocol );
+		return this;
+	}
+
+	public URLDef host(String host) {
+		addParameter( "host", host );
+		return this;
+	}
+
+	public URLDef port(int port) {
+		addParameter( "port", port );
+		return this;
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/package.html b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/package.html
new file mode 100644
index 0000000..4b33510
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/defs/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~ 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.
+  -->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+<head>
+</head>
+<body>
+Helper classes for programmatic constraint definition API.
+</body>
+</html>
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/cfg/package.html b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/package.html
new file mode 100644
index 0000000..661ec82
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/cfg/package.html
@@ -0,0 +1,26 @@
+<!--
+  ~ $Id: package.html 19606 2010-05-25 18:21:27Z hardy.ferentschik $
+  ~
+  ~ 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.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+<head>
+</head>
+<body>
+Programmatic constraint definition API.
+</body>
+</html>
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/CreditCardNumber.java b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/CreditCardNumber.java
new file mode 100644
index 0000000..08da11f
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/CreditCardNumber.java
@@ -0,0 +1,63 @@
+//$Id: CreditCardNumber.java 19327 2010-04-30 08:11:15Z hardy.ferentschik $
+/*
+* 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.constraints;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+
+import org.hibernate.validator.constraints.impl.CreditCardNumberValidator;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * The annotated element has to represent a valid
+ * credit card number. This is the Luhn algorithm implementation
+ * which aims to check for user mistake, not credit card validity!
+ *
+ * @author Hardy Ferentschik
+ * @author Emmanuel Bernard
+ */
+ at Documented
+ at Constraint(validatedBy = CreditCardNumberValidator.class)
+ at Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
+ at Retention(RUNTIME)
+public @interface CreditCardNumber {
+	public abstract String message() default "{org.hibernate.validator.constraints.CreditCardNumber.message}";
+
+	public abstract Class<?>[] groups() default { };
+
+	public abstract Class<? extends Payload>[] payload() default { };
+
+	/**
+	 * Defines several {@code @CreditCardNumber} annotations on the same element.
+	 */
+	@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
+	@Retention(RUNTIME)
+	@Documented
+	public @interface List {
+		CreditCardNumber[] value();
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/Email.java b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/Email.java
index e7a7b9f..bd0016a 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/Email.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/Email.java
@@ -1,4 +1,4 @@
-//$Id: Email.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+//$Id: Email.java 19327 2010-04-30 08:11:15Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -18,19 +18,20 @@
 package org.hibernate.validator.constraints;
 
 import java.lang.annotation.Documented;
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
 import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
 import java.lang.annotation.Target;
 import javax.validation.Constraint;
 import javax.validation.Payload;
 
 import org.hibernate.validator.constraints.impl.EmailValidator;
 
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
 /**
  * The string has to be a well-formed email address.
  *
@@ -47,4 +48,14 @@ public @interface Email {
 	Class<?>[] groups() default { };
 
 	Class<? extends Payload>[] payload() default { };
+
+	/**
+	 * Defines several {@code @Email} annotations on the same element.
+	 */
+	@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
+	@Retention(RUNTIME)
+	@Documented
+	public @interface List {
+		Email[] value();
+	}
 }
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/Length.java b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/Length.java
index e781ad8..ac7e6e8 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/Length.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/Length.java
@@ -1,4 +1,4 @@
-// $Id: Length.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: Length.java 19327 2010-04-30 08:11:15Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -18,20 +18,20 @@
 package org.hibernate.validator.constraints;
 
 import java.lang.annotation.Documented;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.PARAMETER;
 import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
 import java.lang.annotation.Target;
 import javax.validation.Constraint;
 import javax.validation.Payload;
 
 import org.hibernate.validator.constraints.impl.LengthValidator;
 
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
 /**
  * Validate that the string is between min and max included.
  *
@@ -52,4 +52,14 @@ public @interface Length {
 	Class<?>[] groups() default { };
 
 	Class<? extends Payload>[] payload() default { };
+
+	/**
+	 * Defines several {@code @Length} annotations on the same element.
+	 */
+	@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
+	@Retention(RUNTIME)
+	@Documented
+	public @interface List {
+		Length[] value();
+	}
 }
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/NotBlank.java b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/NotBlank.java
new file mode 100644
index 0000000..199ef8e
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/NotBlank.java
@@ -0,0 +1,66 @@
+/*
+ * $Id: NotBlank.java 19327 2010-04-30 08:11:15Z hardy.ferentschik $
+ *
+ * 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.constraints;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import javax.validation.ReportAsSingleViolation;
+import javax.validation.constraints.NotNull;
+
+import org.hibernate.validator.constraints.impl.NotBlankValidator;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Validate that the annotated string is not {@code null} or empty.
+ * The difference to {@code NotEmpty} is that trailing whitespaces are getting ignored.
+ *
+ * @author Hardy Ferentschik
+ */
+ at Documented
+ at Constraint(validatedBy = { NotBlankValidator.class })
+ at Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
+ at Retention(RUNTIME)
+ at ReportAsSingleViolation
+ at NotNull
+public @interface NotBlank {
+	public abstract String message() default "{org.hibernate.validator.constraints.NotBlank.message}";
+
+	public abstract Class<?>[] groups() default { };
+
+	public abstract Class<? extends Payload>[] payload() default { };
+
+	/**
+	 * Defines several {@code @NotBlank} annotations on the same element.
+	 */
+	@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
+	@Retention(RUNTIME)
+	@Documented
+	public @interface List {
+		NotBlank[] value();
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/NotEmpty.java b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/NotEmpty.java
index 704b89a..8704cfa 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/NotEmpty.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/NotEmpty.java
@@ -1,4 +1,4 @@
-// $Id: NotEmpty.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: NotEmpty.java 19327 2010-04-30 08:11:15Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -18,13 +18,7 @@
 package org.hibernate.validator.constraints;
 
 import java.lang.annotation.Documented;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.PARAMETER;
 import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
 import java.lang.annotation.Target;
 import javax.validation.Constraint;
 import javax.validation.Payload;
@@ -32,8 +26,18 @@ import javax.validation.ReportAsSingleViolation;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
 /**
+ * Asserts that the annotated string, collection, map or array is not {@code null} or empty.
+ *
  * @author Emmanuel Bernard
+ * @author Hardy Ferentschik
  */
 @Documented
 @Constraint(validatedBy = { })
@@ -48,4 +52,14 @@ public @interface NotEmpty {
 	Class<?>[] groups() default { };
 
 	Class<? extends Payload>[] payload() default { };
+
+	/**
+	 * Defines several {@code @NotEmpty} annotations on the same element.
+	 */
+	@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
+	@Retention(RUNTIME)
+	@Documented
+	public @interface List {
+		NotEmpty[] value();
+	}
 }
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/Range.java b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/Range.java
index 351c11b..c2142bb 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/Range.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/Range.java
@@ -1,4 +1,4 @@
-//$Id: Range.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+//$Id: Range.java 19327 2010-04-30 08:11:15Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -18,13 +18,7 @@
 package org.hibernate.validator.constraints;
 
 import java.lang.annotation.Documented;
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
 import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
 import java.lang.annotation.Target;
 import javax.validation.Constraint;
 import javax.validation.OverridesAttribute;
@@ -33,6 +27,13 @@ import javax.validation.ReportAsSingleViolation;
 import javax.validation.constraints.Max;
 import javax.validation.constraints.Min;
 
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
 /**
  * The annotated element has to be in the appropriate range. Apply on numeric values or string
  * representation of the numeric value.
@@ -47,15 +48,23 @@ import javax.validation.constraints.Min;
 @Max(Long.MAX_VALUE)
 @ReportAsSingleViolation
 public @interface Range {
-	@OverridesAttribute(constraint = Min.class, name = "value")
-	long min() default 0;
+	@OverridesAttribute(constraint = Min.class, name = "value") long min() default 0;
 
-	@OverridesAttribute(constraint = Max.class, name = "value")
-	long max() default Long.MAX_VALUE;
+	@OverridesAttribute(constraint = Max.class, name = "value") long max() default Long.MAX_VALUE;
 
 	String message() default "{org.hibernate.validator.constraints.Range.message}";
 
 	Class<?>[] groups() default { };
 
 	Class<? extends Payload>[] payload() default { };
+
+	/**
+	 * Defines several {@code @Range} annotations on the same element.
+	 */
+	@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
+	@Retention(RUNTIME)
+	@Documented
+	public @interface List {
+		Range[] value();
+	}
 }
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/ScriptAssert.java b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/ScriptAssert.java
new file mode 100644
index 0000000..c59cd52
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/ScriptAssert.java
@@ -0,0 +1,136 @@
+// $Id: ScriptAssert.java 19327 2010-04-30 08:11:15Z hardy.ferentschik $
+/*
+* 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.constraints;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import javax.script.ScriptContext;
+import javax.script.ScriptEngineManager;
+import javax.validation.Constraint;
+import javax.validation.ConstraintDeclarationException;
+import javax.validation.Payload;
+
+import org.hibernate.validator.constraints.impl.ScriptAssertValidator;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * <p>
+ * A class-level constraint, that evaluates a script expression against the
+ * annotated element. This constraint can be used to implement validation
+ * routines, that depend on multiple attributes of the annotated element.
+ * </p>
+ * <p>
+ * For evaluation of expressions the Java Scripting API as defined by <a
+ * href="http://jcp.org/en/jsr/detail?id=223">JSR 223</a>
+ * ("Scripting for the Java<sup>TM</sup> Platform") is used. Therefore an
+ * implementation of that API must part of the class path. This is automatically
+ * the case when running on Java 6. For older Java versions, the JSR 223 RI can
+ * be added manually to the class path.
+ * </p>
+ * The expressions to be evaluated can be written in any scripting or expression
+ * language, for which a JSR 223 compatible engine can be found in the class
+ * path. The following listing shows an example using the JavaScript engine,
+ * which comes with Java 6: </p>
+ * <p/>
+ * <pre>
+ * @ScriptAssert(lang = "javascript", script = "_this.startDate.before(_this.endDate)")
+ * public class CalendarEvent {
+ * <p/>
+ * 	private Date startDate;
+ * <p/>
+ * 	private Date endDate;
+ * <p/>
+ * 	//...
+ * <p/>
+ * }
+ * </pre>
+ * <p>
+ * Using a real expression language in conjunction with a shorter object alias allows
+ * for very compact expressions:
+ * </p>
+ * <pre>
+ * @ScriptAssert(lang = "jexl", script = "_.startDate < _.endDate", alias = "_")
+ * public class CalendarEvent {
+ * <p/>
+ * 	private Date startDate;
+ * <p/>
+ * 	private Date endDate;
+ * <p/>
+ * 	//...
+ * <p/>
+ * }
+ * </pre>
+ * <p>
+ * Accepts any type.
+ * </p>
+ *
+ * @author Gunnar Morling
+ */
+ at Target({ TYPE })
+ at Retention(RUNTIME)
+ at Constraint(validatedBy = ScriptAssertValidator.class)
+ at Documented
+public @interface ScriptAssert {
+
+	String message() default "{org.hibernate.validator.constraints.ScriptAssert.message}";
+
+	Class<?>[] groups() default { };
+
+	Class<? extends Payload>[] payload() default { };
+
+	/**
+	 * @return The name of the script language used by this constraint as
+	 *         expected by the JSR 223 {@link ScriptEngineManager}. A
+	 *         {@link ConstraintDeclarationException} will be thrown upon script
+	 *         evaluation, if no engine for the given language could be found.
+	 */
+	String lang();
+
+	/**
+	 * @return The script to be executed. The script must return
+	 *         <code>Boolean.TRUE</code>, if the annotated element could
+	 *         successfully be validated, otherwise <code>Boolean.FALSE</code>.
+	 *         Returning null or any type other than Boolean will cause a
+	 *         {@link ConstraintDeclarationException} upon validation. Any
+	 *         exception occurring during script evaluation will be wrapped into
+	 *         a ConstraintDeclarationException, too. Within the script, the
+	 *         validated object can be accessed from the {@link ScriptContext
+	 *         script context} using the name specified in the
+	 *         <code>alias</code> attribute.
+	 */
+	String script();
+
+	/**
+	 * @return The name, under which the annotated element shall be registered
+	 *         within the script context. Defaults to "_this".
+	 */
+	String alias() default "_this";
+
+	/**
+	 * Defines several {@code @ScriptAssert} annotations on the same element.
+	 */
+	@Target({ TYPE })
+	@Retention(RUNTIME)
+	@Documented
+	public @interface List {
+		ScriptAssert[] value();
+	}
+}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/URL.java b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/URL.java
new file mode 100644
index 0000000..3b7d5bf
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/URL.java
@@ -0,0 +1,66 @@
+// $Id: URL.java 19327 2010-04-30 08:11:15Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, 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.constraints;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+
+import org.hibernate.validator.constraints.impl.URLValidator;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Validate that the string is a valid URL.
+ *
+ * @author Hardy Ferentschik
+ */
+ at Documented
+ at Constraint(validatedBy = URLValidator.class)
+ at Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
+ at Retention(RUNTIME)
+public @interface URL {
+	public abstract String protocol() default "";
+
+	public abstract String host() default "";
+
+	public abstract int port() default -1;
+
+	public abstract String message() default "{org.hibernate.validator.constraints.URL.message}";
+
+	public abstract Class<?>[] groups() default { };
+
+	public abstract Class<? extends Payload>[] payload() default { };
+
+	/**
+	 * Defines several {@code @URL} annotations on the same element.
+	 */
+	@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
+	@Retention(RUNTIME)
+	@Documented
+	public @interface List {
+		URL[] value();
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/CreditCardNumberValidator.java b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/CreditCardNumberValidator.java
new file mode 100644
index 0000000..45b5349
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/CreditCardNumberValidator.java
@@ -0,0 +1,31 @@
+//$Id: CreditCardNumberValidator.java 18982 2010-03-11 19:31:30Z hardy.ferentschik $
+package org.hibernate.validator.constraints.impl;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+import org.hibernate.validator.constraints.CreditCardNumber;
+
+/**
+ * Check a credit card number through the Luhn algorithm.
+ *
+ * @author Emmanuel Bernard
+ * @author Hardy Ferentschik
+ */
+public class CreditCardNumberValidator implements ConstraintValidator<CreditCardNumber, String> {
+	private LuhnValidator luhnValidator;
+
+	public CreditCardNumberValidator() {
+		luhnValidator = new LuhnValidator( 2 );
+	}
+
+	public void initialize(CreditCardNumber annotation) {
+	}
+
+	public boolean isValid(String value, ConstraintValidatorContext context) {
+		if ( value == null ) {
+			return true;
+		}
+		return luhnValidator.passesLuhnTest( value );
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/DecimalMaxValidatorForNumber.java b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/DecimalMaxValidatorForNumber.java
index 27d7b13..1ac34c5 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/DecimalMaxValidatorForNumber.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/DecimalMaxValidatorForNumber.java
@@ -1,4 +1,4 @@
-// $Id: DecimalMaxValidatorForNumber.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: DecimalMaxValidatorForNumber.java 19776 2010-06-21 13:30:26Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -38,12 +38,13 @@ public class DecimalMaxValidatorForNumber implements ConstraintValidator<Decimal
 			this.maxValue = new BigDecimal( maxValue.value() );
 		}
 		catch ( NumberFormatException nfe ) {
-			throw new IllegalArgumentException( maxValue.value() + " does not represent a valid BigDecimal format" );
+			throw new IllegalArgumentException(
+					maxValue.value() + " does not represent a valid BigDecimal format", nfe
+			);
 		}
 	}
 
 	public boolean isValid(Number value, ConstraintValidatorContext constraintValidatorContext) {
-
 		//null values are valid
 		if ( value == null ) {
 			return true;
@@ -56,7 +57,7 @@ public class DecimalMaxValidatorForNumber implements ConstraintValidator<Decimal
 			return ( new BigDecimal( ( BigInteger ) value ) ).compareTo( maxValue ) != 1;
 		}
 		else {
-			return ( new BigDecimal( value.doubleValue() ).compareTo( maxValue ) ) != 1;
+			return ( BigDecimal.valueOf( value.longValue() ).compareTo( maxValue ) ) != 1;
 		}
 	}
 }
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/DecimalMaxValidatorForString.java b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/DecimalMaxValidatorForString.java
index 147393d..631ff0e 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/DecimalMaxValidatorForString.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/DecimalMaxValidatorForString.java
@@ -1,4 +1,4 @@
-// $Id: DecimalMaxValidatorForString.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: DecimalMaxValidatorForString.java 19776 2010-06-21 13:30:26Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -37,7 +37,9 @@ public class DecimalMaxValidatorForString implements ConstraintValidator<Decimal
 			this.maxValue = new BigDecimal( maxValue.value() );
 		}
 		catch ( NumberFormatException nfe ) {
-			throw new IllegalArgumentException( maxValue.value() + " does not represent a valid BigDecimal format" );
+			throw new IllegalArgumentException(
+					maxValue.value() + " does not represent a valid BigDecimal format", nfe
+			);
 		}
 	}
 
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/DecimalMinValidatorForNumber.java b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/DecimalMinValidatorForNumber.java
index 6bc1428..0f8e5bd 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/DecimalMinValidatorForNumber.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/DecimalMinValidatorForNumber.java
@@ -1,4 +1,4 @@
-// $Id: DecimalMinValidatorForNumber.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: DecimalMinValidatorForNumber.java 19776 2010-06-21 13:30:26Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -38,7 +38,9 @@ public class DecimalMinValidatorForNumber implements ConstraintValidator<Decimal
 			this.minValue = new BigDecimal( minValue.value() );
 		}
 		catch ( NumberFormatException nfe ) {
-			throw new IllegalArgumentException( minValue.value() + " does not represent a valid BigDecimal format" );
+			throw new IllegalArgumentException(
+					minValue.value() + " does not represent a valid BigDecimal format", nfe
+			);
 		}
 	}
 
@@ -56,7 +58,7 @@ public class DecimalMinValidatorForNumber implements ConstraintValidator<Decimal
 			return ( new BigDecimal( ( BigInteger ) value ) ).compareTo( minValue ) != -1;
 		}
 		else {
-			return ( new BigDecimal( value.doubleValue() ).compareTo( minValue ) ) != -1;
+			return ( BigDecimal.valueOf( value.longValue() ).compareTo( minValue ) ) != -1;
 		}
 	}
 }
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/DecimalMinValidatorForString.java b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/DecimalMinValidatorForString.java
index 4f65609..4b6aca2 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/DecimalMinValidatorForString.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/DecimalMinValidatorForString.java
@@ -1,4 +1,4 @@
-// $Id: DecimalMinValidatorForString.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: DecimalMinValidatorForString.java 19776 2010-06-21 13:30:26Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -34,7 +34,9 @@ public class DecimalMinValidatorForString implements ConstraintValidator<Decimal
 			this.minValue = new BigDecimal( minValue.value() );
 		}
 		catch ( NumberFormatException nfe ) {
-			throw new IllegalArgumentException( minValue.value() + " does not represent a valid BigDecimal format" );
+			throw new IllegalArgumentException(
+					minValue.value() + " does not represent a valid BigDecimal format", nfe
+			);
 		}
 	}
 
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/EmailValidator.java b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/EmailValidator.java
index a5fc48d..6ff16ef 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/EmailValidator.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/EmailValidator.java
@@ -1,4 +1,4 @@
-//$Id: EmailValidator.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+//$Id: EmailValidator.java 19796 2010-06-23 11:23:07Z hardy.ferentschik $
 package org.hibernate.validator.constraints.impl;
 
 import java.util.regex.Matcher;
@@ -8,13 +8,22 @@ import javax.validation.ConstraintValidatorContext;
 import org.hibernate.validator.constraints.Email;
 
 /**
- * Check that a given string is a well-formed email address.
+ * Checks that a given string is a well-formed email address.
+ * <p>
+ * The specification of a valid email can be found in
+ * <a href="http://www.faqs.org/rfcs/rfc2822.html">RFC 2822</a>
+ * and one can come up with a regular expression matching <a href="http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html">
+ * all valid email addresses</a> as per specification. However, as this
+ * <a href="http://www.regular-expressions.info/email.html">article</a> discusses it is not necessarily practical to
+ * implement a 100% compliant email validator. This implementation is a trade-off trying to match most email while ignoring
+ * for example emails with double quotes or comments.
+ * </p>
  *
  * @author Emmanuel Bernard
+ * @author Hardy Ferentschik
  */
 public class EmailValidator implements ConstraintValidator<Email, String> {
-	//TODO: Implement this http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html regex in java
-	private static String ATOM = "[^\\x00-\\x1F^\\(^\\)^\\<^\\>^\\@^\\,^\\;^\\:^\\\\^\\\"^\\.^\\[^\\]^\\s]";
+	private static String ATOM = "[a-z0-9!#$%&'*+/=?^_`{|}~-]";
 	private static String DOMAIN = "(" + ATOM + "+(\\." + ATOM + "+)*";
 	private static String IP_DOMAIN = "\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\]";
 
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/LuhnValidator.java b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/LuhnValidator.java
new file mode 100644
index 0000000..5c64981
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/LuhnValidator.java
@@ -0,0 +1,63 @@
+// $Id: LuhnValidator.java 19090 2010-03-23 15:22:59Z hardy.ferentschik $
+/*
+* 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.constraints.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Implement the Luhn algorithm (with Luhn key on the last digit). See also {@link http://en.wikipedia.org/wiki/Luhn_algorithm}
+ * and {@link http://www.merriampark.com/anatomycc.htm}.
+ *
+ * @author Hardy Ferentschik
+ */
+public class LuhnValidator {
+	private final int multiplicator;
+
+	public LuhnValidator(int multiplicator) {
+		this.multiplicator = multiplicator;
+	}
+
+	public boolean passesLuhnTest(String value) {
+		char[] chars = value.toCharArray();
+
+		List<Integer> digits = new ArrayList<Integer>();
+		for ( char c : chars ) {
+			if ( Character.isDigit( c ) ) {
+				digits.add( c - '0' );
+			}
+		}
+		int length = digits.size();
+		int sum = 0;
+		boolean even = false;
+		for ( int index = length - 1; index >= 0; index-- ) {
+			int digit = digits.get( index );
+			if ( even ) {
+				digit *= multiplicator;
+			}
+			if ( digit > 9 ) {
+				digit = digit / 10 + digit % 10;
+			}
+			sum += digit;
+			even = !even;
+		}
+		return sum % 10 == 0;
+	}
+}
+
+
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/MaxValidatorForNumber.java b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/MaxValidatorForNumber.java
index 119cb7f..b0b4850 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/MaxValidatorForNumber.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/MaxValidatorForNumber.java
@@ -1,7 +1,7 @@
-// $Id: MaxValidatorForNumber.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: MaxValidatorForNumber.java 19776 2010-06-21 13:30:26Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
+* 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.
 *
@@ -28,6 +28,7 @@ import javax.validation.constraints.Max;
  * value specified.
  *
  * @author Alaa Nassef
+ * @author Hardy Ferentschik
  */
 public class MaxValidatorForNumber implements ConstraintValidator<Max, Number> {
 
@@ -49,8 +50,8 @@ public class MaxValidatorForNumber implements ConstraintValidator<Max, Number> {
 			return ( ( BigInteger ) value ).compareTo( BigInteger.valueOf( maxValue ) ) != 1;
 		}
 		else {
-			double doubleValue = value.doubleValue();
-			return doubleValue <= maxValue;
+			long longValue = value.longValue();
+			return longValue <= maxValue;
 		}
 	}
 }
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/MinValidatorForNumber.java b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/MinValidatorForNumber.java
index 6494a88..ae7ae2d 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/MinValidatorForNumber.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/MinValidatorForNumber.java
@@ -1,4 +1,4 @@
-// $Id: MinValidatorForNumber.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: MinValidatorForNumber.java 19776 2010-06-21 13:30:26Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -28,6 +28,7 @@ import javax.validation.constraints.Min;
  * value specified.
  *
  * @author Alaa Nassef
+ * @author Hardy Ferentschik
  */
 public class MinValidatorForNumber implements ConstraintValidator<Min, Number> {
 
@@ -49,9 +50,8 @@ public class MinValidatorForNumber implements ConstraintValidator<Min, Number> {
 			return ( ( BigInteger ) value ).compareTo( BigInteger.valueOf( minValue ) ) != -1;
 		}
 		else {
-			double doubleValue = value.doubleValue();
-			return doubleValue >= minValue;
+			long longValue = value.longValue();
+			return longValue >= minValue;
 		}
-
 	}
 }
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/NotBlankValidator.java b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/NotBlankValidator.java
new file mode 100644
index 0000000..c6229c3
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/NotBlankValidator.java
@@ -0,0 +1,52 @@
+/*
+ * $Id: NotBlankValidator.java 19090 2010-03-23 15:22:59Z hardy.ferentschik $
+ *
+ * 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.constraints.impl;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+import org.hibernate.validator.constraints.NotBlank;
+
+/**
+ * Check that a string's trimmed length is not empty.
+ *
+ * @author Hardy Ferentschik
+ */
+public class NotBlankValidator implements ConstraintValidator<NotBlank, String> {
+
+	public void initialize(NotBlank annotation) {
+	}
+
+	/**
+	 * Checks that the trimmed string is not empty.
+	 *
+	 * @param s The string to validate.
+	 * @param constraintValidatorContext context in which the constraint is evaluated.
+	 *
+	 * @return Returns <code>true</code> if the string is <code>null</code> or the length of <code>s</code> between the specified
+	 *         <code>min</code> and <code>max</code> values (inclusive), <code>false</code> otherwise.
+	 */
+	public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) {
+		if ( s == null ) {
+			return true;
+		}
+
+		return s.trim().length() > 0;
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/ScriptAssertValidator.java b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/ScriptAssertValidator.java
new file mode 100644
index 0000000..85d722e
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/ScriptAssertValidator.java
@@ -0,0 +1,69 @@
+// $Id: ScriptAssertValidator.java 19251 2010-04-20 15:28:18Z hardy.ferentschik $
+/*
+* 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.constraints.impl;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+import org.hibernate.validator.constraints.ScriptAssert;
+import org.hibernate.validator.constraints.impl.scriptassert.ScriptEvaluator;
+import org.hibernate.validator.constraints.impl.scriptassert.ScriptEvaluatorFactory;
+
+/**
+ * Validator for the {@link ScriptAssert} constraint annotation.
+ *
+ * @author Gunnar Morling.
+ */
+public class ScriptAssertValidator implements ConstraintValidator<ScriptAssert, Object> {
+
+	private String script;
+
+	private String languageName;
+
+	private String alias;
+
+	public void initialize(ScriptAssert constraintAnnotation) {
+
+		validateParameters( constraintAnnotation );
+
+		this.script = constraintAnnotation.script();
+		this.languageName = constraintAnnotation.lang();
+		this.alias = constraintAnnotation.alias();
+	}
+
+	public boolean isValid(Object value, ConstraintValidatorContext constraintValidatorContext) {
+
+		ScriptEvaluator scriptEvaluator = ScriptEvaluatorFactory.getInstance()
+				.getScriptEvaluatorByLanguageName( languageName );
+
+		return scriptEvaluator.evaluate( script, value, alias );
+	}
+
+	private void validateParameters(ScriptAssert constraintAnnotation) {
+
+		if ( constraintAnnotation.script().isEmpty() ) {
+			throw new IllegalArgumentException( "The parameter \"script\" must not be empty." );
+		}
+		if ( constraintAnnotation.lang().isEmpty() ) {
+			throw new IllegalArgumentException( "The parameter \"lang\" must not be empty." );
+		}
+		if ( constraintAnnotation.alias().isEmpty() ) {
+			throw new IllegalArgumentException( "The parameter \"alias\" must not be empty." );
+		}
+	}
+}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/URLValidator.java b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/URLValidator.java
new file mode 100644
index 0000000..568560c
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/URLValidator.java
@@ -0,0 +1,69 @@
+// $Id: URLValidator.java 19527 2010-05-17 12:47:14Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, 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.constraints.impl;
+
+import java.net.MalformedURLException;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+import org.hibernate.validator.constraints.URL;
+
+/**
+ * Validate that the string is a valid URL.
+ *
+ * @author Hardy Ferentschik
+ */
+public class URLValidator implements ConstraintValidator<URL, String> {
+	private String protocol;
+	private String host;
+	private int port;
+
+	public void initialize(URL url) {
+		this.protocol = url.protocol();
+		this.host = url.host();
+		this.port = url.port();
+	}
+
+	public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) {
+		if ( value == null || value.length() == 0 ) {
+			return true;
+		}
+
+		java.net.URL url;
+		try {
+			url = new java.net.URL( value );
+		}
+		catch ( MalformedURLException e ) {
+			return false;
+		}
+
+		if ( protocol != null && protocol.length() > 0 && !url.getProtocol().equals( protocol ) ) {
+			return false;
+		}
+
+		if ( host != null && host.length() > 0 && !url.getHost().equals( host ) ) {
+			return false;
+		}
+
+		if ( port != -1 && url.getPort() != port ) {
+			return false;
+		}
+
+		return true;
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/package.html b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/package.html
index 05960c5..d65c366 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/package.html
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/package.html
@@ -1,27 +1,26 @@
+<!--
+  ~ $Id: package.html 19596 2010-05-24 10:31:09Z hardy.ferentschik $
+  ~
+  ~ 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.
+-->
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html>
 <head>
-<!--
-
-  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.
-
--->
 </head>
 <body>
-This package contains the implementations of the built-in as well as Hibernate Validator specific
-constraints.
+Implementations of the Bean Validation built-in as well as Hibernate Validator specific constraints.
 </body>
 </html>
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/scriptassert/ScriptEvaluator.java b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/scriptassert/ScriptEvaluator.java
new file mode 100644
index 0000000..01b7439
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/scriptassert/ScriptEvaluator.java
@@ -0,0 +1,108 @@
+// $Id: ScriptEvaluator.java 19251 2010-04-20 15:28:18Z hardy.ferentschik $
+/*
+* 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.constraints.impl.scriptassert;
+
+import javax.script.ScriptEngine;
+import javax.script.ScriptException;
+import javax.validation.ConstraintDeclarationException;
+
+/**
+ * A wrapper around JSR 223 {@link ScriptEngine}s. This class is thread-safe.
+ *
+ * @author Gunnar Morling
+ */
+public class ScriptEvaluator {
+
+	private final ScriptEngine engine;
+
+	/**
+	 * Creates a new script executor.
+	 *
+	 * @param engine The engine to be wrapped.
+	 */
+	public ScriptEvaluator(ScriptEngine engine) {
+		this.engine = engine;
+	}
+
+	/**
+	 * Makes the given object available in then engine-scoped script context and executes the given script.
+	 * The execution of the script happens either synchronized or unsynchronized, depending on the engine's
+	 * threading abilities.
+	 *
+	 * @param script The script to be executed.
+	 * @param obj The object to be put into the context.
+	 * @param objectAlias The name under which the given object shall be put into the context.
+	 *
+	 * @return The script's result.
+	 *
+	 * @throws ConstraintDeclarationException In case of any errors during script execution or if the script
+	 *                                        returned null or another type than Boolean.
+	 */
+	public boolean evaluate(String script, Object obj, String objectAlias) {
+
+		if ( engineAllowsParallelAccessFromMultipleThreads() ) {
+			return doEvaluate( script, obj, objectAlias );
+		}
+		else {
+			synchronized ( engine ) {
+				return doEvaluate( script, obj, objectAlias );
+			}
+		}
+	}
+
+	private boolean doEvaluate(String script, Object obj, String objectAlias) {
+
+		engine.put( objectAlias, obj );
+
+		Object evaluationResult;
+
+		try {
+			evaluationResult = engine.eval( script );
+		}
+		catch ( ScriptException e ) {
+			throw new ConstraintDeclarationException(
+					"Error during execution of script \"" + script + "\" occured.", e
+			);
+		}
+
+		if ( evaluationResult == null ) {
+			throw new ConstraintDeclarationException( "Script \"" + script + "\" returned null, but must return either true or false." );
+		}
+
+		if ( !( evaluationResult instanceof Boolean ) ) {
+			throw new ConstraintDeclarationException(
+					"Script \"" + script + "\" returned " + evaluationResult + " (of type " + evaluationResult.getClass()
+							.getCanonicalName() + "), but must return either true or false."
+			);
+		}
+
+		return Boolean.TRUE.equals( evaluationResult );
+	}
+
+	/**
+	 * Checks, whether the given engine is thread-safe or not.
+	 *
+	 * @return True, if the given engine is thread-safe, false otherwise.
+	 */
+	private boolean engineAllowsParallelAccessFromMultipleThreads() {
+
+		String threadingType = ( String ) engine.getFactory().getParameter( "THREADING" );
+
+		return "THREAD-ISOLATED".equals( threadingType ) || "STATELESS".equals( threadingType );
+	}
+}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/scriptassert/ScriptEvaluatorFactory.java b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/scriptassert/ScriptEvaluatorFactory.java
new file mode 100644
index 0000000..e49d80b
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/scriptassert/ScriptEvaluatorFactory.java
@@ -0,0 +1,105 @@
+// $Id: ScriptEvaluatorFactory.java 19251 2010-04-20 15:28:18Z hardy.ferentschik $
+/*
+* 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.constraints.impl.scriptassert;
+
+import java.lang.ref.Reference;
+import java.lang.ref.SoftReference;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.validation.ConstraintDeclarationException;
+
+/**
+ * Factory responsible for the creation of {@link ScriptEvaluator}s. This
+ * class is thread-safe.
+ *
+ * @author Gunnar Morling
+ */
+public class ScriptEvaluatorFactory {
+
+	/**
+	 * A reference with an instance of this factory. Allows the factory to be reused several times, but can be GC'ed if required.
+	 */
+	private static Reference<ScriptEvaluatorFactory> INSTANCE = new SoftReference<ScriptEvaluatorFactory>( new ScriptEvaluatorFactory() );
+
+	/**
+	 * A cache of script executors (keyed by language name).
+	 */
+	private ConcurrentMap<String, ScriptEvaluator> scriptExecutorCache = new ConcurrentHashMap<String, ScriptEvaluator>();
+
+	private ScriptEvaluatorFactory() {
+	}
+
+	/**
+	 * Retrieves an instance of this factory.
+	 *
+	 * @return A script evaluator factory. Never null.
+	 */
+	public static synchronized ScriptEvaluatorFactory getInstance() {
+
+		ScriptEvaluatorFactory theValue = INSTANCE.get();
+
+		if ( theValue == null ) {
+			theValue = new ScriptEvaluatorFactory();
+			INSTANCE = new SoftReference<ScriptEvaluatorFactory>( theValue );
+		}
+
+		return theValue;
+	}
+
+	/**
+	 * Retrieves a script executor for the given language.
+	 *
+	 * @param languageName The name of a scripting language as expected by {@link ScriptEngineManager#getEngineByName(String)}.
+	 *
+	 * @return A script executor for the given language. Never null.
+	 *
+	 * @throws ConstraintDeclarationException In case no JSR 223 compatible engine for the given language could be found.
+	 */
+	public ScriptEvaluator getScriptEvaluatorByLanguageName(String languageName) {
+
+		if ( !scriptExecutorCache.containsKey( languageName ) ) {
+
+			ScriptEvaluator scriptExecutor = createNewScriptEvaluator( languageName );
+			scriptExecutorCache.putIfAbsent( languageName, scriptExecutor );
+		}
+
+		return scriptExecutorCache.get( languageName );
+	}
+
+	/**
+	 * Creates a new script executor for the given language.
+	 *
+	 * @param languageName A JSR 223 language name.
+	 *
+	 * @return A newly created script executor for the given language.
+	 */
+	private ScriptEvaluator createNewScriptEvaluator(String languageName) {
+
+		ScriptEngine engine = new ScriptEngineManager().getEngineByName( languageName );
+
+		if ( engine == null ) {
+			throw new ConstraintDeclarationException(
+					"No JSR 223 script engine found for language \"" + languageName + "\"."
+			);
+		}
+
+		return new ScriptEvaluator( engine );
+	}
+}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/scriptassert/package.html b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/scriptassert/package.html
new file mode 100644
index 0000000..c207acc
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/impl/scriptassert/package.html
@@ -0,0 +1,26 @@
+<!--
+  ~ $Id: package.html 19596 2010-05-24 10:31:09Z hardy.ferentschik $
+  ~
+  ~ 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.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+<head>
+</head>
+<body>
+Classes related to the evaluation of the @ScriptAssert constraint.
+</body>
+</html>
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/package.html b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/package.html
index f8b055b..f894a55 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/constraints/package.html
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/constraints/package.html
@@ -1,26 +1,27 @@
+<!--
+  ~ $Id: package.html 19596 2010-05-24 10:31:09Z hardy.ferentschik $
+  ~
+  ~ 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.
+-->
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html>
 <head>
-<!--
-
-  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.
-
--->
 </head>
 <body>
-This package contains the Hibernate Validator specific constraints.
+Hibernate Validator specific constraints. Classes in this package are part of the public Hibernate
+Validator API.
 </body>
 </html>
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/engine/ConfigurationImpl.java b/hibernate-validator/src/main/java/org/hibernate/validator/engine/ConfigurationImpl.java
index 989317a..d92bf68 100755
--- a/hibernate-validator/src/main/java/org/hibernate/validator/engine/ConfigurationImpl.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/engine/ConfigurationImpl.java
@@ -1,7 +1,7 @@
-// $Id: ConfigurationImpl.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: ConfigurationImpl.java 19642 2010-06-01 12:53:13Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
+* 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.
 *
@@ -17,7 +17,9 @@
 */
 package org.hibernate.validator.engine;
 
+import java.io.IOException;
 import java.io.InputStream;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -33,18 +35,23 @@ import javax.validation.spi.ValidationProvider;
 
 import org.slf4j.Logger;
 
+import org.hibernate.validator.HibernateValidatorConfiguration;
+import org.hibernate.validator.cfg.ConstraintMapping;
 import org.hibernate.validator.engine.resolver.DefaultTraversableResolver;
+import org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator;
+import org.hibernate.validator.resourceloading.PlatformResourceBundleLocator;
+import org.hibernate.validator.resourceloading.ResourceBundleLocator;
 import org.hibernate.validator.util.LoggerFactory;
 import org.hibernate.validator.util.Version;
 import org.hibernate.validator.xml.ValidationBootstrapParameters;
 import org.hibernate.validator.xml.ValidationXmlParser;
-import org.hibernate.validator.HibernateValidatorConfiguration;
 
 /**
- * Hibernate specific <code>Configuration</code> implementation.
+ * Hibernate specific {@code Configuration} implementation.
  *
  * @author Emmanuel Bernard
  * @author Hardy Ferentschik
+ * @author Gunnar Morling
  */
 public class ConfigurationImpl implements HibernateValidatorConfiguration, ConfigurationState {
 
@@ -54,13 +61,20 @@ public class ConfigurationImpl implements HibernateValidatorConfiguration, Confi
 
 	private static final Logger log = LoggerFactory.make();
 
-	private final MessageInterpolator defaultMessageInterpolator = new ResourceBundleMessageInterpolator();
+	private final ResourceBundleLocator defaultResourceBundleLocator = new PlatformResourceBundleLocator(
+			ResourceBundleMessageInterpolator.USER_VALIDATION_MESSAGES
+	);
+	private final MessageInterpolator defaultMessageInterpolator = new ResourceBundleMessageInterpolator(
+			defaultResourceBundleLocator
+	);
 	private final TraversableResolver defaultTraversableResolver = new DefaultTraversableResolver();
 	private final ConstraintValidatorFactory defaultConstraintValidatorFactory = new ConstraintValidatorFactoryImpl();
 	private final ValidationProviderResolver providerResolver;
 
 	private ValidationBootstrapParameters validationBootstrapParameters;
 	private boolean ignoreXmlConfiguration = false;
+	private Set<InputStream> configurationStreams = new HashSet<InputStream>();
+	private ConstraintMapping mapping;
 
 	public ConfigurationImpl(BootstrapState state) {
 		if ( state.getValidationProviderResolver() == null ) {
@@ -102,10 +116,21 @@ public class ConfigurationImpl implements HibernateValidatorConfiguration, Confi
 	}
 
 	public HibernateValidatorConfiguration addMapping(InputStream stream) {
+		if ( stream == null ) {
+			throw new IllegalArgumentException( "The stream cannot be null." );
+		}
 		validationBootstrapParameters.mappings.add( stream );
 		return this;
 	}
 
+	public HibernateValidatorConfiguration addMapping(ConstraintMapping mapping) {
+		if ( mapping == null ) {
+			throw new IllegalArgumentException( "The mapping cannot be null." );
+		}
+		this.mapping = mapping;
+		return this;
+	}
+
 	public HibernateValidatorConfiguration addProperty(String name, String value) {
 		if ( value != null ) {
 			validationBootstrapParameters.configProperties.put( name, value );
@@ -113,29 +138,43 @@ public class ConfigurationImpl implements HibernateValidatorConfiguration, Confi
 		return this;
 	}
 
+
 	public ValidatorFactory buildValidatorFactory() {
 		parseValidationXml();
 		ValidatorFactory factory = null;
-		if ( isSpecificProvider() ) {
-			factory = validationBootstrapParameters.provider.buildValidatorFactory( this );
-		}
-		else {
-			final Class<? extends ValidationProvider<?>> providerClass = validationBootstrapParameters.providerClass;
-			if ( providerClass != null ) {
-				for ( ValidationProvider provider : providerResolver.getValidationProviders() ) {
-					if ( providerClass.isAssignableFrom( provider.getClass() ) ) {
-						factory = provider.buildValidatorFactory( this );
-						break;
+		try {
+			if ( isSpecificProvider() ) {
+				factory = validationBootstrapParameters.provider.buildValidatorFactory( this );
+			}
+			else {
+				final Class<? extends ValidationProvider<?>> providerClass = validationBootstrapParameters.providerClass;
+				if ( providerClass != null ) {
+					for ( ValidationProvider provider : providerResolver.getValidationProviders() ) {
+						if ( providerClass.isAssignableFrom( provider.getClass() ) ) {
+							factory = provider.buildValidatorFactory( this );
+							break;
+						}
+					}
+					if ( factory == null ) {
+						throw new ValidationException( "Unable to find provider: " + providerClass );
 					}
 				}
-				if ( factory == null ) {
-					throw new ValidationException( "Unable to find provider: " + providerClass );
+				else {
+					List<ValidationProvider<?>> providers = providerResolver.getValidationProviders();
+					assert providers.size() != 0; // I run therefore I am
+					factory = providers.get( 0 ).buildValidatorFactory( this );
 				}
 			}
-			else {
-				List<ValidationProvider<?>> providers = providerResolver.getValidationProviders();
-				assert providers.size() != 0; // I run therefore I am
-				factory = providers.get( 0 ).buildValidatorFactory( this );
+		}
+		finally {
+			// close all input streams opened by this configuration
+			for ( InputStream in : configurationStreams ) {
+				try {
+					in.close();
+				}
+				catch ( IOException io ) {
+					log.warn( "Unable to close input stream." );
+				}
 			}
 		}
 
@@ -180,6 +219,14 @@ public class ConfigurationImpl implements HibernateValidatorConfiguration, Confi
 		return defaultConstraintValidatorFactory;
 	}
 
+	public ResourceBundleLocator getDefaultResourceBundleLocator() {
+		return defaultResourceBundleLocator;
+	}
+
+	public ConstraintMapping getMapping() {
+		return mapping;
+	}
+
 	private boolean isSpecificProvider() {
 		return validationBootstrapParameters.provider != null;
 	}
@@ -238,6 +285,7 @@ public class ConfigurationImpl implements HibernateValidatorConfiguration, Confi
 		}
 
 		validationBootstrapParameters.mappings.addAll( xmlParameters.mappings );
+		configurationStreams.addAll( xmlParameters.mappings );
 
 		for ( Map.Entry<String, String> entry : xmlParameters.configProperties.entrySet() ) {
 			if ( validationBootstrapParameters.configProperties.get( entry.getKey() ) == null ) {
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/engine/ConstraintTree.java b/hibernate-validator/src/main/java/org/hibernate/validator/engine/ConstraintTree.java
index 1096a74..9dbe98e 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/engine/ConstraintTree.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/engine/ConstraintTree.java
@@ -1,20 +1,24 @@
-// $Id: ConstraintTree.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
 /*
-* 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.
-*/
+ * $Id: ConstraintTree.java 19781 2010-06-22 16:30:24Z hardy.ferentschik $
+ *
+ * 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.
+ */
+
+// $Id: ConstraintTree.java 19781 2010-06-22 16:30:24Z hardy.ferentschik $
+
 package org.hibernate.validator.engine;
 
 import java.lang.annotation.Annotation;
@@ -53,6 +57,8 @@ public class ConstraintTree<A extends Annotation> {
 	private final List<ConstraintTree<?>> children;
 	private final ConstraintDescriptorImpl<A> descriptor;
 
+	private final Map<Type, Class<? extends ConstraintValidator<?, ?>>> validatorTypes;
+
 	private final Map<ValidatorCacheKey, ConstraintValidator<A, ?>> constraintValidatorCache;
 
 	public ConstraintTree(ConstraintDescriptorImpl<A> descriptor) {
@@ -68,13 +74,15 @@ public class ConstraintTree<A extends Annotation> {
 		for ( ConstraintDescriptor<?> composingConstraint : descriptor.getComposingConstraints() ) {
 			composingConstraints.add( ( ConstraintDescriptorImpl<?> ) composingConstraint );
 		}
-		
+
 		children = new ArrayList<ConstraintTree<?>>( composingConstraints.size() );
 
 		for ( ConstraintDescriptorImpl<?> composingDescriptor : composingConstraints ) {
 			ConstraintTree<?> treeNode = createConstraintTree( composingDescriptor );
 			children.add( treeNode );
 		}
+
+		validatorTypes = ValidatorTypeHelper.getValidatorsTypes( descriptor.getConstraintValidatorClasses() );
 	}
 
 	private <U extends Annotation> ConstraintTree<U> createConstraintTree(ConstraintDescriptorImpl<U> composingDescriptor) {
@@ -89,24 +97,38 @@ public class ConstraintTree<A extends Annotation> {
 		return descriptor;
 	}
 
-	public <T, U, V> void validateConstraints(Type type, GlobalExecutionContext<T> executionContext, LocalExecutionContext<U, V> localExecutionContext, List<ConstraintViolation<T>> constraintViolations) {
-		// first validate composing constraints
+	public <T, U, V> void validateConstraints(Type type, ValidationContext<T> executionContext, ValueContext<U, V> valueContext, List<ConstraintViolation<T>> constraintViolations) {
+		// first validate composing constraints (recursively)
 		for ( ConstraintTree<?> tree : getChildren() ) {
 			List<ConstraintViolation<T>> tmpViolations = new ArrayList<ConstraintViolation<T>>();
-			tree.validateConstraints( type, executionContext, localExecutionContext, tmpViolations );
+			tree.validateConstraints( type, executionContext, valueContext, tmpViolations );
 			constraintViolations.addAll( tmpViolations );
 		}
 
 		ConstraintValidatorContextImpl constraintValidatorContext = new ConstraintValidatorContextImpl(
-				localExecutionContext.getPropertyPath(), descriptor
+				valueContext.getPropertyPath(), descriptor
 		);
 
+		// check whether we have constraints violations, but we should only report the single message of the
+		// main constraint. We already have to generate the message here, since the composing constraints might
+		// not have its own ConstraintValidator.
+		// Also we want to leave it open to the final ConstraintValidator to generate a custom message. 
+		if ( constraintViolations.size() > 0 && reportAsSingleViolation() ) {
+			constraintViolations.clear();
+			final String message = ( String ) getDescriptor().getAttributes().get( "message" );
+			MessageAndPath messageAndPath = new MessageAndPath( message, valueContext.getPropertyPath() );
+			ConstraintViolation<T> violation = executionContext.createConstraintViolation(
+					valueContext, messageAndPath, descriptor
+			);
+			constraintViolations.add( violation );
+		}
+
 		// we could have a composing constraint which does not need its own validator.
 		if ( !descriptor.getConstraintValidatorClasses().isEmpty() ) {
 			if ( log.isTraceEnabled() ) {
 				log.trace(
 						"Validating value {} against constraint defined by {}",
-						localExecutionContext.getCurrentValidatedValue(),
+						valueContext.getCurrentValidatedValue(),
 						descriptor
 				);
 			}
@@ -117,28 +139,18 @@ public class ConstraintTree<A extends Annotation> {
 
 			validateSingleConstraint(
 					executionContext,
-					localExecutionContext,
+					valueContext,
 					constraintViolations,
 					constraintValidatorContext,
 					validator
 			);
 		}
-
-		if ( reportAsSingleViolation() && constraintViolations.size() > 0 ) {
-			constraintViolations.clear();
-			final String message = ( String ) getDescriptor().getAttributes().get( "message" );
-			MessageAndPath messageAndPath = new MessageAndPath( message, localExecutionContext.getPropertyPath() );
-			ConstraintViolation<T> violation = executionContext.createConstraintViolation(
-					localExecutionContext, messageAndPath, descriptor
-			);
-			constraintViolations.add( violation );
-		}
 	}
 
-	private <T, U, V> void validateSingleConstraint(GlobalExecutionContext<T> executionContext, LocalExecutionContext<U, V> localExecutionContext, List<ConstraintViolation<T>> constraintViolations, ConstraintValidatorContextImpl constraintValidatorContext, ConstraintValidator<A, V> validator) {
+	private <T, U, V> void validateSingleConstraint(ValidationContext<T> executionContext, ValueContext<U, V> valueContext, List<ConstraintViolation<T>> constraintViolations, ConstraintValidatorContextImpl constraintValidatorContext, ConstraintValidator<A, V> validator) {
 		boolean isValid;
 		try {
-			isValid = validator.isValid( localExecutionContext.getCurrentValidatedValue(), constraintValidatorContext );
+			isValid = validator.isValid( valueContext.getCurrentValidatedValue(), constraintValidatorContext );
 		}
 		catch ( RuntimeException e ) {
 			throw new ValidationException( "Unexpected exception during isValid call", e );
@@ -146,7 +158,7 @@ public class ConstraintTree<A extends Annotation> {
 		if ( !isValid ) {
 			constraintViolations.addAll(
 					executionContext.createConstraintViolations(
-							localExecutionContext, constraintValidatorContext
+							valueContext, constraintValidatorContext
 					)
 			);
 		}
@@ -209,11 +221,7 @@ public class ConstraintTree<A extends Annotation> {
 	 * @return The class of a matching validator.
 	 */
 	private Class<? extends ConstraintValidator<?, ?>> findMatchingValidatorClass(Type type) {
-		Map<Type, Class<? extends ConstraintValidator<?, ?>>> validatorTypes =
-				ValidatorTypeHelper.getValidatorsTypes( descriptor.getConstraintValidatorClasses() );
-
-		List<Type> suitableTypes = new ArrayList<Type>();
-		findSuitableValidatorTypes( type, validatorTypes, suitableTypes );
+		List<Type> suitableTypes = findSuitableValidatorTypes( type );
 
 		resolveAssignableTypes( suitableTypes );
 		verifyResolveWasUnique( type, suitableTypes );
@@ -249,12 +257,14 @@ public class ConstraintTree<A extends Annotation> {
 		}
 	}
 
-	private void findSuitableValidatorTypes(Type type, Map<Type, Class<? extends ConstraintValidator<?, ?>>> validatorsTypes, List<Type> suitableTypes) {
-		for ( Type validatorType : validatorsTypes.keySet() ) {
+	private List<Type> findSuitableValidatorTypes(Type type) {
+		List<Type> suitableTypes = new ArrayList<Type>();
+		for ( Type validatorType : validatorTypes.keySet() ) {
 			if ( TypeUtils.isAssignable( validatorType, type ) && !suitableTypes.contains( validatorType ) ) {
 				suitableTypes.add( validatorType );
 			}
 		}
+		return suitableTypes;
 	}
 
 	/**
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/engine/ConstraintValidatorFactoryImpl.java b/hibernate-validator/src/main/java/org/hibernate/validator/engine/ConstraintValidatorFactoryImpl.java
index 31d7a33..8ce550c 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/engine/ConstraintValidatorFactoryImpl.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/engine/ConstraintValidatorFactoryImpl.java
@@ -1,4 +1,4 @@
-// $Id: ConstraintValidatorFactoryImpl.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: ConstraintValidatorFactoryImpl.java 19573 2010-05-20 22:13:26Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -17,11 +17,10 @@
 */
 package org.hibernate.validator.engine;
 
-import java.security.AccessController;
 import javax.validation.ConstraintValidator;
 import javax.validation.ConstraintValidatorFactory;
 
-import org.hibernate.validator.util.NewInstance;
+import org.hibernate.validator.util.ReflectionHelper;
 
 /**
  * Default <code>ConstraintValidatorFactory</code> using a no-arg constructor.
@@ -32,12 +31,6 @@ import org.hibernate.validator.util.NewInstance;
 public class ConstraintValidatorFactoryImpl implements ConstraintValidatorFactory {
 
 	public <T extends ConstraintValidator<?, ?>> T getInstance(Class<T> key) {
-		NewInstance<T> newInstance = NewInstance.action( key, "" );
-		if ( System.getSecurityManager() != null ) {
-			return AccessController.doPrivileged( newInstance );
-		}
-		else {
-			return newInstance.run();
-		}
+		return ReflectionHelper.newInstance( key, "" );
 	}
 }
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/engine/ConstraintViolationImpl.java b/hibernate-validator/src/main/java/org/hibernate/validator/engine/ConstraintViolationImpl.java
index 89532c8..6cbf189 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/engine/ConstraintViolationImpl.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/engine/ConstraintViolationImpl.java
@@ -1,4 +1,4 @@
-// $Id: ConstraintViolationImpl.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: ConstraintViolationImpl.java 19021 2010-03-18 18:17:05Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -86,6 +86,7 @@ public class ConstraintViolationImpl<T> implements ConstraintViolation<T>, java.
 
 	@Override
 	@SuppressWarnings("SimplifiableIfStatement")
+	// IMPORTANT - some behaviour of Validator depends on the correct implementation of this equals method!
 	public boolean equals(Object o) {
 		if ( this == o ) {
 			return true;
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/engine/GlobalExecutionContext.java b/hibernate-validator/src/main/java/org/hibernate/validator/engine/GlobalExecutionContext.java
deleted file mode 100644
index ef21e91..0000000
--- a/hibernate-validator/src/main/java/org/hibernate/validator/engine/GlobalExecutionContext.java
+++ /dev/null
@@ -1,266 +0,0 @@
-// $Id: GlobalExecutionContext.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.engine;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.IdentityHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.validation.ConstraintValidatorFactory;
-import javax.validation.ConstraintViolation;
-import javax.validation.MessageInterpolator;
-import javax.validation.TraversableResolver;
-import javax.validation.metadata.ConstraintDescriptor;
-
-import org.hibernate.validator.util.IdentitySet;
-
-/**
- * Context object keeping track of all important data for a top level {@link javax.validation.Validator#validate(Object, Class[])} },
- * {@link javax.validation.Validator#validateValue(Class, String, Object, Class[])}  } or {@link javax.validation.Validator#validateProperty(Object, String, Class[])}  call.
- * <p/>
- * we use this object to collect all failing constraints, but also to cache the caching traversable resolver for a full stack call.
- *
- * @author Hardy Ferentschik
- * @author Emmanuel Bernard
- */
-public class GlobalExecutionContext<T> {
-
-	/**
-	 * The root bean of the validation.
-	 */
-	private final T rootBean;
-
-	/**
-	 * The root bean class of the validation.
-	 */
-	private final Class<T> rootBeanClass;
-
-	/**
-	 * Maps a group to an identity set to keep track of already validated objects. We have to make sure
-	 * that each object gets only validated once per group and property path.
-	 */
-	private final Map<Class<?>, IdentitySet> processedObjects;
-
-	/**
-	 * Maps an object to a list of paths in which it has been invalidated.
-	 */
-	private final Map<Object, Set<PathImpl>> processedPaths;
-
-	/**
-	 * A list of all failing constraints so far.
-	 */
-	private final List<ConstraintViolation<T>> failingConstraintViolations;
-
-	/**
-	 * Flag indicating whether an object can only be validated once per group or once per group AND validation path.
-	 *
-	 * @todo Make this boolean a configurable item.
-	 */
-	private boolean allowOneValidationPerPath = true;
-
-	/**
-	 * The message resolver which should be used in this context.
-	 */
-	private final MessageInterpolator messageInterpolator;
-
-	/**
-	 * The constraint factory which should be used in this context.
-	 */
-	private final ConstraintValidatorFactory constraintValidatorFactory;
-
-	/**
-	 * Allows a JPA provider to decide whether a property should be validated.
-	 */
-	private final TraversableResolver traversableResolver;
-
-	public static <T> GlobalExecutionContext<T> getContextForValidate(T object, MessageInterpolator messageInterpolator, ConstraintValidatorFactory constraintValidatorFactory, TraversableResolver traversableResolver) {
-		@SuppressWarnings("unchecked")
-		Class<T> rootBeanClass = ( Class<T> ) object.getClass();
-		return new GlobalExecutionContext<T>(
-				rootBeanClass, object, messageInterpolator, constraintValidatorFactory, traversableResolver
-		);
-	}
-
-	public static <T> GlobalExecutionContext<T> getContextForValidateProperty(T rootBean, MessageInterpolator messageInterpolator, ConstraintValidatorFactory constraintValidatorFactory, TraversableResolver traversableResolver) {
-		@SuppressWarnings("unchecked")
-		Class<T> rootBeanClass = ( Class<T> ) rootBean.getClass();
-		return new GlobalExecutionContext<T>(
-				rootBeanClass, rootBean, messageInterpolator, constraintValidatorFactory, traversableResolver
-		);
-	}
-
-	public static <T> GlobalExecutionContext<T> getContextForValidateValue(Class<T> rootBeanClass, MessageInterpolator messageInterpolator, ConstraintValidatorFactory constraintValidatorFactory, TraversableResolver traversableResolver) {
-		return new GlobalExecutionContext<T>(
-				rootBeanClass,
-				null,
-				messageInterpolator,
-				constraintValidatorFactory,
-				traversableResolver
-		);
-	}
-
-	private GlobalExecutionContext(Class<T> rootBeanClass, T rootBean, MessageInterpolator messageInterpolator, ConstraintValidatorFactory constraintValidatorFactory, TraversableResolver traversableResolver) {
-		this.rootBean = rootBean;
-		this.rootBeanClass = rootBeanClass;
-		this.messageInterpolator = messageInterpolator;
-		this.constraintValidatorFactory = constraintValidatorFactory;
-		this.traversableResolver = traversableResolver;
-
-		processedObjects = new HashMap<Class<?>, IdentitySet>();
-		processedPaths = new IdentityHashMap<Object, Set<PathImpl>>();
-		failingConstraintViolations = new ArrayList<ConstraintViolation<T>>();
-	}
-
-	public T getRootBean() {
-		return rootBean;
-	}
-
-	public Class<T> getRootBeanClass() {
-		return rootBeanClass;
-	}
-
-	public TraversableResolver getTraversableResolver() {
-		return traversableResolver;
-	}
-
-	public MessageInterpolator getMessageInterpolator() {
-		return messageInterpolator;
-	}
-
-	public <U, V> ConstraintViolationImpl<T> createConstraintViolation(LocalExecutionContext<U, V> localContext, MessageAndPath messageAndPath, ConstraintDescriptor<?> descriptor) {
-		String messageTemplate = messageAndPath.getMessage();
-		String interpolatedMessage = messageInterpolator.interpolate(
-				messageTemplate,
-				new MessageInterpolatorContext( descriptor, localContext.getCurrentBean() )
-		);
-		return new ConstraintViolationImpl<T>(
-				messageTemplate,
-				interpolatedMessage,
-				getRootBeanClass(),
-				getRootBean(),
-				localContext.getCurrentBean(),
-				localContext.getCurrentValidatedValue(),
-				messageAndPath.getPath(),
-				descriptor,
-				localContext.getElementType()
-		);
-	}
-
-	public <U, V> List<ConstraintViolationImpl<T>> createConstraintViolations(LocalExecutionContext<U, V> localContext, ConstraintValidatorContextImpl constraintValidatorContext) {
-		List<ConstraintViolationImpl<T>> constraintViolations = new ArrayList<ConstraintViolationImpl<T>>();
-		for ( MessageAndPath messageAndPath : constraintValidatorContext.getMessageAndPathList() ) {
-			ConstraintViolationImpl<T> violation = createConstraintViolation(
-					localContext, messageAndPath, constraintValidatorContext.getConstraintDescriptor()
-			);
-			constraintViolations.add( violation );
-		}
-		return constraintViolations;
-	}
-
-	public ConstraintValidatorFactory getConstraintValidatorFactory() {
-		return constraintValidatorFactory;
-	}
-
-	public boolean isAlreadyValidated(Object value, Class<?> group, PathImpl path) {
-		boolean alreadyValidated;
-		alreadyValidated = isAlreadyValidatedForCurrentGroup( value, group );
-
-		if ( alreadyValidated && allowOneValidationPerPath ) {
-			alreadyValidated = isAlreadyValidatedForPath( value, path );
-		}
-		return alreadyValidated;
-	}
-
-	public void markProcessed(Object value, Class<?> group, PathImpl path) {
-		markProcessForCurrentGroup( value, group );
-		if ( allowOneValidationPerPath ) {
-			markProcessedForCurrentPath( value, path );
-		}
-	}
-
-	private void addConstraintFailure(ConstraintViolation<T> failingConstraintViolation) {
-		// NOTE: we are relying on the fact that ConstraintViolation.equals() is implemented correctly.
-		int i = failingConstraintViolations.indexOf( failingConstraintViolation );
-		if ( i == -1 ) {
-			failingConstraintViolations.add( failingConstraintViolation );
-		}
-	}
-
-	public void addConstraintFailures(List<ConstraintViolation<T>> failingConstraintViolations) {
-		for ( ConstraintViolation<T> violation : failingConstraintViolations ) {
-			addConstraintFailure( violation );
-		}
-	}
-
-	public List<ConstraintViolation<T>> getFailingConstraints() {
-		return failingConstraintViolations;
-	}
-
-	private boolean isAlreadyValidatedForPath(Object value, PathImpl path) {
-		Set<PathImpl> pathSet = processedPaths.get( value );
-		if ( pathSet == null ) {
-			return false;
-		}
-
-		for ( PathImpl p : pathSet ) {
-			if ( p.isRootPath() || path.isRootPath() || p.isSubPathOf( path ) || path.isSubPathOf( p ) ) {
-				return true;
-			}
-		}
-
-		return false;
-	}
-
-	private boolean isAlreadyValidatedForCurrentGroup(Object value, Class<?> group) {
-		final IdentitySet objectsProcessedInCurrentGroups = processedObjects.get( group );
-		return objectsProcessedInCurrentGroups != null && objectsProcessedInCurrentGroups.contains( value );
-	}
-
-	private void markProcessedForCurrentPath(Object value, PathImpl path) {
-		// hmm - not sure if the current definiton of Path and Node are consistent. Shouldn't a simple property
-		// of a entity have a parent node?
-		PathImpl parentPath = path.getPathWithoutLeafNode();
-		if ( parentPath == null ) {
-			parentPath = PathImpl.createNewPath( null );
-		}
-
-		if ( processedPaths.containsKey( value ) ) {
-			processedPaths.get( value ).add( parentPath );
-		}
-		else {
-			Set<PathImpl> set = new HashSet<PathImpl>();
-			set.add( parentPath );
-			processedPaths.put( value, set );
-		}
-	}
-
-
-	private void markProcessForCurrentGroup(Object value, Class<?> group) {
-		if ( processedObjects.containsKey( group ) ) {
-			processedObjects.get( group ).add( value );
-		}
-		else {
-			IdentitySet set = new IdentitySet();
-			set.add( value );
-			processedObjects.put( group, set );
-		}
-	}
-}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/engine/LocalExecutionContext.java b/hibernate-validator/src/main/java/org/hibernate/validator/engine/LocalExecutionContext.java
deleted file mode 100644
index 2f3a0d8..0000000
--- a/hibernate-validator/src/main/java/org/hibernate/validator/engine/LocalExecutionContext.java
+++ /dev/null
@@ -1,136 +0,0 @@
-// $Id: LocalExecutionContext.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.engine;
-
-import java.lang.annotation.ElementType;
-import javax.validation.groups.Default;
-
-/**
- * An instance of this class is used to collect all the relevant information for validating a single entity/bean.
- *
- * @author Hardy Ferentschik
- */
-public class LocalExecutionContext<T, V> {
-
-	/**
-	 * The current bean which gets validated. This is the bean hosting the constraints which get validated.
-	 */
-	private final T currentBean;
-
-	/**
-	 * The class of the current bean.
-	 */
-	private final Class<T> currentBeanType;
-
-	/**
-	 * The current property path we are validating.
-	 */
-	private PathImpl propertyPath;
-
-	/**
-	 * The current group we are validating.
-	 */
-	private Class<?> currentGroup;
-
-	/**
-	 * The value which gets currently evaluated.
-	 */
-	private V currentValue;
-
-	/**
-	 * The {@code ElementType} the constraint was defined on
-	 */
-	private ElementType elementType;
-
-	public static <T, V> LocalExecutionContext<T, V> getLocalExecutionContext(T value) {
-		@SuppressWarnings("unchecked")
-		Class<T> rootBeanClass = ( Class<T> ) value.getClass();
-		return new LocalExecutionContext<T, V>( value, rootBeanClass );
-	}
-
-	public static <T, V> LocalExecutionContext<T, V> getLocalExecutionContext(Class<T> type) {
-		return new LocalExecutionContext<T, V>( null, type );
-	}
-
-	public LocalExecutionContext(T currentBean, Class<T> currentBeanType) {
-		this.currentBean = currentBean;
-		this.currentBeanType = currentBeanType;
-	}
-
-	public PathImpl getPropertyPath() {
-		return propertyPath;
-	}
-
-	public Class<?> getCurrentGroup() {
-		return currentGroup;
-	}
-
-	public T getCurrentBean() {
-		return currentBean;
-	}
-
-	public Class<T> getCurrentBeanType() {
-		return currentBeanType;
-	}
-
-	public V getCurrentValidatedValue() {
-		return currentValue;
-	}
-
-	public void setPropertyPath(PathImpl propertyPath) {
-		this.propertyPath = propertyPath;
-	}
-
-	public void setCurrentGroup(Class<?> currentGroup) {
-		this.currentGroup = currentGroup;
-	}
-
-	public void setCurrentValidatedValue(V currentValue) {
-		this.currentValue = currentValue;
-	}
-
-	public void markCurrentPropertyAsIterable() {
-		propertyPath.getLeafNode().setInIterable( true );
-	}
-
-	public boolean validatingDefault() {
-		return getCurrentGroup() != null && getCurrentGroup().getName().equals( Default.class.getName() );
-	}
-
-	public ElementType getElementType() {
-		return elementType;
-	}
-
-	public void setElementType(ElementType elementType) {
-		this.elementType = elementType;
-	}
-
-	@Override
-	public String toString() {
-		final StringBuilder sb = new StringBuilder();
-		sb.append( "LocalExecutionContext" );
-		sb.append( "{currentBean=" ).append( currentBean );
-		sb.append( ", currentBeanType=" ).append( currentBeanType );
-		sb.append( ", propertyPath=" ).append( propertyPath );
-		sb.append( ", currentGroup=" ).append( currentGroup );
-		sb.append( ", currentValue=" ).append( currentValue );
-		sb.append( ", elementType=" ).append( elementType );
-		sb.append( '}' );
-		return sb.toString();
-	}
-}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/engine/MessageInterpolatorContext.java b/hibernate-validator/src/main/java/org/hibernate/validator/engine/MessageInterpolatorContext.java
index 72b7c41..8a07a84 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/engine/MessageInterpolatorContext.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/engine/MessageInterpolatorContext.java
@@ -1,4 +1,4 @@
-// $Id: MessageInterpolatorContext.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: MessageInterpolatorContext.java 19735 2010-06-15 09:40:40Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -21,9 +21,10 @@ import javax.validation.metadata.ConstraintDescriptor;
 import javax.validation.MessageInterpolator;
 
 /**
- * Takes mandatory elements in the constructor
+ * Implementation of the context used during message interpolation.
  *
  * @author Emmanuel Bernard
+ * @author Hardy Ferentschik
  */
 public class MessageInterpolatorContext implements MessageInterpolator.Context {
 	private final ConstraintDescriptor<?> constraintDescriptor;
@@ -41,4 +42,42 @@ public class MessageInterpolatorContext implements MessageInterpolator.Context {
 	public Object getValidatedValue() {
 		return validatedValue;
 	}
+
+	@Override
+	public boolean equals(Object o) {
+		if ( this == o ) {
+			return true;
+		}
+		if ( o == null || getClass() != o.getClass() ) {
+			return false;
+		}
+
+		MessageInterpolatorContext that = ( MessageInterpolatorContext ) o;
+
+		if ( constraintDescriptor != null ? !constraintDescriptor.equals( that.constraintDescriptor ) : that.constraintDescriptor != null ) {
+			return false;
+		}
+		if ( validatedValue != null ? !validatedValue.equals( that.validatedValue ) : that.validatedValue != null ) {
+			return false;
+		}
+
+		return true;
+	}
+
+	@Override
+	public int hashCode() {
+		int result = constraintDescriptor != null ? constraintDescriptor.hashCode() : 0;
+		result = 31 * result + ( validatedValue != null ? validatedValue.hashCode() : 0 );
+		return result;
+	}
+
+	@Override
+	public String toString() {
+		final StringBuilder sb = new StringBuilder();
+		sb.append( "MessageInterpolatorContext" );
+		sb.append( "{constraintDescriptor=" ).append( constraintDescriptor );
+		sb.append( ", validatedValue=" ).append( validatedValue );
+		sb.append( '}' );
+		return sb.toString();
+	}
 }
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/engine/ResourceBundleMessageInterpolator.java b/hibernate-validator/src/main/java/org/hibernate/validator/engine/ResourceBundleMessageInterpolator.java
deleted file mode 100644
index 4886a82..0000000
--- a/hibernate-validator/src/main/java/org/hibernate/validator/engine/ResourceBundleMessageInterpolator.java
+++ /dev/null
@@ -1,347 +0,0 @@
-// $Id: ResourceBundleMessageInterpolator.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.engine;
-
-import java.security.AccessController;
-import java.util.Locale;
-import java.util.Map;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-import java.util.WeakHashMap;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import javax.validation.MessageInterpolator;
-
-import org.slf4j.Logger;
-
-import org.hibernate.validator.util.GetClassLoader;
-import org.hibernate.validator.util.LoggerFactory;
-
-/**
- * Resource bundle backed message interpolator.
- *
- * @author Emmanuel Bernard
- * @author Hardy Ferentschik
- */
-public class ResourceBundleMessageInterpolator implements MessageInterpolator {
-	private static final String DEFAULT_VALIDATION_MESSAGES = "org.hibernate.validator.ValidationMessages";
-	private static final String USER_VALIDATION_MESSAGES = "ValidationMessages";
-	private static final Logger log = LoggerFactory.make();
-
-	/**
-	 * Regular expression used to do message interpolation.
-	 */
-	private static final Pattern messageParameterPattern = Pattern.compile( "(\\{[^\\}]+?\\})" );
-
-	/**
-	 * The default locale for the current user.
-	 */
-	private final Locale defaultLocale;
-
-	/**
-	 * User specified resource bundles hashed against their locale.
-	 */
-	private final Map<Locale, ResourceBundle> userBundlesMap = new ConcurrentHashMap<Locale, ResourceBundle>();
-
-	/**
-	 * Built-in resource bundles hashed against there locale.
-	 */
-	private final Map<Locale, ResourceBundle> defaultBundlesMap = new ConcurrentHashMap<Locale, ResourceBundle>();
-
-	/**
-	 * Step 1-3 of message interpolation can be cached. We do this in this map.
-	 */
-	private final Map<LocalisedMessage, String> resolvedMessages = new WeakHashMap<LocalisedMessage, String>();
-
-	public ResourceBundleMessageInterpolator() {
-		this( null );
-	}
-
-	public ResourceBundleMessageInterpolator(ResourceBundle resourceBundle) {
-
-		defaultLocale = Locale.getDefault();
-
-		if ( resourceBundle == null ) {
-			ResourceBundle bundle = getFileBasedResourceBundle( defaultLocale );
-			if ( bundle != null ) {
-				userBundlesMap.put( defaultLocale, bundle );
-			}
-
-		}
-		else {
-			userBundlesMap.put( defaultLocale, resourceBundle );
-		}
-
-		defaultBundlesMap.put( defaultLocale, ResourceBundle.getBundle( DEFAULT_VALIDATION_MESSAGES, defaultLocale ) );
-	}
-
-	public String interpolate(String message, Context context) {
-		// probably no need for caching, but it could be done by parameters since the map
-		// is immutable and uniquely built per Validation definition, the comparison has to be based on == and not equals though
-		return interpolateMessage( message, context.getConstraintDescriptor().getAttributes(), defaultLocale );
-	}
-
-	public String interpolate(String message, Context context, Locale locale) {
-		return interpolateMessage( message, context.getConstraintDescriptor().getAttributes(), locale );
-	}
-
-	/**
-	 * Runs the message interpolation according to algorithm specified in JSR 303.
-	 * <br/>
-	 * Note:
-	 * <br/>
-	 * Look-ups in user bundles is recursive whereas look-ups in default bundle are not!
-	 *
-	 * @param message the message to interpolate
-	 * @param annotationParameters the parameters of the annotation for which to interpolate this message
-	 * @param locale the <code>Locale</code> to use for the resource bundle.
-	 *
-	 * @return the interpolated message.
-	 */
-	private String interpolateMessage(String message, Map<String, Object> annotationParameters, Locale locale) {
-		LocalisedMessage localisedMessage = new LocalisedMessage( message, locale );
-		String resolvedMessage = resolvedMessages.get( localisedMessage );
-
-		// if the message is not already in the cache we have to run step 1-3 of the message resolution 
-		if ( resolvedMessage == null ) {
-			ResourceBundle userResourceBundle = findUserResourceBundle( locale );
-			ResourceBundle defaultResourceBundle = findDefaultResourceBundle( locale );
-
-			String userBundleResolvedMessage;
-			resolvedMessage = message;
-			boolean evaluatedDefaultBundleOnce = false;
-			do {
-				// search the user bundle recursive (step1)
-				userBundleResolvedMessage = replaceVariables(
-						resolvedMessage, userResourceBundle, locale, true
-				);
-
-				// exit condition - we have at least tried to validate against the default bundle and there was no
-				// further replacements
-				if ( evaluatedDefaultBundleOnce
-						&& !hasReplacementTakenPlace( userBundleResolvedMessage, resolvedMessage ) ) {
-					break;
-				}
-
-				// search the default bundle non recursive (step2)
-				resolvedMessage = replaceVariables( userBundleResolvedMessage, defaultResourceBundle, locale, false );
-				evaluatedDefaultBundleOnce = true;
-				resolvedMessages.put( localisedMessage, resolvedMessage );
-			} while ( true );
-		}
-
-		// resolve annotation attributes (step 4)
-		resolvedMessage = replaceAnnotationAttributes( resolvedMessage, annotationParameters );
-
-		// last but not least we have to take care of escaped literals
-		resolvedMessage = resolvedMessage.replace( "\\{", "{" );
-		resolvedMessage = resolvedMessage.replace( "\\}", "}" );
-		resolvedMessage = resolvedMessage.replace( "\\\\", "\\" );
-		return resolvedMessage;
-	}
-
-	private boolean hasReplacementTakenPlace(String origMessage, String newMessage) {
-		return !origMessage.equals( newMessage );
-	}
-
-	/**
-	 * Search current thread classloader for the resource bundle. If not found, search validator (this) classloader.
-	 *
-	 * @param locale The locale of the bundle to load.
-	 *
-	 * @return the resource bundle or <code>null</code> if none is found.
-	 */
-	private ResourceBundle getFileBasedResourceBundle(Locale locale) {
-		ResourceBundle rb = null;
-		boolean isSecured = System.getSecurityManager() != null;
-		GetClassLoader action = GetClassLoader.fromContext();
-		ClassLoader classLoader = isSecured ? AccessController.doPrivileged( action ) : action.run();
-
-		if ( classLoader != null ) {
-			rb = loadBundle( classLoader, locale, USER_VALIDATION_MESSAGES + " not found by thread local classloader" );
-		}
-		if ( rb == null ) {
-			action = GetClassLoader.fromClass( ResourceBundleMessageInterpolator.class );
-			classLoader = isSecured ? AccessController.doPrivileged( action ) : action.run();
-			rb = loadBundle(
-					classLoader,
-					locale,
-					USER_VALIDATION_MESSAGES + " not found by validator classloader"
-			);
-		}
-		if ( log.isDebugEnabled() ) {
-			if ( rb != null ) {
-				log.debug( USER_VALIDATION_MESSAGES + " found" );
-			}
-			else {
-				log.debug( USER_VALIDATION_MESSAGES + " not found. Delegating to " + DEFAULT_VALIDATION_MESSAGES );
-			}
-		}
-		return rb;
-	}
-
-	private ResourceBundle loadBundle(ClassLoader classLoader, Locale locale, String message) {
-		ResourceBundle rb = null;
-		try {
-			rb = ResourceBundle.getBundle( USER_VALIDATION_MESSAGES, locale, classLoader );
-		}
-		catch ( MissingResourceException e ) {
-			log.trace( message );
-		}
-		return rb;
-	}
-
-	private String replaceVariables(String message, ResourceBundle bundle, Locale locale, boolean recurse) {
-		Matcher matcher = messageParameterPattern.matcher( message );
-		StringBuffer sb = new StringBuffer();
-		String resolvedParameterValue;
-		while ( matcher.find() ) {
-			String parameter = matcher.group( 1 );
-			resolvedParameterValue = resolveParameter(
-					parameter, bundle, locale, recurse
-			);
-
-			matcher.appendReplacement( sb, escapeMetaCharacters( resolvedParameterValue ) );
-		}
-		matcher.appendTail( sb );
-		return sb.toString();
-	}
-
-	private String replaceAnnotationAttributes(String message, Map<String, Object> annotationParameters) {
-		Matcher matcher = messageParameterPattern.matcher( message );
-		StringBuffer sb = new StringBuffer();
-		while ( matcher.find() ) {
-			String resolvedParameterValue;
-			String parameter = matcher.group( 1 );
-			Object variable = annotationParameters.get( removeCurlyBrace( parameter ) );
-			if ( variable != null ) {
-				resolvedParameterValue = escapeMetaCharacters( variable.toString() );
-			}
-			else {
-				resolvedParameterValue = parameter;
-			}
-			matcher.appendReplacement( sb, resolvedParameterValue );
-		}
-		matcher.appendTail( sb );
-		return sb.toString();
-	}
-
-	private String resolveParameter(String parameterName, ResourceBundle bundle, Locale locale, boolean recurse) {
-		String parameterValue;
-		try {
-			if ( bundle != null ) {
-				parameterValue = bundle.getString( removeCurlyBrace( parameterName ) );
-				if ( recurse ) {
-					parameterValue = replaceVariables( parameterValue, bundle, locale, recurse );
-				}
-			}
-			else {
-				parameterValue = parameterName;
-			}
-		}
-		catch ( MissingResourceException e ) {
-			// return parameter itself
-			parameterValue = parameterName;
-		}
-		return parameterValue;
-	}
-
-	private String removeCurlyBrace(String parameter) {
-		return parameter.substring( 1, parameter.length() - 1 );
-	}
-
-	private ResourceBundle findDefaultResourceBundle(Locale locale) {
-		if ( defaultBundlesMap.containsKey( locale ) ) {
-			return defaultBundlesMap.get( locale );
-		}
-
-		ResourceBundle bundle = ResourceBundle.getBundle( DEFAULT_VALIDATION_MESSAGES, locale );
-		defaultBundlesMap.put( locale, bundle );
-		return bundle;
-	}
-
-	private ResourceBundle findUserResourceBundle(Locale locale) {
-		if ( userBundlesMap.containsKey( locale ) ) {
-			return userBundlesMap.get( locale );
-		}
-
-		ResourceBundle bundle = getFileBasedResourceBundle( locale );
-		if ( bundle != null ) {
-			userBundlesMap.put( locale, bundle );
-		}
-		return bundle;
-	}
-
-	/**
-	 * @param s The string in which to replace the meta characters '$' and '\'.
-	 *
-	 * @return A string where meta characters relevant for {@link Matcher#appendReplacement} are escaped.
-	 */
-	private String escapeMetaCharacters(String s) {
-		String escapedString = s.replace( "\\", "\\\\" );
-		escapedString = escapedString.replace( "$", "\\$" );
-		return escapedString;
-	}
-
-	private static class LocalisedMessage {
-		private final String message;
-		private final Locale locale;
-
-		LocalisedMessage(String message, Locale locale) {
-			this.message = message;
-			this.locale = locale;
-		}
-
-		public String getMessage() {
-			return message;
-		}
-
-		public Locale getLocale() {
-			return locale;
-		}
-
-		@Override
-		public boolean equals(Object o) {
-			if ( this == o ) {
-				return true;
-			}
-			if ( o == null || getClass() != o.getClass() ) {
-				return false;
-			}
-
-			LocalisedMessage that = ( LocalisedMessage ) o;
-
-			if ( locale != null ? !locale.equals( that.locale ) : that.locale != null ) {
-				return false;
-			}
-			if ( message != null ? !message.equals( that.message ) : that.message != null ) {
-				return false;
-			}
-
-			return true;
-		}
-
-		@Override
-		public int hashCode() {
-			int result = message != null ? message.hashCode() : 0;
-			result = 31 * result + ( locale != null ? locale.hashCode() : 0 );
-			return result;
-		}
-	}
-}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/engine/ValidationContext.java b/hibernate-validator/src/main/java/org/hibernate/validator/engine/ValidationContext.java
new file mode 100644
index 0000000..85f3d4c
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/engine/ValidationContext.java
@@ -0,0 +1,266 @@
+// $Id: ValidationContext.java 19735 2010-06-15 09:40:40Z hardy.ferentschik $
+/*
+* 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.engine;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.IdentityHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.validation.ConstraintValidatorFactory;
+import javax.validation.ConstraintViolation;
+import javax.validation.MessageInterpolator;
+import javax.validation.TraversableResolver;
+import javax.validation.metadata.ConstraintDescriptor;
+
+import org.hibernate.validator.util.IdentitySet;
+
+/**
+ * Context object keeping track of all important data for a top level {@link javax.validation.Validator#validate(Object, Class[])} },
+ * {@link javax.validation.Validator#validateValue(Class, String, Object, Class[])}  } or {@link javax.validation.Validator#validateProperty(Object, String, Class[])}  call.
+ * <p/>
+ * we use this object to collect all failing constraints, but also to cache the caching traversable resolver for a full stack call.
+ *
+ * @author Hardy Ferentschik
+ * @author Emmanuel Bernard
+ */
+public class ValidationContext<T> {
+
+	/**
+	 * The root bean of the validation.
+	 */
+	private final T rootBean;
+
+	/**
+	 * The root bean class of the validation.
+	 */
+	private final Class<T> rootBeanClass;
+
+	/**
+	 * Maps a group to an identity set to keep track of already validated objects. We have to make sure
+	 * that each object gets only validated once per group and property path.
+	 */
+	private final Map<Class<?>, IdentitySet> processedObjects;
+
+	/**
+	 * Maps an object to a list of paths in which it has been invalidated.
+	 */
+	private final Map<Object, Set<PathImpl>> processedPaths;
+
+	/**
+	 * A list of all failing constraints so far.
+	 */
+	private final List<ConstraintViolation<T>> failingConstraintViolations;
+
+	/**
+	 * Flag indicating whether an object can only be validated once per group or once per group AND validation path.
+	 *
+	 * @todo Make this boolean a configurable item.
+	 */
+	private boolean allowOneValidationPerPath = true;
+
+	/**
+	 * The message resolver which should be used in this context.
+	 */
+	private final MessageInterpolator messageInterpolator;
+
+	/**
+	 * The constraint factory which should be used in this context.
+	 */
+	private final ConstraintValidatorFactory constraintValidatorFactory;
+
+	/**
+	 * Allows a JPA provider to decide whether a property should be validated.
+	 */
+	private final TraversableResolver traversableResolver;
+
+	public static <T> ValidationContext<T> getContextForValidate(T object, MessageInterpolator messageInterpolator, ConstraintValidatorFactory constraintValidatorFactory, TraversableResolver traversableResolver) {
+		@SuppressWarnings("unchecked")
+		Class<T> rootBeanClass = ( Class<T> ) object.getClass();
+		return new ValidationContext<T>(
+				rootBeanClass, object, messageInterpolator, constraintValidatorFactory, traversableResolver
+		);
+	}
+
+	public static <T> ValidationContext<T> getContextForValidateProperty(T rootBean, MessageInterpolator messageInterpolator, ConstraintValidatorFactory constraintValidatorFactory, TraversableResolver traversableResolver) {
+		@SuppressWarnings("unchecked")
+		Class<T> rootBeanClass = ( Class<T> ) rootBean.getClass();
+		return new ValidationContext<T>(
+				rootBeanClass, rootBean, messageInterpolator, constraintValidatorFactory, traversableResolver
+		);
+	}
+
+	public static <T> ValidationContext<T> getContextForValidateValue(Class<T> rootBeanClass, MessageInterpolator messageInterpolator, ConstraintValidatorFactory constraintValidatorFactory, TraversableResolver traversableResolver) {
+		return new ValidationContext<T>(
+				rootBeanClass,
+				null,
+				messageInterpolator,
+				constraintValidatorFactory,
+				traversableResolver
+		);
+	}
+
+	private ValidationContext(Class<T> rootBeanClass, T rootBean, MessageInterpolator messageInterpolator, ConstraintValidatorFactory constraintValidatorFactory, TraversableResolver traversableResolver) {
+		this.rootBean = rootBean;
+		this.rootBeanClass = rootBeanClass;
+		this.messageInterpolator = messageInterpolator;
+		this.constraintValidatorFactory = constraintValidatorFactory;
+		this.traversableResolver = traversableResolver;
+
+		processedObjects = new HashMap<Class<?>, IdentitySet>();
+		processedPaths = new IdentityHashMap<Object, Set<PathImpl>>();
+		failingConstraintViolations = new ArrayList<ConstraintViolation<T>>();
+	}
+
+	public T getRootBean() {
+		return rootBean;
+	}
+
+	public Class<T> getRootBeanClass() {
+		return rootBeanClass;
+	}
+
+	public TraversableResolver getTraversableResolver() {
+		return traversableResolver;
+	}
+
+	public MessageInterpolator getMessageInterpolator() {
+		return messageInterpolator;
+	}
+
+	public <U, V> ConstraintViolationImpl<T> createConstraintViolation(ValueContext<U, V> localContext, MessageAndPath messageAndPath, ConstraintDescriptor<?> descriptor) {
+		String messageTemplate = messageAndPath.getMessage();
+		String interpolatedMessage = messageInterpolator.interpolate(
+				messageTemplate,
+				new MessageInterpolatorContext( descriptor, localContext.getCurrentValidatedValue() )
+		);
+		return new ConstraintViolationImpl<T>(
+				messageTemplate,
+				interpolatedMessage,
+				getRootBeanClass(),
+				getRootBean(),
+				localContext.getCurrentBean(),
+				localContext.getCurrentValidatedValue(),
+				messageAndPath.getPath(),
+				descriptor,
+				localContext.getElementType()
+		);
+	}
+
+	public <U, V> List<ConstraintViolationImpl<T>> createConstraintViolations(ValueContext<U, V> localContext, ConstraintValidatorContextImpl constraintValidatorContext) {
+		List<ConstraintViolationImpl<T>> constraintViolations = new ArrayList<ConstraintViolationImpl<T>>();
+		for ( MessageAndPath messageAndPath : constraintValidatorContext.getMessageAndPathList() ) {
+			ConstraintViolationImpl<T> violation = createConstraintViolation(
+					localContext, messageAndPath, constraintValidatorContext.getConstraintDescriptor()
+			);
+			constraintViolations.add( violation );
+		}
+		return constraintViolations;
+	}
+
+	public ConstraintValidatorFactory getConstraintValidatorFactory() {
+		return constraintValidatorFactory;
+	}
+
+	public boolean isAlreadyValidated(Object value, Class<?> group, PathImpl path) {
+		boolean alreadyValidated;
+		alreadyValidated = isAlreadyValidatedForCurrentGroup( value, group );
+
+		if ( alreadyValidated && allowOneValidationPerPath ) {
+			alreadyValidated = isAlreadyValidatedForPath( value, path );
+		}
+		return alreadyValidated;
+	}
+
+	public void markProcessed(Object value, Class<?> group, PathImpl path) {
+		markProcessForCurrentGroup( value, group );
+		if ( allowOneValidationPerPath ) {
+			markProcessedForCurrentPath( value, path );
+		}
+	}
+
+	private void addConstraintFailure(ConstraintViolation<T> failingConstraintViolation) {
+		// NOTE: we are relying on the fact that ConstraintViolation.equals() is implemented correctly.
+		int i = failingConstraintViolations.indexOf( failingConstraintViolation );
+		if ( i == -1 ) {
+			failingConstraintViolations.add( failingConstraintViolation );
+		}
+	}
+
+	public void addConstraintFailures(List<ConstraintViolation<T>> failingConstraintViolations) {
+		for ( ConstraintViolation<T> violation : failingConstraintViolations ) {
+			addConstraintFailure( violation );
+		}
+	}
+
+	public List<ConstraintViolation<T>> getFailingConstraints() {
+		return failingConstraintViolations;
+	}
+
+	private boolean isAlreadyValidatedForPath(Object value, PathImpl path) {
+		Set<PathImpl> pathSet = processedPaths.get( value );
+		if ( pathSet == null ) {
+			return false;
+		}
+
+		for ( PathImpl p : pathSet ) {
+			if ( p.isRootPath() || path.isRootPath() || p.isSubPathOf( path ) || path.isSubPathOf( p ) ) {
+				return true;
+			}
+		}
+
+		return false;
+	}
+
+	private boolean isAlreadyValidatedForCurrentGroup(Object value, Class<?> group) {
+		final IdentitySet objectsProcessedInCurrentGroups = processedObjects.get( group );
+		return objectsProcessedInCurrentGroups != null && objectsProcessedInCurrentGroups.contains( value );
+	}
+
+	private void markProcessedForCurrentPath(Object value, PathImpl path) {
+		// hmm - not sure if the current definiton of Path and Node are consistent. Shouldn't a simple property
+		// of a entity have a parent node?
+		PathImpl parentPath = path.getPathWithoutLeafNode();
+		if ( parentPath == null ) {
+			parentPath = PathImpl.createNewPath( null );
+		}
+
+		if ( processedPaths.containsKey( value ) ) {
+			processedPaths.get( value ).add( parentPath );
+		}
+		else {
+			Set<PathImpl> set = new HashSet<PathImpl>();
+			set.add( parentPath );
+			processedPaths.put( value, set );
+		}
+	}
+
+
+	private void markProcessForCurrentGroup(Object value, Class<?> group) {
+		if ( processedObjects.containsKey( group ) ) {
+			processedObjects.get( group ).add( value );
+		}
+		else {
+			IdentitySet set = new IdentitySet();
+			set.add( value );
+			processedObjects.put( group, set );
+		}
+	}
+}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/engine/ValidatorFactoryImpl.java b/hibernate-validator/src/main/java/org/hibernate/validator/engine/ValidatorFactoryImpl.java
index 7e87af4..2e499e0 100755
--- a/hibernate-validator/src/main/java/org/hibernate/validator/engine/ValidatorFactoryImpl.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/engine/ValidatorFactoryImpl.java
@@ -1,4 +1,4 @@
-// $Id: ValidatorFactoryImpl.java 17860 2009-10-28 12:14:31Z hardy.ferentschik $
+// $Id: ValidatorFactoryImpl.java 19635 2010-05-31 14:03:26Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -21,7 +21,9 @@ import java.io.InputStream;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Member;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import javax.validation.ConstraintValidatorFactory;
 import javax.validation.MessageInterpolator;
@@ -32,6 +34,9 @@ import javax.validation.ValidatorContext;
 import javax.validation.ValidatorFactory;
 import javax.validation.spi.ConfigurationState;
 
+import org.hibernate.validator.cfg.CascadeDef;
+import org.hibernate.validator.cfg.ConstraintDefWrapper;
+import org.hibernate.validator.cfg.ConstraintMapping;
 import org.hibernate.validator.metadata.AnnotationIgnores;
 import org.hibernate.validator.metadata.BeanMetaDataCache;
 import org.hibernate.validator.metadata.BeanMetaDataImpl;
@@ -40,10 +45,13 @@ import org.hibernate.validator.metadata.ConstraintHelper;
 import org.hibernate.validator.metadata.ConstraintOrigin;
 import org.hibernate.validator.metadata.MetaConstraint;
 import org.hibernate.validator.util.ReflectionHelper;
+import org.hibernate.validator.util.annotationfactory.AnnotationDescriptor;
+import org.hibernate.validator.util.annotationfactory.AnnotationFactory;
 import org.hibernate.validator.xml.XmlMappingParser;
 
 /**
- * Factory returning initialized <code>Validator</code> instances.
+ * Factory returning initialized {@code Validator} instances. This is Hibernate Validator's default
+ * implementation of the {@code ValidatorFactory} interface.
  *
  * @author Emmanuel Bernard
  * @author Hardy Ferentschik
@@ -54,16 +62,31 @@ public class ValidatorFactoryImpl implements ValidatorFactory {
 	private final TraversableResolver traversableResolver;
 	private final ConstraintValidatorFactory constraintValidatorFactory;
 	private final ConstraintHelper constraintHelper;
+
+	/**
+	 * Used to cache the constraint meta data for validated entities
+	 */
 	private final BeanMetaDataCache beanMetaDataCache;
 
 	public ValidatorFactoryImpl(ConfigurationState configurationState) {
+
 		this.messageInterpolator = configurationState.getMessageInterpolator();
 		this.constraintValidatorFactory = configurationState.getConstraintValidatorFactory();
 		this.traversableResolver = configurationState.getTraversableResolver();
 		this.constraintHelper = new ConstraintHelper();
 		this.beanMetaDataCache = new BeanMetaDataCache();
 
-		initBeanMetaData( configurationState.getMappingStreams() );
+		// HV-302; don't load XmlMappingParser if not necessary
+		if ( !configurationState.getMappingStreams().isEmpty() ) {
+			initXmlConfiguration( configurationState.getMappingStreams() );
+		}
+
+		if ( configurationState instanceof ConfigurationImpl ) {
+			ConfigurationImpl hibernateSpecificConfig = ( ConfigurationImpl ) configurationState;
+			if ( hibernateSpecificConfig.getMapping() != null ) {
+				initProgrammaticConfiguration( hibernateSpecificConfig.getMapping() );
+			}
+		}
 	}
 
 	public Validator getValidator() {
@@ -96,38 +119,98 @@ public class ValidatorFactoryImpl implements ValidatorFactory {
 		);
 	}
 
-	private <T> void initBeanMetaData(Set<InputStream> mappingStreams) {
+	/**
+	 * Reads the configuration from {@code mapping} and creates the appropriate meta-data structures.
+	 *
+	 * @param mapping The constraint configuration created via the programmatic API.
+	 */
+	private <T> void initProgrammaticConfiguration(ConstraintMapping mapping) {
+		for ( Class<?> clazz : mapping.getConfiguredClasses() ) {
+			@SuppressWarnings("unchecked")
+			Class<T> beanClass = ( Class<T> ) clazz;
+
+			// for each configured entity we have to check whether any of the interfaces or super classes is configured
+			// vua the programmatic api as well
+			List<Class<?>> classes = ReflectionHelper.computeClassHierarchy( beanClass );
+
+			Map<Class<?>, List<MetaConstraint<T, ?>>> constraints = createEmptyConstraintMap();
+			List<Member> cascadedMembers = new ArrayList<Member>();
+
+			for ( Class<?> classInHierarchy : classes ) {
+				// if the programmatic config contains constraints for the class in the hierarchy create a meta constraint
+				if ( mapping.getConstraintConfig().keySet().contains( classInHierarchy ) ) {
+					addProgrammaticConfiguredConstraints(
+							mapping.getConstraintConfig().get( classInHierarchy ),
+							beanClass,
+							classInHierarchy,
+							constraints
+					);
+				}
+
+				if ( mapping.getCascadeConfig().keySet().contains( classInHierarchy ) ) {
+					addProgrammaticConfiguredCascade(
+							mapping.getCascadeConfig().get( classInHierarchy ), cascadedMembers
+					);
+				}
+			}
+
+			BeanMetaDataImpl<T> metaData = new BeanMetaDataImpl<T>(
+					beanClass,
+					constraintHelper,
+					mapping.getDefaultSequence( beanClass ),
+					constraints,
+					cascadedMembers,
+					new AnnotationIgnores(),
+					beanMetaDataCache
+			);
+
+			beanMetaDataCache.addBeanMetaData( beanClass, metaData );
+		}
+	}
+
+	private <T> void initXmlConfiguration(Set<InputStream> mappingStreams) {
 
 		XmlMappingParser mappingParser = new XmlMappingParser( constraintHelper );
 		mappingParser.parse( mappingStreams );
 
-		Set<Class<?>> processedClasses = mappingParser.getProcessedClasses();
+		Set<Class<?>> xmlConfiguredClasses = mappingParser.getXmlConfiguredClasses();
 		AnnotationIgnores annotationIgnores = mappingParser.getAnnotationIgnores();
-		for ( Class<?> clazz : processedClasses ) {
+		for ( Class<?> clazz : xmlConfiguredClasses ) {
 			@SuppressWarnings("unchecked")
 			Class<T> beanClass = ( Class<T> ) clazz;
-			BeanMetaDataImpl<T> metaData = new BeanMetaDataImpl<T>(
-					beanClass, constraintHelper, annotationIgnores, beanMetaDataCache
-			);
 
-			List<Class<?>> classes = new ArrayList<Class<?>>();
-			ReflectionHelper.computeClassHierarchy( beanClass, classes );
+			List<Class<?>> classes = ReflectionHelper.computeClassHierarchy( beanClass );
+			Map<Class<?>, List<MetaConstraint<T, ?>>> constraints = createEmptyConstraintMap();
+			List<Member> cascadedMembers = new ArrayList<Member>();
+			// we need to collect all constraints which apply for a single class. Due to constraint inheritance
+			// some constraints might be configured in super classes or interfaces. The xml configuration does not
+			// imply any order so we have to check whether any of the super classes or interfaces of a given bean has
+			// as well been configured via xml
 			for ( Class<?> classInHierarchy : classes ) {
-				if ( processedClasses.contains( classInHierarchy ) ) {
-					addXmlConfiguredConstraintToMetaData( mappingParser, beanClass, classInHierarchy, metaData );
+				if ( xmlConfiguredClasses.contains( classInHierarchy ) ) {
+					addXmlConfiguredConstraints( mappingParser, beanClass, classInHierarchy, constraints );
+					addXmlCascadedMember( mappingParser, classInHierarchy, cascadedMembers );
 				}
 			}
 
-			if ( !mappingParser.getDefaultSequenceForClass( beanClass ).isEmpty() ) {
-				metaData.setDefaultGroupSequence( mappingParser.getDefaultSequenceForClass( beanClass ) );
-			}
+			BeanMetaDataImpl<T> metaData = new BeanMetaDataImpl<T>(
+					beanClass,
+					constraintHelper,
+					mappingParser.getDefaultSequenceForClass( beanClass ),
+					constraints,
+					cascadedMembers,
+					annotationIgnores,
+					beanMetaDataCache
+			);
 
 			beanMetaDataCache.addBeanMetaData( beanClass, metaData );
 		}
 	}
 
 	@SuppressWarnings("unchecked")
-	private <T, A extends Annotation> void addXmlConfiguredConstraintToMetaData(XmlMappingParser mappingParser, Class<T> rootClass, Class<?> hierarchyClass, BeanMetaDataImpl<T> metaData) {
+	private <T, A extends Annotation> void addXmlConfiguredConstraints(XmlMappingParser mappingParser,
+																	   Class<T> rootClass,
+																	   Class<?> hierarchyClass, Map<Class<?>, List<MetaConstraint<T, ?>>> constraints) {
 		for ( MetaConstraint<?, ? extends Annotation> constraint : mappingParser.getConstraintsForClass( hierarchyClass ) ) {
 			ConstraintOrigin definedIn = definedIn( rootClass, hierarchyClass );
 			ConstraintDescriptorImpl<A> descriptor = new ConstraintDescriptorImpl<A>(
@@ -139,14 +222,76 @@ public class ValidatorFactoryImpl implements ValidatorFactory {
 			MetaConstraint<T, A> newMetaConstraint = new MetaConstraint<T, A>(
 					rootClass, constraint.getMember(), descriptor
 			);
-			metaData.addMetaConstraint( hierarchyClass, newMetaConstraint );
+
+			addConstraintToMap( hierarchyClass, newMetaConstraint, constraints );
+		}
+	}
+
+	@SuppressWarnings("unchecked")
+	private <T, A extends Annotation> void addProgrammaticConfiguredConstraints(List<ConstraintDefWrapper<?>> definitions,
+																				Class<T> rootClass, Class<?> hierarchyClass,
+																				Map<Class<?>, List<MetaConstraint<T, ?>>> constraints) {
+		for ( ConstraintDefWrapper<?> config : definitions ) {
+			A annotation = ( A ) createAnnotationProxy( config );
+			ConstraintOrigin definedIn = definedIn( rootClass, hierarchyClass );
+			ConstraintDescriptorImpl<A> constraintDescriptor = new ConstraintDescriptorImpl<A>(
+					annotation, constraintHelper, config.getElementType(), definedIn
+			);
+
+			Member member = null;
+			if ( !config.getProperty().isEmpty() ) {
+				member = ReflectionHelper.getMember(
+						config.getBeanType(), config.getProperty(), config.getElementType()
+				);
+			}
+
+			MetaConstraint<T, ?> metaConstraint = new MetaConstraint(
+					config.getBeanType(), member, constraintDescriptor
+			);
+			addConstraintToMap( hierarchyClass, metaConstraint, constraints );
+		}
+	}
+
+	@SuppressWarnings("unchecked")
+	private <T, A extends Annotation> void addConstraintToMap(Class<?> hierarchyClass,
+															  MetaConstraint<T, A> constraint,
+															  Map<Class<?>, List<MetaConstraint<T, ?>>> constraints) {
+		List<MetaConstraint<T, ?>> constraintList = constraints.get( hierarchyClass );
+		if ( constraintList == null ) {
+			constraintList = new ArrayList<MetaConstraint<T, ?>>();
+			constraints.put( hierarchyClass, constraintList );
 		}
+		constraintList.add( constraint );
+	}
 
+	private void addXmlCascadedMember(XmlMappingParser mappingParser,
+									  Class<?> hierarchyClass,
+									  List<Member> cascadedMembers) {
 		for ( Member m : mappingParser.getCascadedMembersForClass( hierarchyClass ) ) {
-			metaData.addCascadedMember( m );
+			cascadedMembers.add( m );
 		}
 	}
 
+	private void addProgrammaticConfiguredCascade(List<CascadeDef> cascades,
+												  List<Member> cascadedMembers) {
+		if ( cascades == null ) {
+			return;
+		}
+		for ( CascadeDef cascade : cascades ) {
+			Member m = ReflectionHelper.getMember(
+					cascade.getBeanType(), cascade.getProperty(), cascade.getElementType()
+			);
+			cascadedMembers.add( m );
+		}
+	}
+
+	/**
+	 * @param rootClass The root class. That is the class for which we currently create a  {@code BeanMetaData}
+	 * @param hierarchyClass The class on which the current constraint is defined on
+	 *
+	 * @return Returns {@code ConstraintOrigin.DEFINED_LOCALLY} if the constraint was defined on the root bean,
+	 *         {@code ConstraintOrigin.DEFINED_IN_HIERARCHY} otherwise.
+	 */
 	private ConstraintOrigin definedIn(Class<?> rootClass, Class<?> hierarchyClass) {
 		if ( hierarchyClass.equals( rootClass ) ) {
 			return ConstraintOrigin.DEFINED_LOCALLY;
@@ -155,4 +300,28 @@ public class ValidatorFactoryImpl implements ValidatorFactory {
 			return ConstraintOrigin.DEFINED_IN_HIERARCHY;
 		}
 	}
+
+	@SuppressWarnings("unchecked")
+	private <A extends Annotation> Annotation createAnnotationProxy(ConstraintDefWrapper<?> config) {
+		Class<A> constraintType = ( Class<A> ) config.getConstraintType();
+		AnnotationDescriptor<A> annotationDescriptor = new AnnotationDescriptor<A>( constraintType );
+		for ( Map.Entry<String, Object> parameter : config.getParameters().entrySet() ) {
+			annotationDescriptor.setValue( parameter.getKey(), parameter.getValue() );
+		}
+
+		A annotation;
+		try {
+			annotation = AnnotationFactory.create( annotationDescriptor );
+		}
+		catch ( RuntimeException e ) {
+			throw new ValidationException(
+					"Unable to create annotation for configured constraint: " + e.getMessage(), e
+			);
+		}
+		return annotation;
+	}
+
+	private <T> Map<Class<?>, List<MetaConstraint<T, ?>>> createEmptyConstraintMap() {
+		return new HashMap<Class<?>, List<MetaConstraint<T, ?>>>();
+	}
 }
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/engine/ValidatorImpl.java b/hibernate-validator/src/main/java/org/hibernate/validator/engine/ValidatorImpl.java
index a056728..f8d0af5 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/engine/ValidatorImpl.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/engine/ValidatorImpl.java
@@ -1,4 +1,4 @@
-// $Id: ValidatorImpl.java 17860 2009-10-28 12:14:31Z hardy.ferentschik $
+// $Id: ValidatorImpl.java 19380 2010-05-06 10:31:32Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -105,14 +105,14 @@ public class ValidatorImpl implements Validator {
 		groupChainGenerator = new GroupChainGenerator();
 	}
 
-	public <T> Set<ConstraintViolation<T>> validate(T object, Class<?>... groups) {
+	public final <T> Set<ConstraintViolation<T>> validate(T object, Class<?>... groups) {
 		if ( object == null ) {
 			throw new IllegalArgumentException( "Validation of a null object" );
 		}
 
 		GroupChain groupChain = determineGroupExecutionOrder( groups );
 
-		GlobalExecutionContext<T> context = GlobalExecutionContext.getContextForValidate(
+		ValidationContext<T> context = ValidationContext.getContextForValidate(
 				object, messageInterpolator, constraintValidatorFactory, getCachingTraversableResolver()
 		);
 
@@ -120,7 +120,7 @@ public class ValidatorImpl implements Validator {
 		return new HashSet<ConstraintViolation<T>>( list );
 	}
 
-	public <T> Set<ConstraintViolation<T>> validateProperty(T object, String propertyName, Class<?>... groups) {
+	public final <T> Set<ConstraintViolation<T>> validateProperty(T object, String propertyName, Class<?>... groups) {
 		if ( object == null ) {
 			throw new IllegalArgumentException( "Validated object cannot be null." );
 		}
@@ -134,7 +134,7 @@ public class ValidatorImpl implements Validator {
 		return new HashSet<ConstraintViolation<T>>( failingConstraintViolations );
 	}
 
-	public <T> Set<ConstraintViolation<T>> validateValue(Class<T> beanType, String propertyName, Object value, Class<?>... groups) {
+	public final <T> Set<ConstraintViolation<T>> validateValue(Class<T> beanType, String propertyName, Object value, Class<?>... groups) {
 		if ( beanType == null ) {
 			throw new IllegalArgumentException( "The bean type cannot be null." );
 		}
@@ -149,14 +149,11 @@ public class ValidatorImpl implements Validator {
 		return new HashSet<ConstraintViolation<T>>( failingConstraintViolations );
 	}
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public BeanDescriptor getConstraintsForClass(Class<?> clazz) {
+	public final BeanDescriptor getConstraintsForClass(Class<?> clazz) {
 		return getBeanMetaData( clazz ).getBeanDescriptor();
 	}
 
-	public <T> T unwrap(Class<T> type) {
+	public final <T> T unwrap(Class<T> type) {
 		throw new ValidationException( "Type " + type + " not supported" );
 	}
 
@@ -183,7 +180,7 @@ public class ValidatorImpl implements Validator {
 	 * Validates the given object using the available context information.
 	 *
 	 * @param value The value to validate.
-	 * @param context Global context. Used amongst others to collect all failing constraints.
+	 * @param context the validation context.
 	 * @param groupChain Contains the information which and in which order groups have to be executed
 	 * @param path The current path of the validation.
 	 * @param <T> The root bean type.
@@ -191,32 +188,32 @@ public class ValidatorImpl implements Validator {
 	 *
 	 * @return List of constraint violations or the empty set if there were no violations.
 	 */
-	private <T, U, V> List<ConstraintViolation<T>> validateInContext(U value, GlobalExecutionContext<T> context, GroupChain groupChain, PathImpl path) {
+	private <T, U, V> List<ConstraintViolation<T>> validateInContext(U value, ValidationContext<T> context, GroupChain groupChain, PathImpl path) {
 		if ( value == null ) {
 			return Collections.emptyList();
 		}
 
 		path = PathImpl.createShallowCopy( path );
-		LocalExecutionContext<U, V> localExecutionContext = LocalExecutionContext.getLocalExecutionContext( value );
+		ValueContext<U, V> valueContext = ValueContext.getLocalExecutionContext( value );
 
-		BeanMetaData<U> beanMetaData = getBeanMetaData( localExecutionContext.getCurrentBeanType() );
+		BeanMetaData<U> beanMetaData = getBeanMetaData( valueContext.getCurrentBeanType() );
 		if ( beanMetaData.defaultGroupSequenceIsRedefined() ) {
 			groupChain.assertDefaultGroupSequenceIsExpandable( beanMetaData.getDefaultGroupSequence() );
 		}
 
-		// process first single groups. For these we can skip some object traversal, by first running all validations on the current bean
+		// process first single groups. For these we can optimise object traversal by first running all validations on the current bean
 		// before traversing the object.
 		Iterator<Group> groupIterator = groupChain.getGroupIterator();
 		while ( groupIterator.hasNext() ) {
 			Group group = groupIterator.next();
-			localExecutionContext.setCurrentGroup( group.getGroup() );
-			validateConstraintsForCurrentGroup( context, localExecutionContext, path );
+			valueContext.setCurrentGroup( group.getGroup() );
+			validateConstraintsForCurrentGroup( context, valueContext, path );
 		}
 		groupIterator = groupChain.getGroupIterator();
 		while ( groupIterator.hasNext() ) {
 			Group group = groupIterator.next();
-			localExecutionContext.setCurrentGroup( group.getGroup() );
-			validateCascadedConstraints( context, localExecutionContext, path );
+			valueContext.setCurrentGroup( group.getGroup() );
+			validateCascadedConstraints( context, valueContext, path );
 		}
 
 		// now we process sequences. For sequences I have to traverse the object graph since I have to stop processing when an error occurs.
@@ -225,10 +222,10 @@ public class ValidatorImpl implements Validator {
 			List<Group> sequence = sequenceIterator.next();
 			for ( Group group : sequence ) {
 				int numberOfViolations = context.getFailingConstraints().size();
-				localExecutionContext.setCurrentGroup( group.getGroup() );
+				valueContext.setCurrentGroup( group.getGroup() );
 
-				validateConstraintsForCurrentGroup( context, localExecutionContext, path );
-				validateCascadedConstraints( context, localExecutionContext, path );
+				validateConstraintsForCurrentGroup( context, valueContext, path );
+				validateCascadedConstraints( context, valueContext, path );
 
 				if ( context.getFailingConstraints().size() > numberOfViolations ) {
 					break;
@@ -238,33 +235,31 @@ public class ValidatorImpl implements Validator {
 		return context.getFailingConstraints();
 	}
 
-	private <T, U, V> void validateConstraintsForCurrentGroup(GlobalExecutionContext<T> globalExecutionContext, LocalExecutionContext<U, V> localExecutionContext, PathImpl path) {
-		BeanMetaData<U> beanMetaData = getBeanMetaData( localExecutionContext.getCurrentBeanType() );
-		boolean validatingDefault = localExecutionContext.validatingDefault();
+	private <T, U, V> void validateConstraintsForCurrentGroup(ValidationContext<T> validationContext, ValueContext<U, V> valueContext, PathImpl path) {
+		BeanMetaData<U> beanMetaData = getBeanMetaData( valueContext.getCurrentBeanType() );
+		boolean validatingDefault = valueContext.validatingDefault();
 		boolean validatedBeanRedefinesDefault = beanMetaData.defaultGroupSequenceIsRedefined();
 
 		// if we are not validating the default group there is nothing special to consider
 		if ( !validatingDefault ) {
-			validateConstraintsForNonDefaultGroup( globalExecutionContext, localExecutionContext, path );
+			validateConstraintsForNonDefaultGroup( validationContext, valueContext, path );
 			return;
 		}
 
-		// if we are validating the default group we have to distinguish between the case where the main entity type redefines the default group and
-		// where not
+		// if we are validating the default group we have to distinguish between the case where the main entity type redefines the default group and where not
 		if ( validatedBeanRedefinesDefault ) {
 			validateConstraintsForRedefinedDefaultGroupOnMainEntity(
-					globalExecutionContext, localExecutionContext, path, beanMetaData
+					validationContext, valueContext, path, beanMetaData
 			);
 		}
 		else {
 			validateConstraintsForRedefinedDefaultGroup(
-					globalExecutionContext, localExecutionContext, path, beanMetaData
+					validationContext, valueContext, path, beanMetaData
 			);
 		}
 	}
 
-	private <T, U, V> void validateConstraintsForRedefinedDefaultGroup(GlobalExecutionContext<T> globalExecutionContext, LocalExecutionContext<U, V> localExecutionContext, PathImpl path, BeanMetaData<U> beanMetaData) {
-		// in the case where the main entity does not redefine the default group we have to check whether the entity which defines the constraint does
+	private <T, U, V> void validateConstraintsForRedefinedDefaultGroup(ValidationContext<T> validationContext, ValueContext<U, V> valueContext, PathImpl path, BeanMetaData<U> beanMetaData) {
 		for ( Map.Entry<Class<?>, List<MetaConstraint<U, ? extends Annotation>>> entry : beanMetaData.getMetaConstraintsAsMap()
 				.entrySet() ) {
 			Class<?> hostingBeanClass = entry.getKey();
@@ -272,11 +267,11 @@ public class ValidatorImpl implements Validator {
 
 			List<Class<?>> defaultGroupSequence = getBeanMetaData( hostingBeanClass ).getDefaultGroupSequence();
 			for ( Class<?> defaultSequenceMember : defaultGroupSequence ) {
-				localExecutionContext.setCurrentGroup( defaultSequenceMember );
+				valueContext.setCurrentGroup( defaultSequenceMember );
 				boolean validationSuccessful = true;
 				for ( MetaConstraint<U, ? extends Annotation> metaConstraint : constraints ) {
 					boolean tmp = validateConstraint(
-							globalExecutionContext, localExecutionContext, metaConstraint, path
+							validationContext, valueContext, metaConstraint, path
 					);
 					validationSuccessful = validationSuccessful && tmp;
 				}
@@ -287,16 +282,14 @@ public class ValidatorImpl implements Validator {
 		}
 	}
 
-	private <T, U, V> void validateConstraintsForRedefinedDefaultGroupOnMainEntity(GlobalExecutionContext<T> globalExecutionContext, LocalExecutionContext<U, V> localExecutionContext, PathImpl path, BeanMetaData<U> beanMetaData) {
-		// in the case where the main entity redefines the default group we can iterate over all constraints independent of the bean they are
-		// defined in. The redefined group sequence applies for all constraints.
+	private <T, U, V> void validateConstraintsForRedefinedDefaultGroupOnMainEntity(ValidationContext<T> validationContext, ValueContext<U, V> valueContext, PathImpl path, BeanMetaData<U> beanMetaData) {
 		List<Class<?>> defaultGroupSequence = beanMetaData.getDefaultGroupSequence();
 		for ( Class<?> defaultSequenceMember : defaultGroupSequence ) {
-			localExecutionContext.setCurrentGroup( defaultSequenceMember );
+			valueContext.setCurrentGroup( defaultSequenceMember );
 			boolean validationSuccessful = true;
 			for ( MetaConstraint<U, ? extends Annotation> metaConstraint : beanMetaData.getMetaConstraintsAsList() ) {
 				boolean tmp = validateConstraint(
-						globalExecutionContext, localExecutionContext, metaConstraint, path
+						validationContext, valueContext, metaConstraint, path
 				);
 				validationSuccessful = validationSuccessful && tmp;
 			}
@@ -306,14 +299,14 @@ public class ValidatorImpl implements Validator {
 		}
 	}
 
-	private <T, U, V> void validateConstraintsForNonDefaultGroup(GlobalExecutionContext<T> globalExecutionContext, LocalExecutionContext<U, V> localExecutionContext, PathImpl path) {
-		BeanMetaData<U> beanMetaData = getBeanMetaData( localExecutionContext.getCurrentBeanType() );
+	private <T, U, V> void validateConstraintsForNonDefaultGroup(ValidationContext<T> validationContext, ValueContext<U, V> valueContext, PathImpl path) {
+		BeanMetaData<U> beanMetaData = getBeanMetaData( valueContext.getCurrentBeanType() );
 		for ( MetaConstraint<U, ? extends Annotation> metaConstraint : beanMetaData.getMetaConstraintsAsList() ) {
-			validateConstraint( globalExecutionContext, localExecutionContext, metaConstraint, path );
+			validateConstraint( validationContext, valueContext, metaConstraint, path );
 		}
 	}
 
-	private <T, U, V> boolean validateConstraint(GlobalExecutionContext<T> globalExecutionContext, LocalExecutionContext<U, V> localExecutionContext, MetaConstraint<U, ?> metaConstraint, PathImpl path) {
+	private <T, U, V> boolean validateConstraint(ValidationContext<T> validationContext, ValueContext<U, V> valueContext, MetaConstraint<U, ?> metaConstraint, PathImpl path) {
 		boolean validationSuccessful = true;
 		PathImpl newPath;
 
@@ -327,16 +320,16 @@ public class ValidatorImpl implements Validator {
 			}
 		}
 
-		localExecutionContext.setPropertyPath( newPath );
-		if ( isValidationRequired( globalExecutionContext, localExecutionContext, metaConstraint ) ) {
-			Object valueToValidate = metaConstraint.getValue( localExecutionContext.getCurrentBean() );
-			localExecutionContext.setCurrentValidatedValue( ( V ) valueToValidate );
-			validationSuccessful = metaConstraint.validateConstraint( globalExecutionContext, localExecutionContext );
+		valueContext.setPropertyPath( newPath );
+		if ( isValidationRequired( validationContext, valueContext, metaConstraint ) ) {
+			Object valueToValidate = metaConstraint.getValue( valueContext.getCurrentBean() );
+			valueContext.setCurrentValidatedValue( ( V ) valueToValidate );
+			validationSuccessful = metaConstraint.validateConstraint( validationContext, valueContext );
 		}
-		globalExecutionContext.markProcessed(
-				localExecutionContext.getCurrentBean(),
-				localExecutionContext.getCurrentGroup(),
-				localExecutionContext.getPropertyPath()
+		validationContext.markProcessed(
+				valueContext.getCurrentBean(),
+				valueContext.getCurrentGroup(),
+				valueContext.getPropertyPath()
 		);
 
 		return validationSuccessful;
@@ -346,12 +339,12 @@ public class ValidatorImpl implements Validator {
 	 * Validates all cascaded constraints for the given bean using the current group set in the execution context.
 	 * This method must always be called after validateConstraints for the same context.
 	 *
-	 * @param globalExecutionContext The execution context
-	 * @param localExecutionContext Collected information for single validation
+	 * @param validationContext The execution context
+	 * @param valueContext Collected information for single validation
 	 * @param path The current path of the validation.
 	 */
-	private <T, U, V> void validateCascadedConstraints(GlobalExecutionContext<T> globalExecutionContext, LocalExecutionContext<U, V> localExecutionContext, PathImpl path) {
-		List<Member> cascadedMembers = getBeanMetaData( localExecutionContext.getCurrentBeanType() )
+	private <T, U, V> void validateCascadedConstraints(ValidationContext<T> validationContext, ValueContext<U, V> valueContext, PathImpl path) {
+		List<Member> cascadedMembers = getBeanMetaData( valueContext.getCurrentBeanType() )
 				.getCascadedMembers();
 		for ( Member member : cascadedMembers ) {
 			Type type = ReflectionHelper.typeOf( member );
@@ -363,18 +356,18 @@ public class ValidatorImpl implements Validator {
 				newPath = PathImpl.createShallowCopy( path );
 				newPath.addNode( new NodeImpl( ReflectionHelper.getPropertyName( member ) ) );
 			}
-			localExecutionContext.setPropertyPath( newPath );
-			if ( isCascadeRequired( globalExecutionContext, localExecutionContext, member ) ) {
-				Object value = ReflectionHelper.getValue( member, localExecutionContext.getCurrentBean() );
+			valueContext.setPropertyPath( newPath );
+			if ( isCascadeRequired( validationContext, valueContext, member ) ) {
+				Object value = ReflectionHelper.getValue( member, valueContext.getCurrentBean() );
 				if ( value != null ) {
-					Iterator<?> iter = createIteratorForCascadedValue( localExecutionContext, type, value );
+					Iterator<?> iter = createIteratorForCascadedValue( valueContext, type, value );
 					boolean isIndexable = isIndexable( type );
 					validateCascadedConstraint(
-							globalExecutionContext,
+							validationContext,
 							iter,
 							isIndexable,
-							localExecutionContext.getCurrentGroup(),
-							localExecutionContext.getPropertyPath()
+							valueContext.getCurrentGroup(),
+							valueContext.getPropertyPath()
 					);
 				}
 			}
@@ -391,7 +384,7 @@ public class ValidatorImpl implements Validator {
 	 *
 	 * @return An iterator over the value of a cascaded property.
 	 */
-	private <U, V> Iterator<?> createIteratorForCascadedValue(LocalExecutionContext<U, V> context, Type type, Object value) {
+	private <U, V> Iterator<?> createIteratorForCascadedValue(ValueContext<U, V> context, Type type, Object value) {
 		Iterator<?> iter;
 		if ( ReflectionHelper.isIterable( type ) ) {
 			iter = ( ( Iterable<?> ) value ).iterator();
@@ -438,7 +431,7 @@ public class ValidatorImpl implements Validator {
 	}
 
 	@SuppressWarnings("RedundantArrayCreation")
-	private <T> void validateCascadedConstraint(GlobalExecutionContext<T> context, Iterator<?> iter, boolean isIndexable, Class<?> currentGroup, PathImpl currentPath) {
+	private <T> void validateCascadedConstraint(ValidationContext<T> context, Iterator<?> iter, boolean isIndexable, Class<?> currentGroup, PathImpl currentPath) {
 		Object value;
 		Integer index;
 		Object mapKey;
@@ -548,21 +541,21 @@ public class ValidatorImpl implements Validator {
 
 		for ( Class<?> groupClass : groupList ) {
 			for ( MetaConstraint<T, ?> metaConstraint : metaConstraints ) {
-				GlobalExecutionContext<T> context = GlobalExecutionContext.getContextForValidateProperty(
+				ValidationContext<T> context = ValidationContext.getContextForValidateProperty(
 						object,
 						messageInterpolator,
 						constraintValidatorFactory,
 						cachedTraversableResolver
 				);
-				LocalExecutionContext<U, V> localContext = LocalExecutionContext.getLocalExecutionContext(
+				ValueContext<U, V> valueContext = ValueContext.getLocalExecutionContext(
 						hostingBeanInstance
 				);
-				localContext.setPropertyPath( path );
-				localContext.setCurrentGroup( groupClass );
-				if ( isValidationRequired( context, localContext, metaConstraint ) ) {
-					Object valueToValidate = metaConstraint.getValue( localContext.getCurrentBean() );
-					localContext.setCurrentValidatedValue( ( V ) valueToValidate );
-					metaConstraint.validateConstraint( context, localContext );
+				valueContext.setPropertyPath( path );
+				valueContext.setCurrentGroup( groupClass );
+				if ( isValidationRequired( context, valueContext, metaConstraint ) ) {
+					Object valueToValidate = metaConstraint.getValue( valueContext.getCurrentBean() );
+					valueContext.setCurrentValidatedValue( ( V ) valueToValidate );
+					metaConstraint.validateConstraint( context, valueContext );
 					failingConstraintViolations.addAll( context.getFailingConstraints() );
 				}
 			}
@@ -644,15 +637,15 @@ public class ValidatorImpl implements Validator {
 
 		for ( Class<?> groupClass : groupList ) {
 			for ( MetaConstraint<U, ?> metaConstraint : metaConstraints ) {
-				GlobalExecutionContext<U> context = GlobalExecutionContext.getContextForValidateValue(
+				ValidationContext<U> context = ValidationContext.getContextForValidateValue(
 						beanType, messageInterpolator, constraintValidatorFactory, cachedTraversableResolver
 				);
-				LocalExecutionContext<U, V> localContext = LocalExecutionContext.getLocalExecutionContext( beanType );
-				localContext.setPropertyPath( path );
-				localContext.setCurrentGroup( groupClass );
-				localContext.setCurrentValidatedValue( value );
-				if ( isValidationRequired( context, localContext, metaConstraint ) ) {
-					metaConstraint.validateConstraint( context, localContext );
+				ValueContext<U, V> valueContext = ValueContext.getLocalExecutionContext( beanType );
+				valueContext.setPropertyPath( path );
+				valueContext.setCurrentGroup( groupClass );
+				valueContext.setCurrentValidatedValue( value );
+				if ( isValidationRequired( context, valueContext, metaConstraint ) ) {
+					metaConstraint.validateConstraint( context, valueContext );
 					failingConstraintViolations.addAll( context.getFailingConstraints() );
 				}
 			}
@@ -748,23 +741,23 @@ public class ValidatorImpl implements Validator {
 		return new SingleThreadCachedTraversableResolver( traversableResolver );
 	}
 
-	private boolean isValidationRequired(GlobalExecutionContext globalContext, LocalExecutionContext localContext, MetaConstraint metaConstraint) {
-		if ( !metaConstraint.getGroupList().contains( localContext.getCurrentGroup() ) ) {
+	private boolean isValidationRequired(ValidationContext validationContext, ValueContext valueContext, MetaConstraint metaConstraint) {
+		if ( !metaConstraint.getGroupList().contains( valueContext.getCurrentGroup() ) ) {
 			return false;
 		}
 
 		boolean isReachable;
 
-		Path pathToObject = localContext.getPropertyPath().getPathWithoutLeafNode();
+		Path pathToObject = valueContext.getPropertyPath().getPathWithoutLeafNode();
 		if ( pathToObject == null ) {
 			pathToObject = PathImpl.createNewPath( null );
 		}
 
 		try {
-			isReachable = globalContext.getTraversableResolver().isReachable(
-					localContext.getCurrentBean(),
-					localContext.getPropertyPath().getLeafNode(),
-					globalContext.getRootBeanClass(),
+			isReachable = validationContext.getTraversableResolver().isReachable(
+					valueContext.getCurrentBean(),
+					valueContext.getPropertyPath().getLeafNode(),
+					validationContext.getRootBeanClass(),
 					pathToObject,
 					metaConstraint.getElementType()
 			);
@@ -776,21 +769,21 @@ public class ValidatorImpl implements Validator {
 		return isReachable;
 	}
 
-	private boolean isCascadeRequired(GlobalExecutionContext globalContext, LocalExecutionContext localContext, Member member) {
+	private boolean isCascadeRequired(ValidationContext validationContext, ValueContext valueContext, Member member) {
 		final ElementType type = member instanceof Field ? ElementType.FIELD : ElementType.METHOD;
 		boolean isReachable;
 		boolean isCascadable;
 
-		Path pathToObject = localContext.getPropertyPath().getPathWithoutLeafNode();
+		Path pathToObject = valueContext.getPropertyPath().getPathWithoutLeafNode();
 		if ( pathToObject == null ) {
 			pathToObject = PathImpl.createNewPath( null );
 		}
 
 		try {
-			isReachable = globalContext.getTraversableResolver().isReachable(
-					localContext.getCurrentBean(),
-					localContext.getPropertyPath().getLeafNode(),
-					globalContext.getRootBeanClass(),
+			isReachable = validationContext.getTraversableResolver().isReachable(
+					valueContext.getCurrentBean(),
+					valueContext.getPropertyPath().getLeafNode(),
+					validationContext.getRootBeanClass(),
 					pathToObject,
 					type
 			);
@@ -800,10 +793,10 @@ public class ValidatorImpl implements Validator {
 		}
 
 		try {
-			isCascadable = globalContext.getTraversableResolver().isCascadable(
-					localContext.getCurrentBean(),
-					localContext.getPropertyPath().getLeafNode(),
-					globalContext.getRootBeanClass(),
+			isCascadable = validationContext.getTraversableResolver().isCascadable(
+					valueContext.getCurrentBean(),
+					valueContext.getPropertyPath().getLeafNode(),
+					validationContext.getRootBeanClass(),
 					pathToObject,
 					type
 			);
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/engine/ValueContext.java b/hibernate-validator/src/main/java/org/hibernate/validator/engine/ValueContext.java
new file mode 100644
index 0000000..46a54b9
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/engine/ValueContext.java
@@ -0,0 +1,136 @@
+// $Id: ValueContext.java 19313 2010-04-28 11:05:26Z hardy.ferentschik $
+/*
+* 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.engine;
+
+import java.lang.annotation.ElementType;
+import javax.validation.groups.Default;
+
+/**
+ * An instance of this class is used to collect all the relevant information for validating a single entity/bean.
+ *
+ * @author Hardy Ferentschik
+ */
+public class ValueContext<T, V> {
+
+	/**
+	 * The current bean which gets validated. This is the bean hosting the constraints which get validated.
+	 */
+	private final T currentBean;
+
+	/**
+	 * The class of the current bean.
+	 */
+	private final Class<T> currentBeanType;
+
+	/**
+	 * The current property path we are validating.
+	 */
+	private PathImpl propertyPath;
+
+	/**
+	 * The current group we are validating.
+	 */
+	private Class<?> currentGroup;
+
+	/**
+	 * The value which gets currently evaluated.
+	 */
+	private V currentValue;
+
+	/**
+	 * The {@code ElementType} the constraint was defined on
+	 */
+	private ElementType elementType;
+
+	public static <T, V> ValueContext<T, V> getLocalExecutionContext(T value) {
+		@SuppressWarnings("unchecked")
+		Class<T> rootBeanClass = ( Class<T> ) value.getClass();
+		return new ValueContext<T, V>( value, rootBeanClass );
+	}
+
+	public static <T, V> ValueContext<T, V> getLocalExecutionContext(Class<T> type) {
+		return new ValueContext<T, V>( null, type );
+	}
+
+	public ValueContext(T currentBean, Class<T> currentBeanType) {
+		this.currentBean = currentBean;
+		this.currentBeanType = currentBeanType;
+	}
+
+	public PathImpl getPropertyPath() {
+		return propertyPath;
+	}
+
+	public Class<?> getCurrentGroup() {
+		return currentGroup;
+	}
+
+	public T getCurrentBean() {
+		return currentBean;
+	}
+
+	public Class<T> getCurrentBeanType() {
+		return currentBeanType;
+	}
+
+	public V getCurrentValidatedValue() {
+		return currentValue;
+	}
+
+	public void setPropertyPath(PathImpl propertyPath) {
+		this.propertyPath = propertyPath;
+	}
+
+	public void setCurrentGroup(Class<?> currentGroup) {
+		this.currentGroup = currentGroup;
+	}
+
+	public void setCurrentValidatedValue(V currentValue) {
+		this.currentValue = currentValue;
+	}
+
+	public void markCurrentPropertyAsIterable() {
+		propertyPath.getLeafNode().setInIterable( true );
+	}
+
+	public boolean validatingDefault() {
+		return getCurrentGroup() != null && getCurrentGroup().getName().equals( Default.class.getName() );
+	}
+
+	public ElementType getElementType() {
+		return elementType;
+	}
+
+	public void setElementType(ElementType elementType) {
+		this.elementType = elementType;
+	}
+
+	@Override
+	public String toString() {
+		final StringBuilder sb = new StringBuilder();
+		sb.append( "ValueContext" );
+		sb.append( "{currentBean=" ).append( currentBean );
+		sb.append( ", currentBeanType=" ).append( currentBeanType );
+		sb.append( ", propertyPath=" ).append( propertyPath );
+		sb.append( ", currentGroup=" ).append( currentGroup );
+		sb.append( ", currentValue=" ).append( currentValue );
+		sb.append( ", elementType=" ).append( elementType );
+		sb.append( '}' );
+		return sb.toString();
+	}
+}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/engine/groups/Group.java b/hibernate-validator/src/main/java/org/hibernate/validator/engine/groups/Group.java
index bce5eca..2d8b36b 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/engine/groups/Group.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/engine/groups/Group.java
@@ -1,4 +1,4 @@
-// $Id: Group.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: Group.java 19019 2010-03-18 16:36:03Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -80,9 +80,6 @@ public class Group {
 
 	@Override
 	public String toString() {
-		return "Group{" +
-				"groups=" + group +
-				", sequence=" + sequence +
-				'}';
+		return "Group{" + "group=" + group.getName() + '}';
 	}
 }
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/engine/groups/GroupChain.java b/hibernate-validator/src/main/java/org/hibernate/validator/engine/groups/GroupChain.java
index 0c7620e..43ac599 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/engine/groups/GroupChain.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/engine/groups/GroupChain.java
@@ -1,4 +1,4 @@
-// $Id: GroupChain.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: GroupChain.java 19610 2010-05-26 09:43:07Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -30,7 +30,7 @@ import javax.validation.groups.Default;
  *
  * @author Hardy Ferentschik
  */
-public class GroupChain {
+public final class GroupChain {
 
 	/**
 	 * The list of single groups to be used this validation.
@@ -51,13 +51,13 @@ public class GroupChain {
 		return sequenceMap.values().iterator();
 	}
 
-	void insertGroup(Group group) {
+	public void insertGroup(Group group) {
 		if ( !groupList.contains( group ) ) {
 			groupList.add( group );
 		}
 	}
 
-	void insertSequence(List<Group> groups) {
+	public void insertSequence(List<Group> groups) {
 		if ( groups == null || groups.size() == 0 ) {
 			return;
 		}
@@ -78,11 +78,11 @@ public class GroupChain {
 	public void assertDefaultGroupSequenceIsExpandable(List<Class<?>> defaultGroupSequence) {
 		for ( Map.Entry<Class<?>, List<Group>> entry : sequenceMap.entrySet() ) {
 			Class<?> sequence = entry.getKey();
-			List<Group> groupList = entry.getValue();
+			List<Group> groups = entry.getValue();
 			List<Group> defaultGroupList = buildTempGroupList( defaultGroupSequence, sequence );
-			int defaultGroupIndex = containsDefaultGroupAtIndex( sequence, groupList );
+			int defaultGroupIndex = containsDefaultGroupAtIndex( sequence, groups );
 			if ( defaultGroupIndex != -1 ) {
-				ensureDefaultGroupSequenceIsExpandable( groupList, defaultGroupList, defaultGroupIndex );
+				ensureDefaultGroupSequenceIsExpandable( groups, defaultGroupList, defaultGroupIndex );
 			}
 		}
 	}
@@ -113,11 +113,11 @@ public class GroupChain {
 	}
 
 	private List<Group> buildTempGroupList(List<Class<?>> defaultGroupSequence, Class<?> sequence) {
-		List<Group> groupList = new ArrayList<Group>();
+		List<Group> groups = new ArrayList<Group>();
 		for ( Class<?> clazz : defaultGroupSequence ) {
 			Group g = new Group( clazz, sequence );
-			groupList.add( g );
+			groups.add( g );
 		}
-		return groupList;
+		return groups;
 	}
 }
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/engine/groups/GroupChainGenerator.java b/hibernate-validator/src/main/java/org/hibernate/validator/engine/groups/GroupChainGenerator.java
index 98efd01..c736062 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/engine/groups/GroupChainGenerator.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/engine/groups/GroupChainGenerator.java
@@ -1,4 +1,4 @@
-// $Id: GroupChainGenerator.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: GroupChainGenerator.java 19019 2010-03-18 16:36:03Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -27,7 +27,7 @@ import javax.validation.GroupSequence;
 import javax.validation.ValidationException;
 
 /**
- * Used to determine the execution order.
+ * Helper class used to resolve groups and sequences into a single chain of groups which can then be validated.
  *
  * @author Hardy Ferentschik
  */
@@ -35,6 +35,13 @@ public class GroupChainGenerator {
 
 	private final Map<Class<?>, List<Group>> resolvedSequences = new HashMap<Class<?>, List<Group>>();
 
+	/**
+	 * Generates a chain of groups to be validated given the specified validation groups.
+	 *
+	 * @param groups The groups specified at the validation call.
+	 *
+	 * @return an instance of {@code GroupChain} defining the order in which validation has to occur.
+	 */
 	public GroupChain getGroupChainFor(Collection<Class<?>> groups) {
 		if ( groups == null || groups.size() == 0 ) {
 			throw new IllegalArgumentException( "At least one groups has to be specified." );
@@ -48,24 +55,34 @@ public class GroupChainGenerator {
 
 		GroupChain chain = new GroupChain();
 		for ( Class<?> clazz : groups ) {
-			if ( clazz.getAnnotation( GroupSequence.class ) == null ) {
+			if ( isGroupSequence( clazz ) ) {
+				insertSequence( clazz, chain );
+			}
+			else {
 				Group group = new Group( clazz );
 				chain.insertGroup( group );
 				insertInheritedGroups( clazz, chain );
 			}
-			else {
-				insertSequence( clazz, chain );
-			}
 		}
 
 		return chain;
 	}
 
+	private boolean isGroupSequence(Class<?> clazz) {
+		return clazz.getAnnotation( GroupSequence.class ) != null;
+	}
+
+	/**
+	 * Recursively add inherited groups into the group chain.
+	 *
+	 * @param clazz The group interface
+	 * @param chain The group chain we are currently building.
+	 */
 	private void insertInheritedGroups(Class<?> clazz, GroupChain chain) {
-		for ( Class<?> extendedInterface : clazz.getInterfaces() ) {
-			Group group = new Group( extendedInterface );
+		for ( Class<?> inheritedGroup : clazz.getInterfaces() ) {
+			Group group = new Group( inheritedGroup );
 			chain.insertGroup( group );
-			insertInheritedGroups( extendedInterface, chain );
+			insertInheritedGroups( inheritedGroup, chain );
 		}
 	}
 
@@ -76,10 +93,34 @@ public class GroupChainGenerator {
 		}
 		else {
 			sequence = resolveSequence( clazz, new ArrayList<Class<?>>() );
+			// we expand the inherited groups only after we determined whether the sequence is expandable
+			sequence = expandInhertitedGroups( sequence );
 		}
 		chain.insertSequence( sequence );
 	}
 
+	private List<Group> expandInhertitedGroups(List<Group> sequence) {
+		List<Group> expandedGroup = new ArrayList<Group>();
+		for ( Group group : sequence ) {
+			expandedGroup.add( group );
+			addInheritedGroups( group, expandedGroup );
+		}
+		return expandedGroup;
+	}
+
+	private void addInheritedGroups(Group group, List<Group> expandedGroups) {
+		for ( Class<?> inheritedGroup : group.getGroup().getInterfaces() ) {
+			if ( isGroupSequence( inheritedGroup ) ) {
+				throw new GroupDefinitionException(
+						"Sequence definitions are not allowed as composing parts of a sequence."
+				);
+			}
+			Group g = new Group( inheritedGroup, group.getSequence() );
+			expandedGroups.add( g );
+			addInheritedGroups( g, expandedGroups );
+		}
+	}
+
 	private List<Group> resolveSequence(Class<?> group, List<Class<?>> processedSequences) {
 		if ( processedSequences.contains( group ) ) {
 			throw new GroupDefinitionException( "Cyclic dependency in groups definition" );
@@ -91,24 +132,36 @@ public class GroupChainGenerator {
 		GroupSequence sequenceAnnotation = group.getAnnotation( GroupSequence.class );
 		Class<?>[] sequenceArray = sequenceAnnotation.value();
 		for ( Class<?> clazz : sequenceArray ) {
-			if ( clazz.getAnnotation( GroupSequence.class ) == null ) {
-				resolvedGroupSequence.add( new Group( clazz, group ) );
+			if ( isGroupSequence( clazz ) ) {
+				List<Group> tmpSequence = resolveSequence( clazz, processedSequences );
+				addGroups( resolvedGroupSequence, tmpSequence );
 			}
 			else {
-				List<Group> tmpSequence = resolveSequence( clazz, processedSequences );
-				addTmpSequence( resolvedGroupSequence, tmpSequence );
+				List<Group> list = new ArrayList<Group>();
+				list.add( new Group( clazz, group ) );
+				addGroups( resolvedGroupSequence, list );
 			}
 		}
 		resolvedSequences.put( group, resolvedGroupSequence );
 		return resolvedGroupSequence;
 	}
 
-	private void addTmpSequence(List<Group> resolvedGroupSequence, List<Group> tmpSequence) {
-		for ( Group tmpGroup : tmpSequence ) {
-			if ( resolvedGroupSequence.contains( tmpGroup ) && resolvedGroupSequence.indexOf( tmpGroup ) < resolvedGroupSequence.size() - 1  ) {
-					throw new GroupDefinitionException( "Unable to expand group sequence." );
+	private void addGroups(List<Group> resolvedGroupSequence, List<Group> groups) {
+		for ( Group tmpGroup : groups ) {
+			if ( resolvedGroupSequence.contains( tmpGroup ) && resolvedGroupSequence.indexOf( tmpGroup ) < resolvedGroupSequence
+					.size() - 1 ) {
+				throw new GroupDefinitionException( "Unable to expand group sequence." );
 			}
 			resolvedGroupSequence.add( tmpGroup );
 		}
 	}
+
+	@Override
+	public String toString() {
+		final StringBuilder sb = new StringBuilder();
+		sb.append( "GroupChainGenerator" );
+		sb.append( "{resolvedSequences=" ).append( resolvedSequences );
+		sb.append( '}' );
+		return sb.toString();
+	}
 }
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/engine/groups/package.html b/hibernate-validator/src/main/java/org/hibernate/validator/engine/groups/package.html
index e8b4928..7247880 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/engine/groups/package.html
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/engine/groups/package.html
@@ -1,26 +1,26 @@
+<!--
+  ~ $Id: package.html 19596 2010-05-24 10:31:09Z hardy.ferentschik $
+  ~
+  ~ 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.
+-->
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html>
 <head>
-<!--
-
-  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.
-
--->
 </head>
 <body>
-This package contains helper classes for the processing of groups.
+Helper classes for the processing of groups.
 </body>
 </html>
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/engine/package.html b/hibernate-validator/src/main/java/org/hibernate/validator/engine/package.html
index 4966605..c7bf2f0 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/engine/package.html
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/engine/package.html
@@ -1,26 +1,26 @@
+<!--
+  ~ $Id: package.html 19596 2010-05-24 10:31:09Z hardy.ferentschik $
+  ~
+  ~ 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.
+-->
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html>
 <head>
-<!--
-
-  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.
-
--->
 </head>
 <body>
-This package contains the implementing classes for the core interfaces of JSR-303.
+Implementations for the core interfaces of JSR-303.
 </body>
 </html>
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/engine/resolver/DefaultTraversableResolver.java b/hibernate-validator/src/main/java/org/hibernate/validator/engine/resolver/DefaultTraversableResolver.java
index ead2eb3..366ae30 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/engine/resolver/DefaultTraversableResolver.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/engine/resolver/DefaultTraversableResolver.java
@@ -1,4 +1,4 @@
-// $Id: DefaultTraversableResolver.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: DefaultTraversableResolver.java 19573 2010-05-20 22:13:26Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -18,7 +18,6 @@
 package org.hibernate.validator.engine.resolver;
 
 import java.lang.annotation.ElementType;
-import java.security.AccessController;
 import javax.validation.Path;
 import javax.validation.TraversableResolver;
 import javax.validation.ValidationException;
@@ -26,8 +25,7 @@ import javax.validation.ValidationException;
 import org.slf4j.Logger;
 
 import org.hibernate.validator.util.LoggerFactory;
-import org.hibernate.validator.util.NewInstance;
-import org.hibernate.validator.util.LoadClass;
+import org.hibernate.validator.util.ReflectionHelper;
 
 /**
  * A JPA 2 aware <code>TraversableResolver</code>.
@@ -64,7 +62,7 @@ public class DefaultTraversableResolver implements TraversableResolver {
 	 */
 	private void detectJPA() {
 		try {
-			loadClass( PERSISTENCE_UTIL_CLASS_NAME, this.getClass() );
+			ReflectionHelper.loadClass( PERSISTENCE_UTIL_CLASS_NAME, this.getClass() );
 			log.debug( "Found {} on classpath.", PERSISTENCE_UTIL_CLASS_NAME );
 		}
 		catch ( ValidationException e ) {
@@ -76,16 +74,10 @@ public class DefaultTraversableResolver implements TraversableResolver {
 		}
 
 		try {
-			@SuppressWarnings( "unchecked" )
-			Class<? extends TraversableResolver> jpaAwareResolverClass = (Class<? extends TraversableResolver>)
-					loadClass(JPA_AWARE_TRAVERSABLE_RESOLVER_CLASS_NAME, this.getClass() );
-			NewInstance<? extends TraversableResolver> newInstance = NewInstance.action( jpaAwareResolverClass, "" );
-			if ( System.getSecurityManager() != null ) {
-				jpaTraversableResolver = AccessController.doPrivileged( newInstance );
-			}
-			else {
-				jpaTraversableResolver = newInstance.run();
-			}
+			@SuppressWarnings("unchecked")
+			Class<? extends TraversableResolver> jpaAwareResolverClass = ( Class<? extends TraversableResolver> )
+					ReflectionHelper.loadClass( JPA_AWARE_TRAVERSABLE_RESOLVER_CLASS_NAME, this.getClass() );
+			jpaTraversableResolver = ReflectionHelper.newInstance( jpaAwareResolverClass, "" );
 			log.info(
 					"Instantiated an instance of {}.", JPA_AWARE_TRAVERSABLE_RESOLVER_CLASS_NAME
 			);
@@ -98,16 +90,6 @@ public class DefaultTraversableResolver implements TraversableResolver {
 		}
 	}
 
-	private Class<?> loadClass(String className, Class<?> caller) {
-		LoadClass action = LoadClass.action( className, caller );
-		if (System.getSecurityManager() != null) {
-			return AccessController.doPrivileged( action );
-		}
-		else {
-			return action.run();
-		}
-	}
-
 	public boolean isReachable(Object traversableObject, Path.Node traversableProperty, Class<?> rootBeanType, Path pathToTraversableObject, ElementType elementType) {
 		return jpaTraversableResolver == null || jpaTraversableResolver.isReachable(
 				traversableObject, traversableProperty, rootBeanType, pathToTraversableObject, elementType
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/engine/resolver/JPATraversableResolver.java b/hibernate-validator/src/main/java/org/hibernate/validator/engine/resolver/JPATraversableResolver.java
index 1d46a07..9705bef 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/engine/resolver/JPATraversableResolver.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/engine/resolver/JPATraversableResolver.java
@@ -1,4 +1,4 @@
-// $Id: JPATraversableResolver.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: JPATraversableResolver.java 19380 2010-05-06 10:31:32Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -19,19 +19,48 @@ package org.hibernate.validator.engine.resolver;
 
 import java.lang.annotation.ElementType;
 import javax.persistence.Persistence;
-import javax.validation.TraversableResolver;
 import javax.validation.Path;
+import javax.validation.TraversableResolver;
+
+import org.slf4j.Logger;
+
+import org.hibernate.validator.util.LoggerFactory;
 
 /**
+ * An implementation of {@code TraversableResolver} which is aware of JPA 2 and utilizes {@code PersistenceUtil} to get
+ * query the reachability of a property.
+ * This resolver will be automatically enabled if JPA 2 is on the classpath and the {@code DefaultTraversableResolver} is
+ * used.
+ *
  * @author Hardy Ferentschik
  * @author Emmanuel Bernard
  */
 public class JPATraversableResolver implements TraversableResolver {
+	private static final Logger log = LoggerFactory.make();
+
+	public boolean isReachable(Object traversableObject,
+							   Path.Node traversableProperty,
+							   Class<?> rootBeanType,
+							   Path pathToTraversableObject,
+							   ElementType elementType) {
+		if ( log.isTraceEnabled() ) {
+			log.trace(
+					"Calling isReachable on object {} with node name {}",
+					traversableObject,
+					traversableProperty.getName()
+			);
+		}
 
-	// TODO Check the call to PersistenceUtil. traversableProperty.getName() is this correct?
-	public boolean isReachable(Object traversableObject, Path.Node traversableProperty, Class<?> rootBeanType, Path pathToTraversableObject, ElementType elementType) {
-		return traversableObject == null ||
-				Persistence.getPersistenceUtil().isLoaded( traversableObject, traversableProperty.getName() );
+		// we have to check traversableProperty.getName() against null to check the root gets validated (see HV-266)
+		// also check the element type, if it is ElementType.TYPE then we don't have to call is reachable since we have
+		// a class level constraint (HV-305)
+		if ( traversableObject == null || traversableProperty.getName() == null
+				|| ElementType.TYPE.equals( elementType ) ) {
+			return true;
+		}
+		else {
+			return Persistence.getPersistenceUtil().isLoaded( traversableObject, traversableProperty.getName() );
+		}
 	}
 
 	public boolean isCascadable(Object traversableObject, Path.Node traversableProperty, Class<?> rootBeanType, Path pathToTraversableObject, ElementType elementType) {
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/engine/resolver/SingleThreadCachedTraversableResolver.java b/hibernate-validator/src/main/java/org/hibernate/validator/engine/resolver/SingleThreadCachedTraversableResolver.java
index 861946d..cc8650e 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/engine/resolver/SingleThreadCachedTraversableResolver.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/engine/resolver/SingleThreadCachedTraversableResolver.java
@@ -1,4 +1,4 @@
-// $Id: SingleThreadCachedTraversableResolver.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: SingleThreadCachedTraversableResolver.java 19610 2010-05-26 09:43:07Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -94,7 +94,7 @@ public class SingleThreadCachedTraversableResolver implements TraversableResolve
 		return cachedLH.isCascadable;
 	}
 
-	private static class TraversableHolder {
+	private static final class TraversableHolder {
 		private final Object traversableObject;
 		private final Path.Node traversableProperty;
 		private final Class<?> rootBeanType;
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/engine/resolver/package.html b/hibernate-validator/src/main/java/org/hibernate/validator/engine/resolver/package.html
index d2142c9..0beec9e 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/engine/resolver/package.html
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/engine/resolver/package.html
@@ -1,26 +1,26 @@
+<!--
+  ~ $Id: package.html 19596 2010-05-24 10:31:09Z hardy.ferentschik $
+  ~
+  ~ 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.
+-->
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html>
 <head>
-<!--
-
-  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.
-
--->
 </head>
 <body>
-This package contains different implementations of the TraversableResolver interface.
+Various implementations of the TraversableResolver interface.
 </body>
 </html>
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/messageinterpolation/ResourceBundleMessageInterpolator.java b/hibernate-validator/src/main/java/org/hibernate/validator/messageinterpolation/ResourceBundleMessageInterpolator.java
new file mode 100644
index 0000000..6af96d5
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/messageinterpolation/ResourceBundleMessageInterpolator.java
@@ -0,0 +1,288 @@
+// $Id: ResourceBundleMessageInterpolator.java 19777 2010-06-21 13:35:31Z hardy.ferentschik $
+/*
+* 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.messageinterpolation;
+
+import java.util.Locale;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.util.WeakHashMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import javax.validation.MessageInterpolator;
+
+import org.hibernate.validator.resourceloading.PlatformResourceBundleLocator;
+import org.hibernate.validator.resourceloading.ResourceBundleLocator;
+
+/**
+ * Resource bundle backed message interpolator.
+ *
+ * @author Emmanuel Bernard
+ * @author Hardy Ferentschik
+ * @author Gunnar Morling
+ */
+public class ResourceBundleMessageInterpolator implements MessageInterpolator {
+
+	/**
+	 * The name of the default message bundle.
+	 */
+	public static final String DEFAULT_VALIDATION_MESSAGES = "org.hibernate.validator.ValidationMessages";
+
+	/**
+	 * The name of the user-provided message bundle as defined in the specification.
+	 */
+	public static final String USER_VALIDATION_MESSAGES = "ValidationMessages";
+
+	/**
+	 * Regular expression used to do message interpolation.
+	 */
+	private static final Pattern MESSAGE_PARAMETER_PATTERN = Pattern.compile( "(\\{[^\\}]+?\\})" );
+
+	/**
+	 * The default locale for the current user.
+	 */
+	private final Locale defaultLocale;
+
+	/**
+	 * Loads user-specified resource bundles.
+	 */
+	private final ResourceBundleLocator userResourceBundleLocator;
+
+	/**
+	 * Loads built-in resource bundles.
+	 */
+	private final ResourceBundleLocator defaultResourceBundleLocator;
+
+	/**
+	 * Step 1-3 of message interpolation can be cached. We do this in this map.
+	 */
+	private final Map<LocalisedMessage, String> resolvedMessages = new WeakHashMap<LocalisedMessage, String>();
+
+	/**
+	 * Flag indicating whether this interpolator should chance some of the interpolation steps.
+	 */
+	private final boolean cacheMessages;
+
+	public ResourceBundleMessageInterpolator() {
+		this( null );
+	}
+
+	public ResourceBundleMessageInterpolator(ResourceBundleLocator userResourceBundleLocator) {
+		this( userResourceBundleLocator, true );
+	}
+
+	public ResourceBundleMessageInterpolator(ResourceBundleLocator userResourceBundleLocator, boolean cacheMessages) {
+
+		defaultLocale = Locale.getDefault();
+
+		if ( userResourceBundleLocator == null ) {
+			this.userResourceBundleLocator = new PlatformResourceBundleLocator( USER_VALIDATION_MESSAGES );
+		}
+		else {
+			this.userResourceBundleLocator = userResourceBundleLocator;
+		}
+
+		this.defaultResourceBundleLocator = new PlatformResourceBundleLocator( DEFAULT_VALIDATION_MESSAGES );
+		this.cacheMessages = cacheMessages;
+	}
+
+	public String interpolate(String message, Context context) {
+		// probably no need for caching, but it could be done by parameters since the map
+		// is immutable and uniquely built per Validation definition, the comparison has to be based on == and not equals though
+		return interpolateMessage( message, context.getConstraintDescriptor().getAttributes(), defaultLocale );
+	}
+
+	public String interpolate(String message, Context context, Locale locale) {
+		return interpolateMessage( message, context.getConstraintDescriptor().getAttributes(), locale );
+	}
+
+	/**
+	 * Runs the message interpolation according to algorithm specified in JSR 303.
+	 * <br/>
+	 * Note:
+	 * <br/>
+	 * Look-ups in user bundles is recursive whereas look-ups in default bundle are not!
+	 *
+	 * @param message the message to interpolate
+	 * @param annotationParameters the parameters of the annotation for which to interpolate this message
+	 * @param locale the {@code Locale} to use for the resource bundle.
+	 *
+	 * @return the interpolated message.
+	 */
+	private String interpolateMessage(String message, Map<String, Object> annotationParameters, Locale locale) {
+		LocalisedMessage localisedMessage = new LocalisedMessage( message, locale );
+		String resolvedMessage = null;
+
+		if ( cacheMessages ) {
+			resolvedMessage = resolvedMessages.get( localisedMessage );
+		}
+
+		// if the message is not already in the cache we have to run step 1-3 of the message resolution 
+		if ( resolvedMessage == null ) {
+			ResourceBundle userResourceBundle = userResourceBundleLocator
+					.getResourceBundle( locale );
+			ResourceBundle defaultResourceBundle = defaultResourceBundleLocator
+					.getResourceBundle( locale );
+
+			String userBundleResolvedMessage;
+			resolvedMessage = message;
+			boolean evaluatedDefaultBundleOnce = false;
+			do {
+				// search the user bundle recursive (step1)
+				userBundleResolvedMessage = replaceVariables(
+						resolvedMessage, userResourceBundle, locale, true
+				);
+
+				// exit condition - we have at least tried to validate against the default bundle and there was no
+				// further replacements
+				if ( evaluatedDefaultBundleOnce
+						&& !hasReplacementTakenPlace( userBundleResolvedMessage, resolvedMessage ) ) {
+					break;
+				}
+
+				// search the default bundle non recursive (step2)
+				resolvedMessage = replaceVariables( userBundleResolvedMessage, defaultResourceBundle, locale, false );
+				evaluatedDefaultBundleOnce = true;
+				if ( cacheMessages ) {
+					resolvedMessages.put( localisedMessage, resolvedMessage );
+				}
+			} while ( true );
+		}
+
+		// resolve annotation attributes (step 4)
+		resolvedMessage = replaceAnnotationAttributes( resolvedMessage, annotationParameters );
+
+		// last but not least we have to take care of escaped literals
+		resolvedMessage = resolvedMessage.replace( "\\{", "{" );
+		resolvedMessage = resolvedMessage.replace( "\\}", "}" );
+		resolvedMessage = resolvedMessage.replace( "\\\\", "\\" );
+		return resolvedMessage;
+	}
+
+	private boolean hasReplacementTakenPlace(String origMessage, String newMessage) {
+		return !origMessage.equals( newMessage );
+	}
+
+	private String replaceVariables(String message, ResourceBundle bundle, Locale locale, boolean recurse) {
+		Matcher matcher = MESSAGE_PARAMETER_PATTERN.matcher( message );
+		StringBuffer sb = new StringBuffer();
+		String resolvedParameterValue;
+		while ( matcher.find() ) {
+			String parameter = matcher.group( 1 );
+			resolvedParameterValue = resolveParameter(
+					parameter, bundle, locale, recurse
+			);
+
+			matcher.appendReplacement( sb, escapeMetaCharacters( resolvedParameterValue ) );
+		}
+		matcher.appendTail( sb );
+		return sb.toString();
+	}
+
+	private String replaceAnnotationAttributes(String message, Map<String, Object> annotationParameters) {
+		Matcher matcher = MESSAGE_PARAMETER_PATTERN.matcher( message );
+		StringBuffer sb = new StringBuffer();
+		while ( matcher.find() ) {
+			String resolvedParameterValue;
+			String parameter = matcher.group( 1 );
+			Object variable = annotationParameters.get( removeCurlyBrace( parameter ) );
+			if ( variable != null ) {
+				resolvedParameterValue = escapeMetaCharacters( variable.toString() );
+			}
+			else {
+				resolvedParameterValue = parameter;
+			}
+			matcher.appendReplacement( sb, resolvedParameterValue );
+		}
+		matcher.appendTail( sb );
+		return sb.toString();
+	}
+
+	private String resolveParameter(String parameterName, ResourceBundle bundle, Locale locale, boolean recurse) {
+		String parameterValue;
+		try {
+			if ( bundle != null ) {
+				parameterValue = bundle.getString( removeCurlyBrace( parameterName ) );
+				if ( recurse ) {
+					parameterValue = replaceVariables( parameterValue, bundle, locale, recurse );
+				}
+			}
+			else {
+				parameterValue = parameterName;
+			}
+		}
+		catch ( MissingResourceException e ) {
+			// return parameter itself
+			parameterValue = parameterName;
+		}
+		return parameterValue;
+	}
+
+	private String removeCurlyBrace(String parameter) {
+		return parameter.substring( 1, parameter.length() - 1 );
+	}
+
+	/**
+	 * @param s The string in which to replace the meta characters '$' and '\'.
+	 *
+	 * @return A string where meta characters relevant for {@link Matcher#appendReplacement} are escaped.
+	 */
+	private String escapeMetaCharacters(String s) {
+		String escapedString = s.replace( "\\", "\\\\" );
+		escapedString = escapedString.replace( "$", "\\$" );
+		return escapedString;
+	}
+
+	private static class LocalisedMessage {
+		private final String message;
+		private final Locale locale;
+
+		LocalisedMessage(String message, Locale locale) {
+			this.message = message;
+			this.locale = locale;
+		}
+
+		@Override
+		public boolean equals(Object o) {
+			if ( this == o ) {
+				return true;
+			}
+			if ( o == null || getClass() != o.getClass() ) {
+				return false;
+			}
+
+			LocalisedMessage that = ( LocalisedMessage ) o;
+
+			if ( locale != null ? !locale.equals( that.locale ) : that.locale != null ) {
+				return false;
+			}
+			if ( message != null ? !message.equals( that.message ) : that.message != null ) {
+				return false;
+			}
+
+			return true;
+		}
+
+		@Override
+		public int hashCode() {
+			int result = message != null ? message.hashCode() : 0;
+			result = 31 * result + ( locale != null ? locale.hashCode() : 0 );
+			return result;
+		}
+	}
+}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/messageinterpolation/package.html b/hibernate-validator/src/main/java/org/hibernate/validator/messageinterpolation/package.html
new file mode 100644
index 0000000..91fe3b8
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/messageinterpolation/package.html
@@ -0,0 +1,27 @@
+<!--
+  ~ $Id: package.html 19596 2010-05-24 10:31:09Z hardy.ferentschik $
+  ~
+  ~ 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.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+<head>
+</head>
+<body>
+Implementations of the MessageInterpolator interface in particular ResourceBundleMessageInterpolator which can be used
+by custom implementations of the interface for delegation. Classes in this package are part of the public Hibernate Validator API.
+</body>
+</html>
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/metadata/BeanMetaDataImpl.java b/hibernate-validator/src/main/java/org/hibernate/validator/metadata/BeanMetaDataImpl.java
index 9b6db89..1c3c614 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/metadata/BeanMetaDataImpl.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/metadata/BeanMetaDataImpl.java
@@ -1,4 +1,4 @@
-// $Id: BeanMetaDataImpl.java 17876 2009-10-29 08:52:03Z hardy.ferentschik $
+// $Id: BeanMetaDataImpl.java 19825 2010-06-24 21:29:29Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -24,7 +24,6 @@ import java.lang.reflect.Field;
 import java.lang.reflect.Member;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
-import java.security.AccessController;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -42,11 +41,8 @@ import javax.validation.metadata.PropertyDescriptor;
 
 import org.slf4j.Logger;
 
-import org.hibernate.validator.util.GetDeclaredFields;
-import org.hibernate.validator.util.GetDeclaredMethods;
 import org.hibernate.validator.util.LoggerFactory;
 import org.hibernate.validator.util.ReflectionHelper;
-import org.hibernate.validator.util.SetAccessibility;
 
 
 /**
@@ -55,8 +51,7 @@ import org.hibernate.validator.util.SetAccessibility;
  *
  * @author Hardy Ferentschik
  */
-
-public class BeanMetaDataImpl<T> implements BeanMetaData<T> {
+public final class BeanMetaDataImpl<T> implements BeanMetaData<T> {
 
 	private static final Logger log = LoggerFactory.make();
 
@@ -87,7 +82,7 @@ public class BeanMetaDataImpl<T> implements BeanMetaData<T> {
 	private Map<String, PropertyDescriptor> propertyDescriptors = new HashMap<String, PropertyDescriptor>();
 
 	/**
-	 * Maps group sequences to the list of group/sequences.
+	 * The default groups sequence for this bean class.
 	 */
 	private List<Class<?>> defaultGroupSequence = new ArrayList<Class<?>>();
 
@@ -99,22 +94,43 @@ public class BeanMetaDataImpl<T> implements BeanMetaData<T> {
 	/**
 	 * A list of all property names in the class (constraint and un-constraint).
 	 */
-	// Used to avoid ReflectionHelper#containsMembe which is slow
+	// Used to avoid ReflectionHelper#containsMember which is slow
 	private final Set<String> propertyNames = new HashSet<String>( 30 );
 
 	public BeanMetaDataImpl(Class<T> beanClass, ConstraintHelper constraintHelper, BeanMetaDataCache beanMetaDataCache) {
 		this(
 				beanClass,
 				constraintHelper,
+				new ArrayList<Class<?>>(),
+				new HashMap<Class<?>, List<MetaConstraint<T, ?>>>(),
+				new ArrayList<Member>(),
 				new AnnotationIgnores(),
 				beanMetaDataCache
 		);
 	}
 
-	public BeanMetaDataImpl(Class<T> beanClass, ConstraintHelper constraintHelper, AnnotationIgnores annotationIgnores, BeanMetaDataCache beanMetaDataCache) {
+	public BeanMetaDataImpl(Class<T> beanClass,
+							ConstraintHelper constraintHelper,
+							List<Class<?>> defaultGroupSequence,
+							Map<Class<?>, List<MetaConstraint<T, ?>>> constraints,
+							List<Member> cascadedMembers,
+							AnnotationIgnores annotationIgnores,
+							BeanMetaDataCache beanMetaDataCache) {
 		this.beanClass = beanClass;
 		this.constraintHelper = constraintHelper;
 		createMetaData( annotationIgnores, beanMetaDataCache );
+		if ( !defaultGroupSequence.isEmpty() ) {
+			setDefaultGroupSequence( defaultGroupSequence );
+		}
+		for ( Map.Entry<Class<?>, List<MetaConstraint<T, ?>>> entry : constraints.entrySet() ) {
+			Class<?> clazz = entry.getKey();
+			for ( MetaConstraint<T, ?> constraint : entry.getValue() ) {
+				addMetaConstraint( clazz, constraint );
+			}
+		}
+		for ( Member member : cascadedMembers ) {
+			addCascadedMember( member );
+		}
 	}
 
 	public Class<T> getBeanClass() {
@@ -141,40 +157,6 @@ public class BeanMetaDataImpl<T> implements BeanMetaData<T> {
 		return Collections.unmodifiableList( constraintList );
 	}
 
-	public void addMetaConstraint(Class<?> clazz, MetaConstraint<T, ? extends Annotation> metaConstraint) {
-		// first we add the meta constraint to our meta constraint map
-		List<MetaConstraint<T, ? extends Annotation>> constraintList;
-		if ( !metaConstraints.containsKey( clazz ) ) {
-			constraintList = new ArrayList<MetaConstraint<T, ? extends Annotation>>();
-			metaConstraints.put( clazz, constraintList );
-		}
-		else {
-			constraintList = metaConstraints.get( clazz );
-		}
-		constraintList.add( metaConstraint );
-
-		// but we also have to update the descriptors exposing the BV metadata API
-		if ( metaConstraint.getElementType() == ElementType.TYPE ) {
-			beanDescriptor.addConstraintDescriptor( metaConstraint.getDescriptor() );
-		}
-		else {
-			PropertyDescriptorImpl propertyDescriptor = ( PropertyDescriptorImpl ) propertyDescriptors.get(
-					metaConstraint.getPropertyName()
-			);
-			if ( propertyDescriptor == null ) {
-				Member member = metaConstraint.getMember();
-				propertyDescriptor = addPropertyDescriptorForMember( member, isValidAnnotationPresent( member ) );
-			}
-			propertyDescriptor.addConstraintDescriptor( metaConstraint.getDescriptor() );
-		}
-	}
-
-	public void addCascadedMember(Member member) {
-		setAccessibility( member );
-		cascadedMembers.add( member );
-		addPropertyDescriptorForMember( member, true );
-	}
-
 	public PropertyDescriptor getPropertyDescriptor(String property) {
 		return propertyDescriptors.get( property );
 	}
@@ -191,7 +173,11 @@ public class BeanMetaDataImpl<T> implements BeanMetaData<T> {
 		return defaultGroupSequence.size() > 1;
 	}
 
-	public void setDefaultGroupSequence(List<Class<?>> groupSequence) {
+	public Set<PropertyDescriptor> getConstrainedProperties() {
+		return Collections.unmodifiableSet( new HashSet<PropertyDescriptor>( propertyDescriptors.values() ) );
+	}
+
+	private void setDefaultGroupSequence(List<Class<?>> groupSequence) {
 		defaultGroupSequence = new ArrayList<Class<?>>();
 		boolean groupSequenceContainsDefault = false;
 		for ( Class<?> group : groupSequence ) {
@@ -218,8 +204,38 @@ public class BeanMetaDataImpl<T> implements BeanMetaData<T> {
 		}
 	}
 
-	public Set<PropertyDescriptor> getConstrainedProperties() {
-		return Collections.unmodifiableSet( new HashSet<PropertyDescriptor>( propertyDescriptors.values() ) );
+	private void addMetaConstraint(Class<?> clazz, MetaConstraint<T, ? extends Annotation> metaConstraint) {
+		// first we add the meta constraint to our meta constraint map
+		List<MetaConstraint<T, ? extends Annotation>> constraintList;
+		if ( !metaConstraints.containsKey( clazz ) ) {
+			constraintList = new ArrayList<MetaConstraint<T, ? extends Annotation>>();
+			metaConstraints.put( clazz, constraintList );
+		}
+		else {
+			constraintList = metaConstraints.get( clazz );
+		}
+		constraintList.add( metaConstraint );
+
+		// but we also have to update the descriptors exposing the BV metadata API
+		if ( metaConstraint.getElementType() == ElementType.TYPE ) {
+			beanDescriptor.addConstraintDescriptor( metaConstraint.getDescriptor() );
+		}
+		else {
+			PropertyDescriptorImpl propertyDescriptor = ( PropertyDescriptorImpl ) propertyDescriptors.get(
+					metaConstraint.getPropertyName()
+			);
+			if ( propertyDescriptor == null ) {
+				Member member = metaConstraint.getMember();
+				propertyDescriptor = addPropertyDescriptorForMember( member, isValidAnnotationPresent( member ) );
+			}
+			propertyDescriptor.addConstraintDescriptor( metaConstraint.getDescriptor() );
+		}
+	}
+
+	private void addCascadedMember(Member member) {
+		ReflectionHelper.setAccessibility( member );
+		cascadedMembers.add( member );
+		addPropertyDescriptorForMember( member, true );
 	}
 
 	/**
@@ -232,8 +248,7 @@ public class BeanMetaDataImpl<T> implements BeanMetaData<T> {
 	private void createMetaData(AnnotationIgnores annotationIgnores, BeanMetaDataCache beanMetaDataCache) {
 		beanDescriptor = new BeanDescriptorImpl<T>( this );
 		initDefaultGroupSequence();
-		List<Class<?>> classes = new ArrayList<Class<?>>();
-		ReflectionHelper.computeClassHierarchy( beanClass, classes );
+		List<Class<?>> classes = ReflectionHelper.computeClassHierarchy( beanClass );
 		for ( Class<?> current : classes ) {
 			initClass( current, annotationIgnores, beanMetaDataCache );
 		}
@@ -258,18 +273,12 @@ public class BeanMetaDataImpl<T> implements BeanMetaData<T> {
 		else {
 			groupSequence.addAll( Arrays.asList( groupSequenceAnnotation.value() ) );
 		}
+
 		setDefaultGroupSequence( groupSequence );
 	}
 
 	private void initFieldConstraints(Class<?> clazz, AnnotationIgnores annotationIgnores, BeanMetaDataCache beanMetaDataCache) {
-		GetDeclaredFields action = GetDeclaredFields.action( clazz );
-		final Field[] fields;
-		if ( System.getSecurityManager() != null ) {
-			fields = AccessController.doPrivileged( action );
-		}
-		else {
-			fields = action.run();
-		}
+		final Field[] fields = ReflectionHelper.getFields( clazz );
 		for ( Field field : fields ) {
 			addToPropertyNameList( field );
 
@@ -302,7 +311,7 @@ public class BeanMetaDataImpl<T> implements BeanMetaData<T> {
 			}
 
 			for ( ConstraintDescriptorImpl<?> constraintDescription : fieldMetaData ) {
-				setAccessibility( field );
+				ReflectionHelper.setAccessibility( field );
 				MetaConstraint<T, ?> metaConstraint = createMetaConstraint( field, constraintDescription );
 				addMetaConstraint( clazz, metaConstraint );
 			}
@@ -320,26 +329,8 @@ public class BeanMetaDataImpl<T> implements BeanMetaData<T> {
 		}
 	}
 
-	private void setAccessibility(Member member) {
-		SetAccessibility action = SetAccessibility.action( member );
-		if ( System.getSecurityManager() != null ) {
-			AccessController.doPrivileged( action );
-		}
-		else {
-			action.run();
-		}
-	}
-
 	private void initMethodConstraints(Class<?> clazz, AnnotationIgnores annotationIgnores, BeanMetaDataCache beanMetaDataCache) {
-		GetDeclaredMethods action = GetDeclaredMethods.action( clazz );
-		final Method[] declaredMethods;
-		if ( System.getSecurityManager() != null ) {
-			declaredMethods = AccessController.doPrivileged( action );
-		}
-		else {
-			declaredMethods = action.run();
-		}
-
+		final Method[] declaredMethods = ReflectionHelper.getMethods( clazz );
 		for ( Method method : declaredMethods ) {
 			addToPropertyNameList( method );
 
@@ -372,7 +363,7 @@ public class BeanMetaDataImpl<T> implements BeanMetaData<T> {
 			}
 
 			for ( ConstraintDescriptorImpl<?> constraintDescription : methodMetaData ) {
-				setAccessibility( method );
+				ReflectionHelper.setAccessibility( method );
 				MetaConstraint<T, ?> metaConstraint = createMetaConstraint( method, constraintDescription );
 				addMetaConstraint( clazz, metaConstraint );
 			}
@@ -449,13 +440,14 @@ public class BeanMetaDataImpl<T> implements BeanMetaData<T> {
 		List<ConstraintDescriptorImpl<?>> constraintDescriptors = new ArrayList<ConstraintDescriptorImpl<?>>();
 
 		List<Annotation> constraints = new ArrayList<Annotation>();
-		if ( constraintHelper.isConstraintAnnotation( annotation ) ||
-				constraintHelper.isBuiltinConstraint( annotation.annotationType() ) ) {
+		Class<? extends Annotation> annotationType = annotation.annotationType();
+		if ( constraintHelper.isConstraintAnnotation( annotationType )
+				|| constraintHelper.isBuiltinConstraint( annotationType ) ) {
 			constraints.add( annotation );
 		}
-
-		// check if we have a multi-valued constraint
-		constraints.addAll( constraintHelper.getMultiValueConstraints( annotation ) );
+		else if ( constraintHelper.isMultiValueConstraint( annotationType ) ) {
+			constraints.addAll( constraintHelper.getMultiValueConstraints( annotation ) );
+		}
 
 		for ( Annotation constraint : constraints ) {
 			final ConstraintDescriptorImpl constraintDescriptor = buildConstraintDescriptor( clazz, constraint, type );
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/metadata/ConstraintDescriptorImpl.java b/hibernate-validator/src/main/java/org/hibernate/validator/metadata/ConstraintDescriptorImpl.java
index e7db22d..eb7691d 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/metadata/ConstraintDescriptorImpl.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/metadata/ConstraintDescriptorImpl.java
@@ -1,4 +1,4 @@
-// $Id: ConstraintDescriptorImpl.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: ConstraintDescriptorImpl.java 19825 2010-06-24 21:29:29Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -19,10 +19,12 @@ package org.hibernate.validator.metadata;
 
 import java.io.Serializable;
 import java.lang.annotation.Annotation;
+import java.lang.annotation.Documented;
 import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import java.security.AccessController;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -43,11 +45,8 @@ import javax.validation.metadata.ConstraintDescriptor;
 
 import org.slf4j.Logger;
 
-import org.hibernate.validator.util.GetAnnotationParameter;
-import org.hibernate.validator.util.GetDeclaredMethods;
-import org.hibernate.validator.util.GetMethod;
-import org.hibernate.validator.util.GetMethods;
 import org.hibernate.validator.util.LoggerFactory;
+import org.hibernate.validator.util.ReflectionHelper;
 import org.hibernate.validator.util.annotationfactory.AnnotationDescriptor;
 import org.hibernate.validator.util.annotationfactory.AnnotationFactory;
 
@@ -66,11 +65,29 @@ public class ConstraintDescriptorImpl<T extends Annotation> implements Constrain
 	private static final String PAYLOAD = "payload";
 
 	/**
+	 * A list of annotations which can be ignored when investigating for composing constraints.
+	 */
+	private static final List<String> NON_COMPOSING_CONSTRAINT_ANNOTATIONS = new ArrayList<String>();
+
+	static {
+		NON_COMPOSING_CONSTRAINT_ANNOTATIONS.add( Documented.class.getName() );
+		NON_COMPOSING_CONSTRAINT_ANNOTATIONS.add( Retention.class.getName() );
+		NON_COMPOSING_CONSTRAINT_ANNOTATIONS.add( Target.class.getName() );
+		NON_COMPOSING_CONSTRAINT_ANNOTATIONS.add( Constraint.class.getName() );
+		NON_COMPOSING_CONSTRAINT_ANNOTATIONS.add( ReportAsSingleViolation.class.getName() );
+	}
+
+	/**
 	 * The actual constraint annotation.
 	 */
 	private final T annotation;
 
 	/**
+	 * The type of the annotation made instance variable, because {@code annotation.annotationType()} is quite expensive.
+	 */
+	private final Class<T> annotationType;
+
+	/**
 	 * The set of classes implementing the validation for this constraint. See also
 	 * <code>ConstraintValidator</code> resolution algorithm.
 	 */
@@ -109,7 +126,7 @@ public class ConstraintDescriptorImpl<T extends Annotation> implements Constrain
 	private final ElementType elementType;
 
 	/**
-	 * The oririgin of the constraint. Defined on the actual root class or somehwere in the class hierarchy
+	 * The origin of the constraint. Defined on the actual root class or somehwere in the class hierarchy
 	 */
 	private final ConstraintOrigin definedOn;
 
@@ -122,10 +139,11 @@ public class ConstraintDescriptorImpl<T extends Annotation> implements Constrain
 
 	public ConstraintDescriptorImpl(T annotation, ConstraintHelper constraintHelper, Class<?> implicitGroup, ElementType type, ConstraintOrigin definedOn) {
 		this.annotation = annotation;
+		this.annotationType = ( Class<T> ) this.annotation.annotationType();
 		this.constraintHelper = constraintHelper;
 		this.elementType = type;
 		this.definedOn = definedOn;
-		this.isReportAsSingleInvalidConstraint = annotation.annotationType().isAnnotationPresent(
+		this.isReportAsSingleInvalidConstraint = annotationType.isAnnotationPresent(
 				ReportAsSingleViolation.class
 		);
 
@@ -147,15 +165,7 @@ public class ConstraintDescriptorImpl<T extends Annotation> implements Constrain
 		Class<Payload>[] payloadFromAnnotation;
 		try {
 			//TODO be extra safe and make sure this is an array of Payload
-			GetAnnotationParameter<Class[]> action = GetAnnotationParameter.action(
-					annotation, PAYLOAD, Class[].class
-			);
-			if ( System.getSecurityManager() != null ) {
-				payloadFromAnnotation = AccessController.doPrivileged( action );
-			}
-			else {
-				payloadFromAnnotation = action.run();
-			}
+			payloadFromAnnotation = ReflectionHelper.getAnnotationParameter( annotation, PAYLOAD, Class[].class );
 		}
 		catch ( ValidationException e ) {
 			//ignore people not defining payloads
@@ -169,14 +179,9 @@ public class ConstraintDescriptorImpl<T extends Annotation> implements Constrain
 
 	private Set<Class<?>> buildGroupSet(Class<?> implicitGroup) {
 		Set<Class<?>> groupSet = new HashSet<Class<?>>();
-		final Class<?>[] groupsFromAnnotation;
-		GetAnnotationParameter<Class[]> action = GetAnnotationParameter.action( annotation, GROUPS, Class[].class );
-		if ( System.getSecurityManager() != null ) {
-			groupsFromAnnotation = AccessController.doPrivileged( action );
-		}
-		else {
-			groupsFromAnnotation = action.run();
-		}
+		final Class<?>[] groupsFromAnnotation = ReflectionHelper.getAnnotationParameter(
+				annotation, GROUPS, Class[].class
+		);
 		if ( groupsFromAnnotation.length == 0 ) {
 			groupSet.add( Default.class );
 		}
@@ -192,7 +197,6 @@ public class ConstraintDescriptorImpl<T extends Annotation> implements Constrain
 	}
 
 	private List<Class<? extends ConstraintValidator<T, ?>>> findConstraintValidatorClasses() {
-		final Class<T> annotationType = getAnnotationType();
 		final List<Class<? extends ConstraintValidator<T, ?>>> constraintValidatorClasses = new ArrayList<Class<? extends ConstraintValidator<T, ?>>>();
 		if ( constraintHelper.containsConstraintValidatorDefinition( annotationType ) ) {
 			for ( Class<? extends ConstraintValidator<T, ?>> validator : constraintHelper
@@ -203,7 +207,7 @@ public class ConstraintDescriptorImpl<T extends Annotation> implements Constrain
 		}
 
 		List<Class<? extends ConstraintValidator<? extends Annotation, ?>>> constraintDefinitionClasses = new ArrayList<Class<? extends ConstraintValidator<? extends Annotation, ?>>>();
-		if ( constraintHelper.isBuiltinConstraint( annotation.annotationType() ) ) {
+		if ( constraintHelper.isBuiltinConstraint( annotationType ) ) {
 			constraintDefinitionClasses.addAll( constraintHelper.getBuiltInConstraints( annotationType ) );
 		}
 		else {
@@ -214,7 +218,7 @@ public class ConstraintDescriptorImpl<T extends Annotation> implements Constrain
 		}
 
 		constraintHelper.addConstraintValidatorDefinition(
-				annotation.annotationType(), constraintDefinitionClasses
+				annotationType, constraintDefinitionClasses
 		);
 
 		for ( Class<? extends ConstraintValidator<? extends Annotation, ?>> validator : constraintDefinitionClasses ) {
@@ -225,11 +229,6 @@ public class ConstraintDescriptorImpl<T extends Annotation> implements Constrain
 		return Collections.unmodifiableList( constraintValidatorClasses );
 	}
 
-	@SuppressWarnings("unchecked")
-	private Class<T> getAnnotationType() {
-		return ( Class<T> ) annotation.annotationType();
-	}
-
 	public T getAnnotation() {
 		return annotation;
 	}
@@ -270,27 +269,20 @@ public class ConstraintDescriptorImpl<T extends Annotation> implements Constrain
 	public String toString() {
 		final StringBuilder sb = new StringBuilder();
 		sb.append( "ConstraintDescriptorImpl" );
-		sb.append( "{annotation=" ).append( annotation.annotationType().getName() );
+		sb.append( "{annotation=" ).append( annotationType.getName() );
 		sb.append( ", payloads=" ).append( payloads );
 		sb.append( ", hasComposingConstraints=" ).append( composingConstraints.isEmpty() );
 		sb.append( ", isReportAsSingleInvalidConstraint=" ).append( isReportAsSingleInvalidConstraint );
 		sb.append( ", elementType=" ).append( elementType );
 		sb.append( ", definedOn=" ).append( definedOn );
 		sb.append( ", groups=" ).append( groups );
-		sb.append( ", attributes=" ).append( attributes );		
+		sb.append( ", attributes=" ).append( attributes );
 		sb.append( '}' );
 		return sb.toString();
 	}
 
 	private Map<String, Object> buildAnnotationParameterMap(Annotation annotation) {
-		GetDeclaredMethods action = GetDeclaredMethods.action( annotation.annotationType() );
-		final Method[] declaredMethods;
-		if ( System.getSecurityManager() != null ) {
-			declaredMethods = AccessController.doPrivileged( action );
-		}
-		else {
-			declaredMethods = action.run();
-		}
+		final Method[] declaredMethods = ReflectionHelper.getMethods( annotation.annotationType() );
 		Map<String, Object> parameters = new HashMap<String, Object>( declaredMethods.length );
 		for ( Method m : declaredMethods ) {
 			try {
@@ -323,15 +315,7 @@ public class ConstraintDescriptorImpl<T extends Annotation> implements Constrain
 
 	private Map<ClassIndexWrapper, Map<String, Object>> parseOverrideParameters() {
 		Map<ClassIndexWrapper, Map<String, Object>> overrideParameters = new HashMap<ClassIndexWrapper, Map<String, Object>>();
-		final Method[] methods;
-		final GetMethods getMethods = GetMethods.action( annotation.annotationType() );
-		if ( System.getSecurityManager() != null ) {
-			methods = AccessController.doPrivileged( getMethods );
-		}
-		else {
-			methods = getMethods.run();
-		}
-
+		final Method[] methods = ReflectionHelper.getMethods( annotationType );
 		for ( Method m : methods ) {
 			if ( m.getAnnotation( OverridesAttribute.class ) != null ) {
 				addOverrideAttributes(
@@ -368,14 +352,7 @@ public class ConstraintDescriptorImpl<T extends Annotation> implements Constrain
 	}
 
 	private void ensureAttributeIsOverridable(Method m, OverridesAttribute overridesAttribute) {
-		final GetMethod getMethod = GetMethod.action( overridesAttribute.constraint(), overridesAttribute.name() );
-		final Method method;
-		if ( System.getSecurityManager() != null ) {
-			method = AccessController.doPrivileged( getMethod );
-		}
-		else {
-			method = getMethod.run();
-		}
+		final Method method = ReflectionHelper.getMethod( overridesAttribute.constraint(), overridesAttribute.name() );
 		if ( method == null ) {
 			throw new ConstraintDefinitionException(
 					"Overridden constraint does not define an attribute with name " + overridesAttribute.name()
@@ -393,16 +370,24 @@ public class ConstraintDescriptorImpl<T extends Annotation> implements Constrain
 		Set<ConstraintDescriptor<?>> composingConstraintsSet = new HashSet<ConstraintDescriptor<?>>();
 		Map<ClassIndexWrapper, Map<String, Object>> overrideParameters = parseOverrideParameters();
 
-		for ( Annotation declaredAnnotation : annotation.annotationType().getDeclaredAnnotations() ) {
-			if ( constraintHelper.isConstraintAnnotation( declaredAnnotation )
-					|| constraintHelper.isBuiltinConstraint( declaredAnnotation.annotationType() ) ) {
+		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.isConstraintAnnotation( declaredAnnotationType )
+					|| constraintHelper.isBuiltinConstraint( declaredAnnotationType ) ) {
 				ConstraintDescriptorImpl<?> descriptor = createComposingConstraintDescriptor(
 						declaredAnnotation, overrideParameters, OVERRIDES_PARAMETER_DEFAULT_INDEX
 				);
 				composingConstraintsSet.add( descriptor );
-				log.debug( "Adding composing constraint: " + descriptor );
+				if ( log.isDebugEnabled() ) {
+					log.debug( "Adding composing constraint: " + descriptor );
+				}
 			}
-			else if ( constraintHelper.isMultiValueConstraint( declaredAnnotation ) ) {
+			else if ( constraintHelper.isMultiValueConstraint( declaredAnnotationType ) ) {
 				List<Annotation> multiValueConstraints = constraintHelper.getMultiValueConstraints( declaredAnnotation );
 				int index = 0;
 				for ( Annotation constraintAnnotation : multiValueConstraints ) {
@@ -410,7 +395,9 @@ public class ConstraintDescriptorImpl<T extends Annotation> implements Constrain
 							constraintAnnotation, overrideParameters, index
 					);
 					composingConstraintsSet.add( descriptor );
-					log.debug( "Adding composing constraint: " + descriptor );
+					if ( log.isDebugEnabled() ) {
+						log.debug( "Adding composing constraint: " + descriptor );
+					}
 					index++;
 				}
 			}
@@ -419,8 +406,6 @@ public class ConstraintDescriptorImpl<T extends Annotation> implements Constrain
 	}
 
 	private <U extends Annotation> ConstraintDescriptorImpl<U> createComposingConstraintDescriptor(U declaredAnnotation, Map<ClassIndexWrapper, Map<String, Object>> overrideParameters, int index) {
-		//TODO don't quite understand this warning
-		//TODO assuming U.getClass() returns Class<U>
 		@SuppressWarnings("unchecked")
 		final Class<U> annotationType = ( Class<U> ) declaredAnnotation.annotationType();
 		return createComposingConstraintDescriptor(
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/metadata/ConstraintHelper.java b/hibernate-validator/src/main/java/org/hibernate/validator/metadata/ConstraintHelper.java
index 537eff9..78ad705 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/metadata/ConstraintHelper.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/metadata/ConstraintHelper.java
@@ -1,4 +1,4 @@
-// $Id: ConstraintHelper.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: ConstraintHelper.java 19825 2010-06-24 21:29:29Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -23,7 +23,6 @@ import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.ConcurrentHashMap;
-import java.security.AccessController;
 import javax.validation.Constraint;
 import javax.validation.ConstraintDefinitionException;
 import javax.validation.ConstraintValidator;
@@ -72,9 +71,7 @@ import org.hibernate.validator.constraints.impl.SizeValidatorForArraysOfLong;
 import org.hibernate.validator.constraints.impl.SizeValidatorForCollection;
 import org.hibernate.validator.constraints.impl.SizeValidatorForMap;
 import org.hibernate.validator.constraints.impl.SizeValidatorForString;
-import org.hibernate.validator.util.GetMethods;
-import org.hibernate.validator.util.GetMethod;
-import org.hibernate.validator.util.GetAnnotationParameter;
+import org.hibernate.validator.util.ReflectionHelper;
 
 /**
  * Keeps track of builtin constraints and their validator implementations, as well as already resolved validator definitions.
@@ -83,11 +80,10 @@ import org.hibernate.validator.util.GetAnnotationParameter;
  * @author Alaa Nassef
  */
 public class ConstraintHelper {
-
 	private final ConcurrentHashMap<Class<? extends Annotation>, List<Class<? extends ConstraintValidator<?, ?>>>> builtinConstraints =
 			new ConcurrentHashMap<Class<? extends Annotation>, List<Class<? extends ConstraintValidator<?, ?>>>>();
 
-	private final ConcurrentHashMap<Class<? extends Annotation>, List<Class<? extends ConstraintValidator<? extends Annotation, ?>>>> constraintValidatorDefinitons =
+	private final ConcurrentHashMap<Class<? extends Annotation>, List<Class<? extends ConstraintValidator<? extends Annotation, ?>>>> constraintValidatorDefinitions =
 			new ConcurrentHashMap<Class<? extends Annotation>, List<Class<? extends ConstraintValidator<? extends Annotation, ?>>>>();
 
 	public ConstraintHelper() {
@@ -174,8 +170,8 @@ public class ConstraintHelper {
 		for ( Class<? extends ConstraintValidator<?, ?>> validatorClass : builtInList ) {
 			//safe cause all CV for a given annotation A are CV<A, ?>
 			@SuppressWarnings("unchecked")
-			Class<ConstraintValidator<? extends Annotation, ?>> safeValdiatorClass = ( Class<ConstraintValidator<? extends Annotation, ?>> ) validatorClass;
-			constraints.add( safeValdiatorClass );
+			Class<ConstraintValidator<? extends Annotation, ?>> safeValidatorClass = ( Class<ConstraintValidator<? extends Annotation, ?>> ) validatorClass;
+			constraints.add( safeValidatorClass );
 		}
 
 		return constraints;
@@ -188,44 +184,27 @@ public class ConstraintHelper {
 	/**
 	 * Checks whether a given annotation is a multi value constraint or not.
 	 *
-	 * @param annotation the annotation to check.
+	 * @param annotationType the annotation type to check.
 	 *
-	 * @return <code>true</code> if the specified annotation is a multi value constraints, <code>false</code>
+	 * @return {@code true} if the specified annotation is a multi value constraints, {@code false}
 	 *         otherwise.
 	 */
-	public boolean isMultiValueConstraint(Annotation annotation) {
+	public boolean isMultiValueConstraint(Class<? extends Annotation> annotationType) {
 		boolean isMultiValueConstraint = false;
-		try {
-			final GetMethod getMethod = GetMethod.action( annotation.getClass(), "value" );
-			final Method method;
-			if ( System.getSecurityManager() != null ) {
-				method = AccessController.doPrivileged( getMethod );
-			}
-			else {
-				method = getMethod.run();
-			}
-			if (method != null) {
+			final Method method = ReflectionHelper.getMethod( annotationType, "value" );
+			if ( method != null ) {
 				Class returnType = method.getReturnType();
 				if ( returnType.isArray() && returnType.getComponentType().isAnnotation() ) {
-					Annotation[] annotations = ( Annotation[] ) method.invoke( annotation );
-					for ( Annotation a : annotations ) {
-						if ( isConstraintAnnotation( a ) || isBuiltinConstraint( a.annotationType() ) ) {
-							isMultiValueConstraint = true;
-						}
-						else {
-							isMultiValueConstraint = false;
-							break;
-						}
+					@SuppressWarnings( "unchecked" )
+					Class<? extends Annotation> componentType = ( Class<? extends Annotation> ) returnType.getComponentType();
+					if ( isConstraintAnnotation( componentType ) || isBuiltinConstraint( componentType ) ) {
+						isMultiValueConstraint = true;
+					}
+					else {
+						isMultiValueConstraint = false;
 					}
 				}
 			}
-		}
-		catch ( IllegalAccessException iae ) {
-			// ignore
-		}
-		catch ( InvocationTargetException ite ) {
-			// ignore
-		}
 		return isMultiValueConstraint;
 	}
 
@@ -241,20 +220,14 @@ public class ConstraintHelper {
 	public <A extends Annotation> List<Annotation> getMultiValueConstraints(A annotation) {
 		List<Annotation> annotationList = new ArrayList<Annotation>();
 		try {
-			final GetMethod getMethod = GetMethod.action( annotation.getClass(), "value" );
-			final Method method;
-			if ( System.getSecurityManager() != null ) {
-				method = AccessController.doPrivileged( getMethod );
-			}
-			else {
-				method = getMethod.run();
-			}
-			if (method != null) {
+			final Method method = ReflectionHelper.getMethod( annotation.getClass(), "value" );
+			if ( method != null ) {
 				Class returnType = method.getReturnType();
 				if ( returnType.isArray() && returnType.getComponentType().isAnnotation() ) {
 					Annotation[] annotations = ( Annotation[] ) method.invoke( annotation );
 					for ( Annotation a : annotations ) {
-						if ( isConstraintAnnotation( a ) || isBuiltinConstraint( a.annotationType() ) ) {
+						Class<? extends Annotation> annotationType = a.annotationType();
+						if ( isConstraintAnnotation( annotationType ) || isBuiltinConstraint( annotationType ) ) {
 							annotationList.add( a );
 						}
 					}
@@ -280,36 +253,26 @@ public class ConstraintHelper {
 	 * <li>Defines a payload parameter.</li>
 	 * </ul>
 	 *
-	 * @param annotation The annotation to test.
+	 * @param annotationType The annotation type to test.
 	 *
 	 * @return <code>true</code> if the annotation fulfills the above condtions, <code>false</code> otherwise.
 	 */
-	public boolean isConstraintAnnotation(Annotation annotation) {
-
-		Constraint constraint = annotation.annotationType()
-				.getAnnotation( Constraint.class );
+	public boolean isConstraintAnnotation(Class<? extends Annotation> annotationType) {
+		Constraint constraint = annotationType.getAnnotation( Constraint.class );
 		if ( constraint == null ) {
 			return false;
 		}
 
-		assertMessageParameterExists( annotation );
-		assertGroupsParameterExists( annotation );
-		assertPayloadParameterExists( annotation );
-
-		assertNoParameterStartsWithValid( annotation );
+		assertMessageParameterExists( annotationType );
+		assertGroupsParameterExists( annotationType );
+		assertPayloadParameterExists( annotationType );
+		assertNoParameterStartsWithValid( annotationType );
 
 		return true;
 	}
 
-	private void assertNoParameterStartsWithValid(Annotation annotation) {
-		final Method[] methods;
-		final GetMethods getMethods = GetMethods.action( annotation.annotationType() );
-		if ( System.getSecurityManager() != null ) {
-			methods = AccessController.doPrivileged( getMethods );
-		}
-		else {
-			methods = getMethods.run();
-		}
+	private void assertNoParameterStartsWithValid(Class<? extends Annotation> annotationType) {
+		final Method[] methods = ReflectionHelper.getMethods( annotationType );
 		for ( Method m : methods ) {
 			if ( m.getName().startsWith( "valid" ) ) {
 				String msg = "Parameters starting with 'valid' are not allowed in a constraint.";
@@ -318,89 +281,80 @@ public class ConstraintHelper {
 		}
 	}
 
-	private void assertPayloadParameterExists(Annotation annotation) {
+	private void assertPayloadParameterExists(Class<? extends Annotation> annotationType) {
 		try {
-			final GetMethod getMethod = GetMethod.action( annotation.annotationType(), "payload" );
-			final Method method;
-			if ( System.getSecurityManager() != null ) {
-				method = AccessController.doPrivileged( getMethod );
-			}
-			else {
-				method = getMethod.run();
-			}
-			if (method == null) {
-				String msg = annotation.annotationType().getName() + " contains Constraint annotation, but does " +
-					"not contain a payload parameter.";
+			final Method method = ReflectionHelper.getMethod( annotationType, "payload" );
+			if ( method == null ) {
+				String msg = annotationType.getName() + " contains Constraint annotation, but does " +
+						"not contain a payload parameter.";
 				throw new ConstraintDefinitionException( msg );
 			}
 			Class<?>[] defaultPayload = ( Class<?>[] ) method.getDefaultValue();
 			if ( defaultPayload.length != 0 ) {
-				String msg = annotation.annotationType()
+				String msg = annotationType
 						.getName() + " contains Constraint annotation, but the payload " +
-						"paramter default value is not the empty array.";
+						"parameter default value is not the empty array.";
 				throw new ConstraintDefinitionException( msg );
 			}
 		}
 		catch ( ClassCastException e ) {
-			String msg = annotation.annotationType().getName() + " contains Constraint annotation, but the " +
+			String msg = annotationType.getName() + " contains Constraint annotation, but the " +
 					"payload parameter is of wrong type.";
 			throw new ConstraintDefinitionException( msg );
 		}
 	}
 
-	private void assertGroupsParameterExists(Annotation annotation) {
+	private void assertGroupsParameterExists(Class<? extends Annotation> annotationType) {
 		try {
-			final GetMethod getMethod = GetMethod.action( annotation.annotationType(), "groups" );
-			final Method method;
-			if ( System.getSecurityManager() != null ) {
-				method = AccessController.doPrivileged( getMethod );
-			}
-			else {
-				method = getMethod.run();
-			}
-			if (method == null) {
-				String msg = annotation.annotationType().getName() + " contains Constraint annotation, but does " +
-					"not contain a groups parameter.";
+			final Method method = ReflectionHelper.getMethod( annotationType, "groups" );
+			if ( method == null ) {
+				String msg = annotationType.getName() + " contains Constraint annotation, but does " +
+						"not contain a groups parameter.";
 				throw new ConstraintDefinitionException( msg );
 			}
 			Class<?>[] defaultGroups = ( Class<?>[] ) method.getDefaultValue();
 			if ( defaultGroups.length != 0 ) {
-				String msg = annotation.annotationType()
+				String msg = annotationType
 						.getName() + " contains Constraint annotation, but the groups " +
-						"paramter default value is not the empty array.";
+						"parameter default value is not the empty array.";
 				throw new ConstraintDefinitionException( msg );
 			}
 		}
 		catch ( ClassCastException e ) {
-			String msg = annotation.annotationType().getName() + " contains Constraint annotation, but the " +
+			String msg = annotationType.getName() + " contains Constraint annotation, but the " +
 					"groups parameter is of wrong type.";
 			throw new ConstraintDefinitionException( msg );
 		}
 	}
 
-	private void assertMessageParameterExists(Annotation annotation) {
+	private void assertMessageParameterExists(Class<? extends Annotation> annotationType) {
 		try {
-			GetAnnotationParameter<?> action = GetAnnotationParameter.action( annotation, "message", String.class );
-			if (System.getSecurityManager() != null) {
-				AccessController.doPrivileged( action );
+			final Method method = ReflectionHelper.getMethod( annotationType, "message" );
+			if ( method == null ) {
+				String msg = annotationType.getName() + " contains Constraint annotation, but does " +
+						"not contain a message parameter.";
+				throw new ConstraintDefinitionException( msg );
 			}
-			else {
-				action.run();
+			if ( method.getReturnType() != String.class ) {
+				String msg = annotationType.getName() + " contains Constraint annotation, but the message parameter " +
+						"is not of type java.lang.String.";
+				throw new ConstraintDefinitionException( msg );
 			}
 		}
-		catch ( Exception e ) {
-			String msg = annotation.annotationType().getName() + " contains Constraint annotation, but does " +
-					"not contain a message parameter.";
+		catch ( ClassCastException e ) {
+			String msg = annotationType.getName() + " contains Constraint annotation, but the " +
+					"groups parameter is of wrong type.";
 			throw new ConstraintDefinitionException( msg );
 		}
 	}
 
-	public <T extends Annotation> List<Class<? extends ConstraintValidator<T, ?>>> getConstraintValidatorDefinition(Class<T> annotationClass) {
+	public <T extends Annotation> List<Class<? extends ConstraintValidator<T, ?>>> getConstraintValidatorDefinition
+			(Class<T> annotationClass) {
 		if ( annotationClass == null ) {
 			throw new IllegalArgumentException( "Class cannot be null" );
 		}
 
-		final List<Class<? extends ConstraintValidator<? extends Annotation, ?>>> list = constraintValidatorDefinitons.get(
+		final List<Class<? extends ConstraintValidator<? extends Annotation, ?>>> list = constraintValidatorDefinitions.get(
 				annotationClass
 		);
 
@@ -409,18 +363,18 @@ public class ConstraintHelper {
 		for ( Class<? extends ConstraintValidator<?, ?>> validatorClass : list ) {
 			//safe cause all CV for a given annotation A are CV<A, ?>
 			@SuppressWarnings("unchecked")
-			Class<ConstraintValidator<T, ?>> safeValdiatorClass = ( Class<ConstraintValidator<T, ?>> ) validatorClass;
-			constraintsValidators.add( safeValdiatorClass );
+			Class<ConstraintValidator<T, ?>> safeValidatorClass = ( Class<ConstraintValidator<T, ?>> ) validatorClass;
+			constraintsValidators.add( safeValidatorClass );
 		}
 
 		return constraintsValidators;
 	}
 
 	public <A extends Annotation> void addConstraintValidatorDefinition(Class<A> annotationClass, List<Class<? extends ConstraintValidator<? extends Annotation, ?>>> definitionClasses) {
-		constraintValidatorDefinitons.putIfAbsent( annotationClass, definitionClasses );
+		constraintValidatorDefinitions.putIfAbsent( annotationClass, definitionClasses );
 	}
 
 	public boolean containsConstraintValidatorDefinition(Class<? extends Annotation> annotationClass) {
-		return constraintValidatorDefinitons.containsKey( annotationClass );
+		return constraintValidatorDefinitions.containsKey( annotationClass );
 	}
 }
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/metadata/MetaConstraint.java b/hibernate-validator/src/main/java/org/hibernate/validator/metadata/MetaConstraint.java
index 2da731b..de8b60a 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/metadata/MetaConstraint.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/metadata/MetaConstraint.java
@@ -1,4 +1,4 @@
-// $Id: MetaConstraint.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $// $Id: MetaConstraint.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: MetaConstraint.java 19313 2010-04-28 11:05:26Z hardy.ferentschik $// $Id: MetaConstraint.java 19313 2010-04-28 11:05:26Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -29,8 +29,8 @@ import javax.validation.ConstraintViolation;
 import javax.validation.ValidationException;
 
 import org.hibernate.validator.engine.ConstraintTree;
-import org.hibernate.validator.engine.GlobalExecutionContext;
-import org.hibernate.validator.engine.LocalExecutionContext;
+import org.hibernate.validator.engine.ValidationContext;
+import org.hibernate.validator.engine.ValueContext;
 import org.hibernate.validator.util.ReflectionHelper;
 
 /**
@@ -115,11 +115,11 @@ public class MetaConstraint<T, A extends Annotation> {
 		return constraintTree.getDescriptor().getElementType();
 	}
 
-	public <T, U, V> boolean validateConstraint(GlobalExecutionContext<T> executionContext, LocalExecutionContext<U, V> localExecutionContext) {
+	public <T, U, V> boolean validateConstraint(ValidationContext<T> executionContext, ValueContext<U, V> valueContext) {
 		List<ConstraintViolation<T>> constraintViolations = new ArrayList<ConstraintViolation<T>>();
-		localExecutionContext.setElementType( getElementType() );
+		valueContext.setElementType( getElementType() );
 		constraintTree.validateConstraints(
-				typeOfAnnotatedElement(), executionContext, localExecutionContext, constraintViolations
+				typeOfAnnotatedElement(), executionContext, valueContext, constraintViolations
 		);
 		if ( constraintViolations.size() > 0 ) {
 			executionContext.addConstraintFailures( constraintViolations );
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/metadata/package.html b/hibernate-validator/src/main/java/org/hibernate/validator/metadata/package.html
index 3cd20e1..a252611 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/metadata/package.html
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/metadata/package.html
@@ -1,24 +1,24 @@
+<!--
+  ~ $Id: package.html 19596 2010-05-24 10:31:09Z hardy.ferentschik $
+  ~
+  ~ 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.
+-->
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html>
 <head>
-<!--
-
-  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.
-
--->
 </head>
 <body>
 Implementations of the Bean Validation metadata interfaces as well as Hibernate Validator specific meta data classes.
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/package.html b/hibernate-validator/src/main/java/org/hibernate/validator/package.html
new file mode 100644
index 0000000..e54dbb6
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/package.html
@@ -0,0 +1,27 @@
+<!--
+  ~ $Id: package.html 19596 2010-05-24 10:31:09Z hardy.ferentschik $
+  ~
+  ~ 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.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+<head>
+</head>
+<body>
+Bootstrap classes HibernateValidator and HibernateValidatorConfiguration which uniquely identify Hibernate Validator
+and allow to configure it. These classes form part of the public Hibernate Validator API.
+</body>
+</html>
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/resourceloading/AggregateResourceBundleLocator.java b/hibernate-validator/src/main/java/org/hibernate/validator/resourceloading/AggregateResourceBundleLocator.java
new file mode 100644
index 0000000..304ff04
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/resourceloading/AggregateResourceBundleLocator.java
@@ -0,0 +1,147 @@
+// $Id: AggregateResourceBundleLocator.java 19557 2010-05-19 15:50:47Z hardy.ferentschik $
+/*
+* 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.resourceloading;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import org.hibernate.validator.util.IteratorEnumeration;
+
+/**
+ * A {@link ResourceBundleLocator} implementation that provides access
+ * to multiple source {@link ResourceBundle}s by merging them into one
+ * aggregated bundle.
+ *
+ * @author Gunnar Morling
+ */
+public class AggregateResourceBundleLocator extends DelegatingResourceBundleLocator {
+
+	private final List<String> bundleNames;
+
+	/**
+	 * Creates a locator that delivers a resource bundle merged from the given
+	 * list of source bundles.
+	 *
+	 * @param bundleNames A list with source bundle names. The returned bundle will
+	 * contain all entries from all source bundles. In case a key occurs
+	 * in multiple source bundles, the value will be taken from the
+	 * first bundle containing the key.
+	 */
+	public AggregateResourceBundleLocator(List<String> bundleNames) {
+		this( bundleNames, null );
+	}
+
+	/**
+	 * Creates a locator that delivers a resource bundle merged from the given
+	 * list of source bundles.
+	 *
+	 * @param bundleNames A list with source bundle names. The returned bundle will
+	 * contain all keys from all source bundles. In case a key occurs
+	 * in multiple source bundles, the value will be taken from the
+	 * first bundle containing the key.
+	 * @param delegate A delegate resource bundle locator. The bundle returned by
+	 * this locator will be added to the aggregate bundle after all
+	 * source bundles.
+	 */
+	public AggregateResourceBundleLocator(List<String> bundleNames, ResourceBundleLocator delegate) {
+		super( delegate );
+
+		if ( bundleNames == null ) {
+			throw new IllegalArgumentException( "bundleNames must not be null." );
+		}
+
+		List<String> tmpBundleNames = new ArrayList<String>();
+		tmpBundleNames.addAll( bundleNames );
+
+		this.bundleNames = Collections.unmodifiableList( tmpBundleNames );
+	}
+
+	public ResourceBundle getResourceBundle(Locale locale) {
+		List<ResourceBundle> sourceBundles = new ArrayList<ResourceBundle>();
+
+		for ( String oneBundleName : bundleNames ) {
+			ResourceBundleLocator oneLocator =
+					new PlatformResourceBundleLocator( oneBundleName );
+
+			ResourceBundle oneBundle = oneLocator.getResourceBundle( locale );
+
+			if ( oneBundle != null ) {
+				sourceBundles.add( oneBundle );
+			}
+		}
+
+		ResourceBundle bundleFromDelegate = super.getResourceBundle( locale );
+
+		if ( bundleFromDelegate != null ) {
+			sourceBundles.add( bundleFromDelegate );
+		}
+
+		return sourceBundles.isEmpty() ? null : new AggregateBundle( sourceBundles );
+	}
+
+	/**
+	 * A {@link ResourceBundle} which's content is aggregated from multiple source bundles.
+	 * <p/>
+	 * This class is package-private for the sake of testability.
+	 *
+	 * @author Gunnar Morling
+	 */
+	public static class AggregateBundle extends ResourceBundle {
+		private Map<String, Object> contents = new HashMap<String, Object>();
+
+		/**
+		 * Creates a new AggregateBundle.
+		 *
+		 * @param bundles A list of source bundles, which shall be merged into one
+		 * aggregated bundle. The newly created bundle will contain
+		 * all keys from all source bundles. In case a key occurs in
+		 * multiple source bundles, the value will be taken from the
+		 * first bundle containing the key.
+		 */
+		public AggregateBundle(List<ResourceBundle> bundles) {
+			if ( bundles != null ) {
+
+				for ( ResourceBundle bundle : bundles ) {
+					Enumeration<String> keys = bundle.getKeys();
+					while ( keys.hasMoreElements() ) {
+						String oneKey = keys.nextElement();
+						if ( !contents.containsKey( oneKey ) ) {
+							contents.put( oneKey, bundle.getObject( oneKey ) );
+						}
+					}
+				}
+			}
+		}
+
+		@Override
+		public Enumeration<String> getKeys() {
+			return new IteratorEnumeration<String>( contents.keySet().iterator() );
+		}
+
+		@Override
+		protected Object handleGetObject(String key) {
+			return contents.get( key );
+		}
+	}
+}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/resourceloading/CachingResourceBundleLocator.java b/hibernate-validator/src/main/java/org/hibernate/validator/resourceloading/CachingResourceBundleLocator.java
new file mode 100644
index 0000000..a0b91bb
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/resourceloading/CachingResourceBundleLocator.java
@@ -0,0 +1,56 @@
+// $Id: CachingResourceBundleLocator.java 19314 2010-04-28 14:33:12Z hardy.ferentschik $
+/*
+* 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.resourceloading;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * A {@link ResourceBundleLocator} implementation that wraps around another
+ * locator and caches values retrieved from that locator.
+ *
+ * @author Gunnar Morling
+ */
+public class CachingResourceBundleLocator extends DelegatingResourceBundleLocator {
+
+	private final ConcurrentMap<Locale, ResourceBundle> bundleCache = new ConcurrentHashMap<Locale, ResourceBundle>();
+
+	/**
+	 * Creates a new CachingResourceBundleLocator.
+	 *
+	 * @param delegate The locator from which the values actually will be retrieved.
+	 */
+	public CachingResourceBundleLocator(ResourceBundleLocator delegate) {
+		super( delegate );
+	}
+
+	public ResourceBundle getResourceBundle(Locale locale) {
+
+		if ( bundleCache.containsKey( locale ) ) {
+			return bundleCache.get( locale );
+		}
+
+		ResourceBundle bundle = super.getResourceBundle( locale );
+		if ( bundle != null ) {
+			bundleCache.put( locale, bundle );
+		}
+		return bundle;
+	}
+}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/resourceloading/DelegatingResourceBundleLocator.java b/hibernate-validator/src/main/java/org/hibernate/validator/resourceloading/DelegatingResourceBundleLocator.java
new file mode 100644
index 0000000..f8ac5ac
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/resourceloading/DelegatingResourceBundleLocator.java
@@ -0,0 +1,41 @@
+// $Id: DelegatingResourceBundleLocator.java 19314 2010-04-28 14:33:12Z hardy.ferentschik $
+/*
+* 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.resourceloading;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+/**
+ * Abstract base for all {@link ResourceBundleLocator} implementations, that
+ * wish to delegate to some other locator.
+ *
+ * @author Gunnar Morling
+ */
+public abstract class DelegatingResourceBundleLocator implements ResourceBundleLocator {
+
+	private final ResourceBundleLocator delegate;
+
+	public DelegatingResourceBundleLocator(ResourceBundleLocator delegate) {
+		this.delegate = delegate;
+	}
+
+	public ResourceBundle getResourceBundle(Locale locale) {
+		return delegate == null ? null : delegate.getResourceBundle( locale );
+	}
+
+}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/resourceloading/PlatformResourceBundleLocator.java b/hibernate-validator/src/main/java/org/hibernate/validator/resourceloading/PlatformResourceBundleLocator.java
new file mode 100644
index 0000000..89c0a99
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/resourceloading/PlatformResourceBundleLocator.java
@@ -0,0 +1,93 @@
+// $Id: PlatformResourceBundleLocator.java 19573 2010-05-20 22:13:26Z hardy.ferentschik $
+/*
+* 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.resourceloading;
+
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.slf4j.Logger;
+
+import org.hibernate.validator.util.LoggerFactory;
+import org.hibernate.validator.util.ReflectionHelper;
+
+/**
+ * A resource bundle locator, that loads resource bundles by simply
+ * invoking <code>ResourceBundle.loadBundle(...)</code>.
+ *
+ * @author Hardy Ferentschik
+ * @author Gunnar Morling
+ */
+public class PlatformResourceBundleLocator implements ResourceBundleLocator {
+
+	private static final Logger log = LoggerFactory.make();
+	private String bundleName;
+
+	public PlatformResourceBundleLocator(String bundleName) {
+		this.bundleName = bundleName;
+	}
+
+	/**
+	 * Search current thread classloader for the resource bundle. If not found,
+	 * search validator (this) classloader.
+	 *
+	 * @param locale The locale of the bundle to load.
+	 *
+	 * @return the resource bundle or <code>null</code> if none is found.
+	 */
+	public ResourceBundle getResourceBundle(Locale locale) {
+		ResourceBundle rb = null;
+		ClassLoader classLoader = ReflectionHelper.getClassLoaderFromContext();
+		if ( classLoader != null ) {
+			rb = loadBundle(
+					classLoader, locale, bundleName
+							+ " not found by thread local classloader"
+			);
+		}
+		if ( rb == null ) {
+			classLoader = ReflectionHelper.getClassLoaderFromClass( PlatformResourceBundleLocator.class );
+			rb = loadBundle(
+					classLoader, locale, bundleName
+							+ " not found by validator classloader"
+			);
+		}
+		if ( log.isDebugEnabled() ) {
+			if ( rb != null ) {
+				log.debug( bundleName + " found" );
+			}
+			else {
+				log.debug( bundleName + " not found." );
+			}
+		}
+		return rb;
+	}
+
+	private ResourceBundle loadBundle(ClassLoader classLoader, Locale locale, String message) {
+		ResourceBundle rb = null;
+		try {
+			rb = ResourceBundle.getBundle(
+					bundleName, locale,
+					classLoader
+			);
+		}
+		catch ( MissingResourceException e ) {
+			log.trace( message );
+		}
+		return rb;
+	}
+}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/resourceloading/ResourceBundleLocator.java b/hibernate-validator/src/main/java/org/hibernate/validator/resourceloading/ResourceBundleLocator.java
new file mode 100644
index 0000000..547aa02
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/resourceloading/ResourceBundleLocator.java
@@ -0,0 +1,52 @@
+// $Id: ResourceBundleLocator.java 19314 2010-04-28 14:33:12Z hardy.ferentschik $
+/*
+* 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.resourceloading;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+/**
+ * <p>
+ * Used by {@link org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator} to load resource bundles
+ * containing message texts to be displayed in case of validation errors.
+ * </p>
+ * <p>
+ * The default implementation provides access to the bundle "ValidationMessages"
+ * as described in the BV specification. By providing additional implementations
+ * of this interface, alternative ways of bundle loading can be realized, e.g.
+ * by loading bundles based on XML files or from a database.
+ * </p>
+ * <p>
+ * A {@code ResourceBundleLocator} implementation must be thread-safe.
+ * </p>
+ *
+ * @author Gunnar Morling
+ */
+public interface ResourceBundleLocator {
+
+	/**
+	 * Returns a resource bundle for the given locale.
+	 *
+	 * @param locale A locale, for which a resource bundle shall be retrieved. Must
+	 * not be null.
+	 *
+	 * @return A resource bundle for the given locale. May be null, if no such
+	 *         bundle exists.
+	 */
+	ResourceBundle getResourceBundle(Locale locale);
+}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/resourceloading/package.html b/hibernate-validator/src/main/java/org/hibernate/validator/resourceloading/package.html
new file mode 100644
index 0000000..709ef72
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/resourceloading/package.html
@@ -0,0 +1,26 @@
+<!--
+  ~ $Id: package.html 19596 2010-05-24 10:31:09Z hardy.ferentschik $
+  ~
+  ~ 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.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+<head>
+</head>
+<body>
+ResourceBundleLocator interface and its various implementations. Part of the Hibernate Validator public API.
+</body>
+</html>
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/ContainsField.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/ContainsField.java
deleted file mode 100644
index c09b39d..0000000
--- a/hibernate-validator/src/main/java/org/hibernate/validator/util/ContainsField.java
+++ /dev/null
@@ -1,47 +0,0 @@
-// $Id: ContainsField.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.util;
-
-import java.security.PrivilegedAction;
-
-/**
- * @author Emmanuel Bernard
- */
-public class ContainsField implements PrivilegedAction<Boolean> {
-	private final Class<?> clazz;
-	private final String property;
-
-	public static ContainsField action(Class<?> clazz, String property) {
-		return new ContainsField( clazz, property );
-	}
-
-	private ContainsField(Class<?> clazz, String property) {
-		this.clazz = clazz;
-		this.property = property;
-	}
-
-	public Boolean run() {
-		try {
-			clazz.getDeclaredField( property );
-			return true;
-		}
-		catch ( NoSuchFieldException e ) {
-			return false;
-		}
-	}
-}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/ContainsMethod.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/ContainsMethod.java
deleted file mode 100644
index e561967..0000000
--- a/hibernate-validator/src/main/java/org/hibernate/validator/util/ContainsMethod.java
+++ /dev/null
@@ -1,41 +0,0 @@
-// $Id: ContainsMethod.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.util;
-
-import java.security.PrivilegedAction;
-
-/**
- * @author Emmanuel Bernard
- */
-public class ContainsMethod implements PrivilegedAction<Boolean> {
-	private final Class<?> clazz;
-	private final String property;
-
-	public static ContainsMethod action(Class<?> clazz, String property) {
-		return new ContainsMethod( clazz, property );
-	}
-
-	private ContainsMethod(Class<?> clazz, String property) {
-		this.clazz = clazz;
-		this.property = property;
-	}
-
-	public Boolean run() {
-		return ReflectionHelper.getMethod( clazz, property ) != null;
-	}
-}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/GetAnnotationParameter.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/GetAnnotationParameter.java
deleted file mode 100644
index 03b89d1..0000000
--- a/hibernate-validator/src/main/java/org/hibernate/validator/util/GetAnnotationParameter.java
+++ /dev/null
@@ -1,45 +0,0 @@
-// $Id: GetAnnotationParameter.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.util;
-
-import java.lang.annotation.Annotation;
-import java.security.PrivilegedAction;
-
-/**
- * @author Emmanuel Bernard
- */
-public class GetAnnotationParameter<T> implements PrivilegedAction<T> {
-	private final Annotation annotation;
-	private final String parameterName;
-	private final Class<T> type;
-
-
-	public static <T> GetAnnotationParameter<T> action(Annotation annotation, String parameterName, Class<T> type) {
-		return new GetAnnotationParameter<T>( annotation, parameterName, type );
-	}
-
-	private GetAnnotationParameter(Annotation annotation, String parameterName, Class<T> type) {
-		this.annotation = annotation;
-		this.parameterName = parameterName;
-		this.type = type;
-	}
-
-	public T run() {
-		return ReflectionHelper.getAnnotationParameter( annotation, parameterName, type );
-	}
-}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/GetClassLoader.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/GetClassLoader.java
deleted file mode 100644
index f0954b1..0000000
--- a/hibernate-validator/src/main/java/org/hibernate/validator/util/GetClassLoader.java
+++ /dev/null
@@ -1,49 +0,0 @@
-// $Id: GetClassLoader.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.util;
-
-import java.security.PrivilegedAction;
-
-/**
- * @author Emmanuel Bernard
- */
-public class GetClassLoader implements PrivilegedAction<ClassLoader> {
-	private final Class<?> clazz;
-
-	public static GetClassLoader fromContext() {
-		return new GetClassLoader( null );
-	}
-
-	public static GetClassLoader fromClass(Class<?> clazz) {
-		if ( clazz == null ) throw new IllegalArgumentException("Class is null");
-		return new GetClassLoader( clazz );
-	}
-
-	private GetClassLoader(Class<?> clazz) {
-		this.clazz = clazz;
-	}
-
-	public ClassLoader run() {
-		if (clazz != null) {
-			return clazz.getClassLoader();
-		}
-		else {
-			return Thread.currentThread().getContextClassLoader();
-		}
-	}
-}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/GetConstructor.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/GetConstructor.java
deleted file mode 100644
index ca296d0..0000000
--- a/hibernate-validator/src/main/java/org/hibernate/validator/util/GetConstructor.java
+++ /dev/null
@@ -1,47 +0,0 @@
-// $Id: GetConstructor.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.util;
-
-import java.lang.reflect.Constructor;
-import java.security.PrivilegedAction;
-
-/**
- * @author Emmanuel Bernard
- */
-public class GetConstructor<T> implements PrivilegedAction<Constructor<T>> {
-	private final Class<T> clazz;
-	private final Class<?>[] params;
-
-	public static <T> GetConstructor<T> action(Class<T> clazz, Class<?>... params) {
-		return new GetConstructor<T>( clazz, params );
-	}
-
-	private GetConstructor(Class<T> clazz, Class<?>... params) {
-		this.clazz = clazz;
-		this.params = params;
-	}
-
-	public Constructor<T> run() {
-		try {
-			return clazz.getConstructor(params);
-		}
-		catch ( NoSuchMethodException e ) {
-			return null;
-		}
-	}
-}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/GetDeclaredField.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/GetDeclaredField.java
deleted file mode 100644
index 7def2ee..0000000
--- a/hibernate-validator/src/main/java/org/hibernate/validator/util/GetDeclaredField.java
+++ /dev/null
@@ -1,49 +0,0 @@
-// $Id: GetDeclaredField.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.util;
-
-import java.lang.reflect.Field;
-import java.security.PrivilegedAction;
-
-/**
- * @author Emmanuel Bernard
- */
-public class GetDeclaredField implements PrivilegedAction<Field> {
-	private final Class<?> clazz;
-	private final String fieldName;
-
-	public static GetDeclaredField action(Class<?> clazz, String fieldName) {
-		return new GetDeclaredField( clazz, fieldName );
-	}
-
-	private GetDeclaredField(Class<?> clazz, String fieldName) {
-		this.clazz = clazz;
-		this.fieldName = fieldName;
-	}
-
-	public Field run() {
-		try {
-			final Field field = clazz.getDeclaredField( fieldName );
-			ReflectionHelper.setAccessibility( field );
-			return field;
-		}
-		catch ( NoSuchFieldException e ) {
-			return null;
-		}
-	}
-}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/GetDeclaredFields.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/GetDeclaredFields.java
deleted file mode 100644
index d8c0d8f..0000000
--- a/hibernate-validator/src/main/java/org/hibernate/validator/util/GetDeclaredFields.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// $Id: GetDeclaredFields.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.util;
-
-import java.security.PrivilegedAction;
-import java.lang.reflect.Field;
-
-/**
- * @author Emmanuel Bernard
- */
-public class GetDeclaredFields implements PrivilegedAction<Field[]> {
-	private final Class<?> clazz;
-
-	public static GetDeclaredFields action(Class<?> clazz) {
-		return new GetDeclaredFields( clazz );
-	}
-
-	private GetDeclaredFields(Class<?> clazz) {
-		this.clazz = clazz;
-	}
-
-	public Field[] run() {
-		return clazz.getDeclaredFields();
-	}
-}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/GetDeclaredMethods.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/GetDeclaredMethods.java
deleted file mode 100644
index 900c7df..0000000
--- a/hibernate-validator/src/main/java/org/hibernate/validator/util/GetDeclaredMethods.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// $Id: GetDeclaredMethods.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.util;
-
-import java.security.PrivilegedAction;
-import java.lang.reflect.Method;
-
-/**
- * @author Emmanuel Bernard
- */
-public class GetDeclaredMethods implements PrivilegedAction<Method[]> {
-	private final Class<?> clazz;
-
-	public static GetDeclaredMethods action(Class<?> clazz) {
-		return new GetDeclaredMethods( clazz );
-	}
-
-	private GetDeclaredMethods(Class<?> clazz) {
-		this.clazz = clazz;
-	}
-
-	public Method[] run() {
-		return clazz.getDeclaredMethods();
-	}
-}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/GetMethod.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/GetMethod.java
deleted file mode 100644
index 57abe5f..0000000
--- a/hibernate-validator/src/main/java/org/hibernate/validator/util/GetMethod.java
+++ /dev/null
@@ -1,47 +0,0 @@
-// $Id: GetMethod.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.util;
-
-import java.lang.reflect.Method;
-import java.security.PrivilegedAction;
-
-/**
- * @author Emmanuel Bernard
- */
-public class GetMethod implements PrivilegedAction<Method> {
-	private final Class<?> clazz;
-	private final String methodName;
-
-	public static GetMethod action(Class<?> clazz, String methodName) {
-		return new GetMethod( clazz, methodName );
-	}
-
-	private GetMethod(Class<?> clazz, String methodName) {
-		this.clazz = clazz;
-		this.methodName = methodName;
-	}
-
-	public Method run() {
-		try {
-			return clazz.getMethod(methodName);
-		}
-		catch ( NoSuchMethodException e ) {
-			return null;
-		}
-	}
-}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/GetMethodFromPropertyName.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/GetMethodFromPropertyName.java
deleted file mode 100644
index c36e154..0000000
--- a/hibernate-validator/src/main/java/org/hibernate/validator/util/GetMethodFromPropertyName.java
+++ /dev/null
@@ -1,42 +0,0 @@
-// $Id: GetMethodFromPropertyName.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.util;
-
-import java.lang.reflect.Method;
-import java.security.PrivilegedAction;
-
-/**
- * @author Emmanuel Bernard
- */
-public class GetMethodFromPropertyName implements PrivilegedAction<Method> {
-	private final Class<?> clazz;
-	private final String property;
-
-	public static GetMethodFromPropertyName action(Class<?> clazz, String property) {
-		return new GetMethodFromPropertyName( clazz, property );
-	}
-
-	private GetMethodFromPropertyName(Class<?> clazz, String property) {
-		this.clazz = clazz;
-		this.property = property;
-	}
-
-	public Method run() {
-			return ReflectionHelper.getMethod( clazz, property );
-	}
-}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/GetMethods.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/GetMethods.java
deleted file mode 100644
index 777d53f..0000000
--- a/hibernate-validator/src/main/java/org/hibernate/validator/util/GetMethods.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// $Id: GetMethods.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.util;
-
-import java.security.PrivilegedAction;
-import java.lang.reflect.Method;
-
-/**
- * @author Emmanuel Bernard
- */
-public class GetMethods implements PrivilegedAction<Method[]> {
-	private final Class<?> clazz;
-
-	public static GetMethods action(Class<?> clazz) {
-		return new GetMethods( clazz );
-	}
-
-	private GetMethods(Class<?> clazz) {
-		this.clazz = clazz;
-	}
-
-	public Method[] run() {
-		return clazz.getMethods();
-	}
-}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/IteratorEnumeration.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/IteratorEnumeration.java
new file mode 100644
index 0000000..417800a
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/util/IteratorEnumeration.java
@@ -0,0 +1,56 @@
+/*
+ * $Id: IteratorEnumeration.java 19090 2010-03-23 15:22:59Z hardy.ferentschik $
+ *
+ * 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.util;
+
+import java.util.Enumeration;
+import java.util.Iterator;
+
+/**
+ * An {@link Enumeration} implementation, that wraps an {@link Iterator}. Can
+ * be used to integrate older APIs working with enumerations with iterators.
+ *
+ * @author Gunnar Morling
+ * @param <T> The enumerated type.
+ */
+public class IteratorEnumeration<T> implements Enumeration<T> {
+
+	private Iterator<T> source;
+
+	/**
+	 * Creates a new IterationEnumeration.
+	 *
+	 * @param source The source iterator. Must not be null.
+	 */
+	public IteratorEnumeration(Iterator<T> source) {
+
+		if ( source == null ) {
+			throw new IllegalArgumentException( "Source must not be null" );
+		}
+
+		this.source = source;
+	}
+
+	public boolean hasMoreElements() {
+		return source.hasNext();
+	}
+
+	public T nextElement() {
+		return source.next();
+	}
+}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/LoadClass.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/LoadClass.java
deleted file mode 100644
index 89b2fa8..0000000
--- a/hibernate-validator/src/main/java/org/hibernate/validator/util/LoadClass.java
+++ /dev/null
@@ -1,56 +0,0 @@
-// $Id: LoadClass.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.util;
-
-import java.security.PrivilegedAction;
-import javax.validation.ValidationException;
-
-/**
- * @author Emmanuel Bernard
- */
-public class LoadClass implements PrivilegedAction<Class<?>> {
-	private final String className;
-	private final Class<?> caller;
-
-	public static LoadClass action(String className, Class<?> caller) {
-		return new LoadClass( className, caller );
-	}
-
-	private LoadClass(String className, Class<?> caller) {
-		this.className = className;
-		this.caller = caller;
-	}
-
-	public Class<?> run() {
-		try {
-			ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
-			if ( contextClassLoader != null ) {
-				return contextClassLoader.loadClass( className );
-			}
-		}
-		catch ( Throwable e ) {
-			// ignore
-		}
-		try {
-			return Class.forName( className, true, caller.getClassLoader() );
-		}
-		catch ( ClassNotFoundException e ) {
-			throw new ValidationException("Unable to load class: " + className, e);
-		}
-	}
-}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/LoggerFactory.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/LoggerFactory.java
index c84894f..7e1dd64 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/util/LoggerFactory.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/util/LoggerFactory.java
@@ -28,5 +28,10 @@ public class LoggerFactory {
 		StackTraceElement directCaller = t.getStackTrace()[1];
 		return org.slf4j.LoggerFactory.getLogger( directCaller.getClassName() );
 	}
+
+	// private constructor to avoid instantiation
+	private LoggerFactory(){
+
+	}
 }
 
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/NewInstance.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/NewInstance.java
deleted file mode 100644
index c94b2be..0000000
--- a/hibernate-validator/src/main/java/org/hibernate/validator/util/NewInstance.java
+++ /dev/null
@@ -1,53 +0,0 @@
-// $Id: NewInstance.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.util;
-
-import java.security.PrivilegedAction;
-import javax.validation.ValidationException;
-
-/**
- * @author Emmanuel Bernard
- */
-public class NewInstance<T> implements PrivilegedAction<T> {
-	private final Class<T> clazz;
-	private final String message;
-
-	public static <T> NewInstance<T> action(Class<T> clazz, String message) {
-		return new NewInstance<T>( clazz, message );
-	}
-
-	private NewInstance(Class<T> clazz, String message) {
-		this.clazz = clazz;
-		this.message = message;
-	}
-
-	public T run() {
-		try {
-			return clazz.newInstance();
-		}
-		catch ( InstantiationException e ) {
-			throw new ValidationException( "Unable to instantiate " + message + ": " + clazz, e );
-		}
-		catch ( IllegalAccessException e ) {
-			throw new ValidationException( "Unable to instantiate " + clazz, e );
-		}
-		catch ( RuntimeException e ) {
-			throw new ValidationException( "Unable to instantiate " + clazz, e );
-		}
-	}
-}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/ReflectionHelper.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/ReflectionHelper.java
index 63d7de4..fa60555 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/util/ReflectionHelper.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/util/ReflectionHelper.java
@@ -1,4 +1,4 @@
-// $Id: ReflectionHelper.java 17838 2009-10-26 16:11:42Z hardy.ferentschik $
+// $Id: ReflectionHelper.java 19581 2010-05-21 10:31:30Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -19,16 +19,17 @@ package org.hibernate.validator.util;
 
 import java.beans.Introspector;
 import java.lang.annotation.Annotation;
-import java.lang.reflect.AccessibleObject;
+import java.lang.annotation.ElementType;
+import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Member;
 import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.lang.reflect.TypeVariable;
 import java.lang.reflect.WildcardType;
+import java.security.AccessController;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Iterator;
@@ -38,12 +39,26 @@ import javax.validation.ValidationException;
 
 import com.googlecode.jtype.TypeUtils;
 
+import org.hibernate.validator.util.privilegedactions.ConstructorInstance;
+import org.hibernate.validator.util.privilegedactions.GetAnnotationParameter;
+import org.hibernate.validator.util.privilegedactions.GetClassLoader;
+import org.hibernate.validator.util.privilegedactions.GetConstructor;
+import org.hibernate.validator.util.privilegedactions.GetDeclaredField;
+import org.hibernate.validator.util.privilegedactions.GetDeclaredFields;
+import org.hibernate.validator.util.privilegedactions.GetDeclaredMethods;
+import org.hibernate.validator.util.privilegedactions.GetMethod;
+import org.hibernate.validator.util.privilegedactions.GetMethodFromPropertyName;
+import org.hibernate.validator.util.privilegedactions.LoadClass;
+import org.hibernate.validator.util.privilegedactions.NewInstance;
+import org.hibernate.validator.util.privilegedactions.SetAccessibility;
+
 /**
- * Some reflection utility methods.
+ * Some reflection utility methods. Where necessary calls will be performed as {@code PrivilegedAction} which is necessary
+ * for situations where a security manager is in place.
  *
  * @author Hardy Ferentschik
  */
-public class ReflectionHelper {
+public final class ReflectionHelper {
 
 	/**
 	 * Private constructor in order to avoid instantiation.
@@ -51,32 +66,87 @@ public class ReflectionHelper {
 	private ReflectionHelper() {
 	}
 
-	//run client in privileged block
-	@SuppressWarnings("unchecked")
-	static <T> T getAnnotationParameter(Annotation annotation, String parameterName, Class<T> type) {
-		try {
-			Method m = annotation.getClass().getMethod( parameterName );
-			Object o = m.invoke( annotation );
-			if ( o.getClass().getName().equals( type.getName() ) ) {
-				return ( T ) o;
-			}
-			else {
-				String msg = "Wrong parameter type. Expected: " + type.getName() + " Actual: " + o.getClass().getName();
-				throw new ValidationException( msg );
-			}
+	public static ClassLoader getClassLoaderFromContext() {
+		ClassLoader loader;
+		GetClassLoader action = GetClassLoader.fromContext();
+		if ( System.getSecurityManager() != null ) {
+			loader = AccessController.doPrivileged( action );
+		}
+		else {
+			loader = action.run();
+		}
+		return loader;
+	}
+
+	public static ClassLoader getClassLoaderFromClass(Class<?> clazz) {
+		ClassLoader loader;
+		GetClassLoader action = GetClassLoader.fromClass( clazz );
+		if ( System.getSecurityManager() != null ) {
+			loader = AccessController.doPrivileged( action );
+		}
+		else {
+			loader = action.run();
+		}
+		return loader;
+	}
+
+	public static Class<?> loadClass(String className, Class<?> caller) {
+		LoadClass action = LoadClass.action( className, caller );
+		if ( System.getSecurityManager() != null ) {
+			return AccessController.doPrivileged( action );
+		}
+		else {
+			return action.run();
+		}
+	}
+
+	public static <T> Constructor<T> getConstructor(Class<T> clazz, Class<?>... params) {
+		Constructor<T> constructor;
+		GetConstructor<T> action = GetConstructor.action( clazz, params );
+		if ( System.getSecurityManager() != null ) {
+			constructor = AccessController.doPrivileged( action );
+		}
+		else {
+			constructor = action.run();
+		}
+		return constructor;
+	}
+
+	public static <T> T newInstance(Class<T> clazz, String message) {
+		T instance;
+		NewInstance<T> newInstance = NewInstance.action( clazz, message );
+		if ( System.getSecurityManager() != null ) {
+			instance = AccessController.doPrivileged( newInstance );
+		}
+		else {
+			instance = newInstance.run();
 		}
-		catch ( NoSuchMethodException e ) {
-			String msg = "The specified annotation defines no parameter '" + parameterName + "'.";
-			throw new ValidationException( msg, e );
+		return instance;
+	}
+
+	public static <T> T newConstructorInstance(Constructor<T> constructor, Object... initArgs) {
+		T instance;
+		ConstructorInstance<T> newInstance = ConstructorInstance.action( constructor, initArgs );
+		if ( System.getSecurityManager() != null ) {
+			instance = AccessController.doPrivileged( newInstance );
 		}
-		catch ( IllegalAccessException e ) {
-			String msg = "Unable to get '" + parameterName + "' from " + annotation.getClass().getName();
-			throw new ValidationException( msg, e );
+		else {
+			instance = newInstance.run();
 		}
-		catch ( InvocationTargetException e ) {
-			String msg = "Unable to get '" + parameterName + "' from " + annotation.getClass().getName();
-			throw new ValidationException( msg, e );
+		return instance;
+	}
+
+	@SuppressWarnings("unchecked")
+	public static <T> T getAnnotationParameter(Annotation annotation, String parameterName, Class<T> type) {
+		T result;
+		GetAnnotationParameter<T> action = GetAnnotationParameter.action( annotation, parameterName, type );
+		if ( System.getSecurityManager() != null ) {
+			result = AccessController.doPrivileged( action );
+		}
+		else {
+			result = action.run();
 		}
+		return result;
 	}
 
 	/**
@@ -110,6 +180,71 @@ public class ReflectionHelper {
 	}
 
 	/**
+	 * Checks whether the property with the specified name and type exists on the given class.
+	 *
+	 * @param clazz The class to check for the property. Cannot be {@code null}.
+	 * @param property The property name without 'is', 'get' or 'has'. Cannot be {@code null} or empty.
+	 * @param elementType The element type. Either {@code ElementType.FIELD} or {@code ElementType METHOD}.
+	 *
+	 * @return {@code true} is the property and can be access via the specified type, {@code false} otherwise.
+	 */
+	public static boolean propertyExists(Class<?> clazz, String property, ElementType elementType) {
+		return getMember( clazz, property, elementType ) != null;
+	}
+
+	/**
+	 * Returns the member with the given name and type.
+	 *
+	 * @param clazz The class from which to retrieve the member. Cannot be {@code null}.
+	 * @param property The property name without 'is', 'get' or 'has'. Cannot be {@code null} or empty.
+	 * @param elementType The element type. Either {@code ElementType.FIELD} or {@code ElementType METHOD}.
+	 *
+	 * @return the member which matching the name and type or {@code null} if no such member exists.
+	 */
+	public static Member getMember(Class<?> clazz, String property, ElementType elementType) {
+		if ( clazz == null ) {
+			throw new IllegalArgumentException( "The class cannot be null" );
+		}
+
+		if ( property == null || property.length() == 0 ) {
+			throw new IllegalArgumentException( "Property name cannot be null or empty" );
+		}
+
+		if ( !( ElementType.FIELD.equals( elementType ) || ElementType.METHOD.equals( elementType ) ) ) {
+			throw new IllegalArgumentException( "Element type has to be FIELD or METHOD" );
+		}
+
+		Member member = null;
+		if ( ElementType.FIELD.equals( elementType ) ) {
+			GetDeclaredField action = GetDeclaredField.action( clazz, property );
+			if ( System.getSecurityManager() != null ) {
+				member = AccessController.doPrivileged( action );
+			}
+			else {
+				member = action.run();
+			}
+		}
+		else {
+			String methodName = property.substring( 0, 1 ).toUpperCase() + property.substring( 1 );
+			String[] prefixes = { "is", "get", "has" };
+			for ( String prefix : prefixes ) {
+				GetMethod action = GetMethod.action( clazz, prefix + methodName );
+				if ( System.getSecurityManager() != null ) {
+					member = AccessController.doPrivileged( action );
+				}
+				else {
+					member = action.run();
+				}
+				if ( member != null ) {
+					break;
+				}
+			}
+		}
+		return member;
+	}
+
+
+	/**
 	 * Returns the type of the field of return type of a method.
 	 *
 	 * @param member the member for which to get the type.
@@ -117,7 +252,6 @@ public class ReflectionHelper {
 	 * @return Returns the type of the field of return type of a method.
 	 */
 	public static Class<?> getType(Member member) {
-
 		Class<?> type = null;
 		if ( member instanceof Field ) {
 			type = ( ( Field ) member ).getType();
@@ -181,15 +315,13 @@ public class ReflectionHelper {
 		return value;
 	}
 
-	static void setAccessibility(Member member) {
-		// HV-257
-		// Also set accessibility in case of public abstract members. If you proxy an interface using java.lang.reflect.Proxy
-		// per default you will get a IllegalAccessException since you are not allowed to access public abstract methods.
-		// Seems odd. One could argue that the proxy 'is' the implementation for the interface method and hence they
-		// should be accessible. Maybe this is a JVM bug !?
-		if ( !Modifier.isPublic( member.getModifiers() )
-				|| ( Modifier.isPublic( member.getModifiers() ) && Modifier.isAbstract( member.getModifiers() ) ) ) {
-			( ( AccessibleObject ) member ).setAccessible( true );
+	public static void setAccessibility(Member member) {
+		SetAccessibility action = SetAccessibility.action( member );
+		if ( System.getSecurityManager() != null ) {
+			AccessController.doPrivileged( action );
+		}
+		else {
+			action.run();
 		}
 	}
 
@@ -325,7 +457,7 @@ public class ReflectionHelper {
 	 * @return The mapped value or {@code null} if {@code value} is {@code null} or not implementing @{code Map}.
 	 */
 	public static Object getMappedValue(Object value, Object key) {
-		if ( value == null || !( value instanceof Map ) ) {
+		if ( !( value instanceof Map ) ) {
 			return null;
 		}
 
@@ -334,30 +466,140 @@ public class ReflectionHelper {
 		return map.get( key );
 	}
 
+
 	/**
-	 * Returns the method with the specified name or <code>null</code> if it does not exist.
+	 * Returns the field with the specified name or <code>null</code> if it does not exist.
 	 *
 	 * @param clazz The class to check.
-	 * @param methodName The method name.
+	 * @param fieldName The field name.
 	 *
-	 * @return Returns the method with the specified name or <code>null</code> if it does not exist.
+	 * @return Returns the field with the specified name or <code>null</code> if it does not exist.
 	 */
-	//run client in privileged block
-	static Method getMethod(Class<?> clazz, String methodName) {
-		try {
-			char string[] = methodName.toCharArray();
-			string[0] = Character.toUpperCase( string[0] );
-			methodName = new String( string );
-			try {
-				return clazz.getMethod( "get" + methodName );
-			}
-			catch ( NoSuchMethodException e ) {
-				return clazz.getMethod( "is" + methodName );
-			}
+	public static Field getField(Class<?> clazz, String fieldName) {
+		GetDeclaredField action = GetDeclaredField.action( clazz, fieldName );
+		final Field field;
+		if ( System.getSecurityManager() != null ) {
+			field = AccessController.doPrivileged( action );
 		}
-		catch ( NoSuchMethodException e ) {
-			return null;
+		else {
+			field = action.run();
 		}
+		return field;
+	}
+
+	/**
+	 * Checks whether the specified class contains a field with the given name.
+	 *
+	 * @param clazz The class to check.
+	 * @param fieldName The field name.
+	 *
+	 * @return Returns {@code true} if the field exists, {@code false} otherwise.
+	 */
+	public static boolean containsField(Class<?> clazz, String fieldName) {
+		return getField( clazz, fieldName ) != null;
+	}
+
+	/**
+	 * Returns the fields of the specified class.
+	 *
+	 * @param clazz The class for which to retrieve the fields.
+	 *
+	 * @return Returns the fields for this class.
+	 */
+	public static Field[] getFields(Class<?> clazz) {
+		GetDeclaredFields action = GetDeclaredFields.action( clazz );
+		final Field[] fields;
+		if ( System.getSecurityManager() != null ) {
+			fields = AccessController.doPrivileged( action );
+		}
+		else {
+			fields = action.run();
+		}
+		return fields;
+	}
+
+	/**
+	 * Returns the method with the specified property name or {@code null} if it does not exist. This method will
+	 * prepend  'is' and 'get' to the property name and capitalize the first letter.
+	 *
+	 * @param clazz The class to check.
+	 * @param methodName The property name.
+	 *
+	 * @return Returns the method with the specified property or {@code null} if it does not exist.
+	 */
+	public static Method getMethodFromPropertyName(Class<?> clazz, String methodName) {
+		Method method;
+		GetMethodFromPropertyName action = GetMethodFromPropertyName.action( clazz, methodName );
+		if ( System.getSecurityManager() != null ) {
+			method = AccessController.doPrivileged( action );
+		}
+		else {
+			method = action.run();
+		}
+		return method;
+	}
+
+	/**
+	 * Checks whether the specified class contains a method for the specified property.
+	 *
+	 * @param clazz The class to check.
+	 * @param property The property name.
+	 *
+	 * @return Returns {@code true} if the method exists, {@code false} otherwise.
+	 */
+	public static boolean containsMethodWithPropertyName(Class<?> clazz, String property) {
+		return getMethodFromPropertyName( clazz, property ) != null;
+	}
+
+	/**
+	 * Returns the method with the specified name or {@code null} if it does not exist.
+	 *
+	 * @param clazz The class to check.
+	 * @param methodName The property name.
+	 *
+	 * @return Returns the method with the specified property or {@code null}if it does not exist.
+	 */
+	public static Method getMethod(Class<?> clazz, String methodName) {
+		Method method;
+		GetMethod action = GetMethod.action( clazz, methodName );
+		if ( System.getSecurityManager() != null ) {
+			method = AccessController.doPrivileged( action );
+		}
+		else {
+			method = action.run();
+		}
+		return method;
+	}
+
+	/**
+	 * Returns the methods of the specified class.
+	 *
+	 * @param clazz The class for which to retrieve the methods.
+	 *
+	 * @return Returns the methods for this class.
+	 */
+	public static Method[] getMethods(Class<?> clazz) {
+		GetDeclaredMethods action = GetDeclaredMethods.action( clazz );
+		final Method[] methods;
+		if ( System.getSecurityManager() != null ) {
+			methods = AccessController.doPrivileged( action );
+		}
+		else {
+			methods = action.run();
+		}
+		return methods;
+	}
+
+	/**
+	 * Checks whether the specified class contains a method with the given name.
+	 *
+	 * @param clazz The class to check.
+	 * @param methodName The method name.
+	 *
+	 * @return Returns {@code true} if the method exists, {@code false} otherwise.
+	 */
+	public static boolean containsMethod(Class<?> clazz, String methodName) {
+		return getMethodFromPropertyName( clazz, methodName ) != null;
 	}
 
 	/**
@@ -407,9 +649,23 @@ public class ReflectionHelper {
 	 * Get all superclasses and interfaces recursively.
 	 *
 	 * @param clazz The class to start the search with.
+	 *
+	 * @return List of all super classes and interfaces of {@code clazz}. The list contains the class itself! The empty
+	 *         list is returned if {@code clazz} is {@code null}.
+	 */
+	public static List<Class<?>> computeClassHierarchy(Class<?> clazz) {
+		List<Class<?>> classes = new ArrayList<Class<?>>();
+		computeClassHierarchy( clazz, classes );
+		return classes;
+	}
+
+	/**
+	 * Get all superclasses and interfaces recursively.
+	 *
+	 * @param clazz The class to start the search with.
 	 * @param classes List of classes to which to add all found super classes and interfaces.
 	 */
-	public static void computeClassHierarchy(Class<?> clazz, List<Class<?>> classes) {
+	private static void computeClassHierarchy(Class<?> clazz, List<Class<?>> classes) {
 		for ( Class current = clazz; current != null; current = current.getSuperclass() ) {
 			if ( classes.contains( current ) ) {
 				return;
@@ -430,8 +686,7 @@ public class ReflectionHelper {
 	 * @return {@code true} if {@code clazz} extends or implements {@code superClassOrInterface}, {@code false} otherwise.
 	 */
 	private static boolean extendsOrImplements(Class<?> clazz, Class<?> superClassOrInterface) {
-		List<Class<?>> classes = new ArrayList<Class<?>>();
-		computeClassHierarchy( clazz, classes );
+		List<Class<?>> classes = computeClassHierarchy( clazz );
 		return classes.contains( superClassOrInterface );
 	}
 }
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/SetAccessibility.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/SetAccessibility.java
deleted file mode 100644
index a11ecd2..0000000
--- a/hibernate-validator/src/main/java/org/hibernate/validator/util/SetAccessibility.java
+++ /dev/null
@@ -1,41 +0,0 @@
-// $Id: SetAccessibility.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.util;
-
-import java.lang.reflect.Member;
-import java.security.PrivilegedAction;
-
-/**
- * @author Emmanuel Bernard
- */
-public class SetAccessibility implements PrivilegedAction<Object> {
-	private final Member member;
-
-	public static SetAccessibility action(Member member) {
-		return new SetAccessibility( member );
-	}
-
-	private SetAccessibility(Member member) {
-		this.member = member;
-	}
-
-	public Object run() {
-		ReflectionHelper.setAccessibility( member );
-		return member;
-	}
-}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/ValidatorTypeHelper.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/ValidatorTypeHelper.java
index a791ccf..aa69722 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/util/ValidatorTypeHelper.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/util/ValidatorTypeHelper.java
@@ -1,4 +1,4 @@
-// $Id: ValidatorTypeHelper.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: ValidatorTypeHelper.java 19781 2010-06-22 16:30:24Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -48,17 +48,13 @@ public class ValidatorTypeHelper {
 	 */
 	public static <T extends Annotation> Map<Type, Class<? extends ConstraintValidator<?, ?>>> getValidatorsTypes(
 			List<Class<? extends ConstraintValidator<T, ?>>> validators) {
-		if ( validators == null || validators.size() == 0 ) {
-			throw new ValidationException( "No ConstraintValidators associated to @Constraint" );
-		}
-		else {
-			Map<Type, Class<? extends ConstraintValidator<?, ?>>> validatorsTypes =
-					new HashMap<Type, Class<? extends ConstraintValidator<?, ?>>>();
-			for ( Class<? extends ConstraintValidator<?, ?>> validator : validators ) {
-				validatorsTypes.put( extractType( validator ), validator );
-			}
-			return validatorsTypes;
+		Map<Type, Class<? extends ConstraintValidator<?, ?>>> validatorsTypes =
+				new HashMap<Type, Class<? extends ConstraintValidator<?, ?>>>();
+		for ( Class<? extends ConstraintValidator<?, ?>> validator : validators ) {
+			validatorsTypes.put( extractType( validator ), validator );
 		}
+		return validatorsTypes;
+
 	}
 
 	private static Type extractType(Class<? extends ConstraintValidator<?, ?>> validator) {
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/Version.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/Version.java
index 0ee70ae..25fbf44 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/util/Version.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/util/Version.java
@@ -1,4 +1,4 @@
-// $Id: Version.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: Version.java 19551 2010-05-19 15:46:02Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -58,4 +58,9 @@ public class Version {
 
 	public static void touch() {
 	}
+
+	// helper class should not have a public constructor
+	private Version() {
+
+	}
 }
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/annotationfactory/AnnotationDescriptor.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/annotationfactory/AnnotationDescriptor.java
index 0dce9b7..852b740 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/util/annotationfactory/AnnotationDescriptor.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/util/annotationfactory/AnnotationDescriptor.java
@@ -1,7 +1,7 @@
-// $Id: AnnotationDescriptor.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: AnnotationDescriptor.java 19251 2010-04-20 15:28:18Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
+* 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.
 *
@@ -39,6 +39,31 @@ public class AnnotationDescriptor<T extends Annotation> {
 
 	private final Map<String, Object> elements = new HashMap<String, Object>();
 
+	/**
+	 * Returns a new descriptor for the given annotation type.
+	 * 
+	 * @param <S> The type of the annotation.
+	 * @param annotationType The annotation's class.
+	 * 
+	 * @return A new descriptor for the given annotation type.
+	 */
+	public static <S extends Annotation> AnnotationDescriptor<S> getInstance(Class<S> annotationType) {
+		return new AnnotationDescriptor<S>(annotationType);
+	}
+	
+	/**
+	 * Returns a new descriptor for the given annotation type.
+	 * 
+	 * @param <S> The type of the annotation.
+	 * @param annotationType The annotation's class.
+	 * @param elements A map with attribute values for the annotation to be created.
+	 * 
+	 * @return A new descriptor for the given annotation type.
+	 */
+	public static <S extends Annotation> AnnotationDescriptor<S> getInstance(Class<S> annotationType, Map<String, Object> elements) {
+		return new AnnotationDescriptor<S>(annotationType, elements);
+	}
+	
 	public AnnotationDescriptor(Class<T> annotationType) {
 		this.type = annotationType;
 	}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/annotationfactory/AnnotationFactory.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/annotationfactory/AnnotationFactory.java
index 7a8d0f4..10e10c0 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/util/annotationfactory/AnnotationFactory.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/util/annotationfactory/AnnotationFactory.java
@@ -1,4 +1,4 @@
-// $Id: AnnotationFactory.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: AnnotationFactory.java 19573 2010-05-20 22:13:26Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -22,36 +22,31 @@ import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Proxy;
-import java.security.AccessController;
-
-import org.hibernate.validator.util.GetConstructor;
-import org.hibernate.validator.util.GetClassLoader;
 
+import org.hibernate.validator.util.ReflectionHelper;
 
 /**
  * Creates live annotations (actually <code>AnnotationProxies</code>) from <code>AnnotationDescriptors</code>.
  *
  * @author Paolo Perrotta
  * @author Davide Marchignoli
+ * @author Hardy Ferentschik
  * @see AnnotationProxy
  */
 public class AnnotationFactory {
 
 	@SuppressWarnings("unchecked")
 	public static <T extends Annotation> T create(AnnotationDescriptor<T> descriptor) {
-		boolean isSecured = System.getSecurityManager() != null;
-		GetClassLoader action = GetClassLoader.fromContext();
-		ClassLoader classLoader = isSecured ? AccessController.doPrivileged( action ) : action.run();
-        //TODO round 34ms to generate the proxy, hug! is Javassist Faster?
-        Class<T> proxyClass = (Class<T>) Proxy.getProxyClass( classLoader, descriptor.type() );
+		ClassLoader classLoader = ReflectionHelper.getClassLoaderFromContext();
+		Class<T> proxyClass = ( Class<T> ) Proxy.getProxyClass( classLoader, descriptor.type() );
 		InvocationHandler handler = new AnnotationProxy( descriptor );
 		try {
 			return getProxyInstance( proxyClass, handler );
 		}
-		catch (RuntimeException e) {
+		catch ( RuntimeException e ) {
 			throw e;
 		}
-		catch (Exception e) {
+		catch ( Exception e ) {
 			throw new RuntimeException( e );
 		}
 	}
@@ -59,14 +54,7 @@ public class AnnotationFactory {
 	private static <T extends Annotation> T getProxyInstance(Class<T> proxyClass, InvocationHandler handler) throws
 			SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException,
 			IllegalAccessException, InvocationTargetException {
-		GetConstructor<T> action = GetConstructor.action( proxyClass, InvocationHandler.class );
-		final Constructor<T> constructor;
-		if ( System.getSecurityManager() != null ) {
-			constructor = AccessController.doPrivileged( action );
-		}
-		else {
-			constructor = action.run();
-		}
-		return constructor.newInstance( handler );
+		final Constructor<T> constructor = ReflectionHelper.getConstructor( proxyClass, InvocationHandler.class );
+		return ReflectionHelper.newConstructorInstance( constructor, handler );
 	}
 }
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/annotationfactory/AnnotationProxy.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/annotationfactory/AnnotationProxy.java
index d988386..da1107d 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/util/annotationfactory/AnnotationProxy.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/util/annotationfactory/AnnotationProxy.java
@@ -1,7 +1,7 @@
-// $Id: AnnotationProxy.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: AnnotationProxy.java 19800 2010-06-23 16:18:16Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
+* 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.
 *
@@ -17,17 +17,17 @@
 */
 package org.hibernate.validator.util.annotationfactory;
 
+import java.io.Serializable;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
-import java.util.Comparator;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.SortedSet;
 import java.util.TreeSet;
-import java.security.AccessController;
 
-import org.hibernate.validator.util.GetDeclaredMethods;
+import org.hibernate.validator.util.ReflectionHelper;
+
 
 /**
  * A concrete implementation of <code>Annotation</code> that pretends it is a
@@ -53,51 +53,43 @@ import org.hibernate.validator.util.GetDeclaredMethods;
  * @author Davide Marchignoli
  * @see java.lang.annotation.Annotation
  */
-public class AnnotationProxy implements Annotation, InvocationHandler {
+public class AnnotationProxy implements Annotation, InvocationHandler, Serializable {
 
+	private static final long serialVersionUID = 6907601010599429454L;
 	private final Class<? extends Annotation> annotationType;
-	//FIXME it's probably better to use String as a key rather than Method
-	//      to speed up and avoid any fancy permsize/GC issue
-	//      I'd better check the litterature on the subject
-	private final Map<Method, Object> values;
+	private final Map<String, Object> values;
+
 
 	public AnnotationProxy(AnnotationDescriptor descriptor) {
 		this.annotationType = descriptor.type();
 		values = getAnnotationValues( descriptor );
 	}
 
-	private Map<Method, Object> getAnnotationValues(AnnotationDescriptor descriptor) {
-		Map<Method, Object> result = new HashMap<Method, Object>();
+	private Map<String, Object> getAnnotationValues(AnnotationDescriptor descriptor) {
+		Map<String, Object> result = new HashMap<String, Object>();
 		int processedValuesFromDescriptor = 0;
-		GetDeclaredMethods action = GetDeclaredMethods.action( annotationType );
-		final Method[] declaredMethods;
-		if ( System.getSecurityManager() != null ) {
-			declaredMethods = AccessController.doPrivileged( action );
-		}
-		else {
-			declaredMethods = action.run();
-		}
+		final Method[] declaredMethods = ReflectionHelper.getMethods( annotationType );
 		for ( Method m : declaredMethods ) {
 			if ( descriptor.containsElement( m.getName() ) ) {
-				result.put( m, descriptor.valueOf( m.getName() ) );
+				result.put( m.getName(), descriptor.valueOf( m.getName() ) );
 				processedValuesFromDescriptor++;
 			}
 			else if ( m.getDefaultValue() != null ) {
-				result.put( m, m.getDefaultValue() );
+				result.put( m.getName(), m.getDefaultValue() );
 			}
 			else {
 				throw new IllegalArgumentException( "No value provided for " + m.getName() );
 			}
 		}
 		if ( processedValuesFromDescriptor != descriptor.numberOfElements() ) {
-			throw new RuntimeException( "Trying to instanciate " + annotationType + " with unknown paramters." );
+			throw new RuntimeException( "Trying to instantiate " + annotationType + " with unknown parameters." );
 		}
 		return result;
 	}
 
 	public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
-		if ( values.containsKey( method ) ) {
-			return values.get( method );
+		if ( values.containsKey( method.getName() ) ) {
+			return values.get( method.getName() );
 		}
 		return method.invoke( this, args );
 	}
@@ -108,9 +100,9 @@ public class AnnotationProxy implements Annotation, InvocationHandler {
 
 	public String toString() {
 		StringBuilder result = new StringBuilder();
-		result.append( '@' ).append( annotationType().getName() ).append( '(' );
-		for ( Method m : getRegisteredMethodsInAlphabeticalOrder() ) {
-			result.append( m.getName() ).append( '=' ).append( values.get( m ) ).append( ", " );
+		result.append( '@' ).append( annotationType.getName() ).append( '(' );
+		for ( String s : getRegisteredMethodsInAlphabeticalOrder() ) {
+			result.append( s ).append( '=' ).append( values.get( s ) ).append( ", " );
 		}
 		// remove last separator:
 		if ( values.size() > 0 ) {
@@ -124,15 +116,8 @@ public class AnnotationProxy implements Annotation, InvocationHandler {
 		return result.toString();
 	}
 
-	private SortedSet<Method> getRegisteredMethodsInAlphabeticalOrder() {
-		SortedSet<Method> result = new TreeSet<Method>(
-				new Comparator<Method>() {
-					public int compare(Method o1, Method o2) {
-						return o1.getName().compareTo( o2.getName() );
-					}
-				}
-		);
-		//List<Method> result = new LinkedList<Method>();
+	private SortedSet<String> getRegisteredMethodsInAlphabeticalOrder() {
+		SortedSet<String> result = new TreeSet<String>();
 		result.addAll( values.keySet() );
 		return result;
 	}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/annotationfactory/package.html b/hibernate-validator/src/main/java/org/hibernate/validator/util/annotationfactory/package.html
index 94cddd9..c88a53c 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/util/annotationfactory/package.html
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/util/annotationfactory/package.html
@@ -1,26 +1,26 @@
+<!--
+  ~ $Id: package.html 19596 2010-05-24 10:31:09Z hardy.ferentschik $
+  ~
+  ~ 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.
+-->
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html>
 <head>
-<!--
-
-  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.
-
--->
 </head>
 <body>
-Classes in this package allow to generate annotation proxies.
+Annotation proxy helper.
 </body>
 </html>
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/package.html b/hibernate-validator/src/main/java/org/hibernate/validator/util/package.html
index 6f9fdfa..e2307e6 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/util/package.html
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/util/package.html
@@ -1,26 +1,26 @@
+<!--
+  ~ $Id: package.html 19596 2010-05-24 10:31:09Z hardy.ferentschik $
+  ~
+  ~ 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.
+-->
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html>
 <head>
-<!--
-
-  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.
-
--->
 </head>
 <body>
-This package contains independend helper classes.
+Independent helper classes.
 </body>
 </html>
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/ConstructorInstance.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/ConstructorInstance.java
new file mode 100644
index 0000000..90b5902
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/ConstructorInstance.java
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+
+// $Id: ConstructorInstance.java 19573 2010-05-20 22:13:26Z hardy.ferentschik $
+
+package org.hibernate.validator.util.privilegedactions;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.security.PrivilegedAction;
+import javax.validation.ValidationException;
+
+/**
+ * Execute instance creation as privileged action.
+ *
+ * @author Emmanuel Bernard
+ * @author Hardy Ferentschik
+ */
+public class ConstructorInstance<T> implements PrivilegedAction<T> {
+	private final Constructor<T> constructor;
+	private final Object[] initArgs;
+
+	public static <T> ConstructorInstance<T> action(Constructor<T> constructor, Object... initArgs) {
+		return new ConstructorInstance<T>( constructor, initArgs );
+	}
+
+	private ConstructorInstance(Constructor<T> constructor, Object... initArgs) {
+		this.constructor = constructor;
+		this.initArgs = initArgs;
+	}
+
+	public T run() {
+		try {
+			return constructor.newInstance( initArgs );
+		}
+		catch ( InstantiationException e ) {
+			throw new ValidationException( "Unable to instantiate" + constructor.getName(), e );
+		}
+		catch ( IllegalAccessException e ) {
+			throw new ValidationException( "Unable to instantiate" + constructor.getName(), e );
+		}
+		catch ( InvocationTargetException e ) {
+			throw new ValidationException( "Unable to instantiate" + constructor.getName(), e );
+		}
+		catch ( RuntimeException e ) {
+			throw new ValidationException( "Unable to instantiate" + constructor.getName(), e );
+		}
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/GetAnnotationParameter.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/GetAnnotationParameter.java
new file mode 100644
index 0000000..00fb341
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/GetAnnotationParameter.java
@@ -0,0 +1,72 @@
+// $Id: GetAnnotationParameter.java 19573 2010-05-20 22:13:26Z hardy.ferentschik $
+/*
+* 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.util.privilegedactions;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.security.PrivilegedAction;
+import javax.validation.ValidationException;
+
+/**
+ * @author Emmanuel Bernard
+ * @author Hardy Ferentschik
+ */
+public class GetAnnotationParameter<T> implements PrivilegedAction<T> {
+	private final Annotation annotation;
+	private final String parameterName;
+	private final Class<T> type;
+
+
+	public static <T> GetAnnotationParameter<T> action(Annotation annotation, String parameterName, Class<T> type) {
+		return new GetAnnotationParameter<T>( annotation, parameterName, type );
+	}
+
+	private GetAnnotationParameter(Annotation annotation, String parameterName, Class<T> type) {
+		this.annotation = annotation;
+		this.parameterName = parameterName;
+		this.type = type;
+	}
+
+	public T run() {
+		try {
+			Method m = annotation.getClass().getMethod( parameterName );
+			m.setAccessible( true );
+			Object o = m.invoke( annotation );
+			if ( o.getClass().getName().equals( type.getName() ) ) {
+				return ( T ) o;
+			}
+			else {
+				String msg = "Wrong parameter type. Expected: " + type.getName() + " Actual: " + o.getClass().getName();
+				throw new ValidationException( msg );
+			}
+		}
+		catch ( NoSuchMethodException e ) {
+			String msg = "The specified annotation defines no parameter '" + parameterName + "'.";
+			throw new ValidationException( msg, e );
+		}
+		catch ( IllegalAccessException e ) {
+			String msg = "Unable to get '" + parameterName + "' from " + annotation.getClass().getName();
+			throw new ValidationException( msg, e );
+		}
+		catch ( InvocationTargetException e ) {
+			String msg = "Unable to get '" + parameterName + "' from " + annotation.getClass().getName();
+			throw new ValidationException( msg, e );
+		}
+	}
+}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/GetClassLoader.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/GetClassLoader.java
new file mode 100644
index 0000000..93674ca
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/GetClassLoader.java
@@ -0,0 +1,51 @@
+// $Id: GetClassLoader.java 19566 2010-05-20 11:58:01Z hardy.ferentschik $
+/*
+* 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.util.privilegedactions;
+
+import java.security.PrivilegedAction;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public final class GetClassLoader implements PrivilegedAction<ClassLoader> {
+	private final Class<?> clazz;
+
+	public static GetClassLoader fromContext() {
+		return new GetClassLoader( null );
+	}
+
+	public static GetClassLoader fromClass(Class<?> clazz) {
+		if ( clazz == null ) {
+			throw new IllegalArgumentException( "Class is null" );
+		}
+		return new GetClassLoader( clazz );
+	}
+
+	private GetClassLoader(Class<?> clazz) {
+		this.clazz = clazz;
+	}
+
+	public ClassLoader run() {
+		if ( clazz != null ) {
+			return clazz.getClassLoader();
+		}
+		else {
+			return Thread.currentThread().getContextClassLoader();
+		}
+	}
+}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/GetConstructor.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/GetConstructor.java
new file mode 100644
index 0000000..c3bf834
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/GetConstructor.java
@@ -0,0 +1,47 @@
+// $Id: GetConstructor.java 19566 2010-05-20 11:58:01Z hardy.ferentschik $
+/*
+* 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.util.privilegedactions;
+
+import java.lang.reflect.Constructor;
+import java.security.PrivilegedAction;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class GetConstructor<T> implements PrivilegedAction<Constructor<T>> {
+	private final Class<T> clazz;
+	private final Class<?>[] params;
+
+	public static <T> GetConstructor<T> action(Class<T> clazz, Class<?>... params) {
+		return new GetConstructor<T>( clazz, params );
+	}
+
+	private GetConstructor(Class<T> clazz, Class<?>... params) {
+		this.clazz = clazz;
+		this.params = params;
+	}
+
+	public Constructor<T> run() {
+		try {
+			return clazz.getConstructor(params);
+		}
+		catch ( NoSuchMethodException e ) {
+			return null;
+		}
+	}
+}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/GetDeclaredField.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/GetDeclaredField.java
new file mode 100644
index 0000000..43c55ef
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/GetDeclaredField.java
@@ -0,0 +1,49 @@
+// $Id: GetDeclaredField.java 19588 2010-05-22 12:31:15Z hardy.ferentschik $
+/*
+* 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.util.privilegedactions;
+
+import java.lang.reflect.Field;
+import java.security.PrivilegedAction;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class GetDeclaredField implements PrivilegedAction<Field> {
+	private final Class<?> clazz;
+	private final String fieldName;
+
+	public static GetDeclaredField action(Class<?> clazz, String fieldName) {
+		return new GetDeclaredField( clazz, fieldName );
+	}
+
+	private GetDeclaredField(Class<?> clazz, String fieldName) {
+		this.clazz = clazz;
+		this.fieldName = fieldName;
+	}
+
+	public Field run() {
+		try {
+			final Field field = clazz.getDeclaredField( fieldName );
+			field.setAccessible( true );
+			return field;
+		}
+		catch ( NoSuchFieldException e ) {
+			return null;
+		}
+	}
+}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/GetDeclaredFields.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/GetDeclaredFields.java
new file mode 100644
index 0000000..97c4df0
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/GetDeclaredFields.java
@@ -0,0 +1,40 @@
+// $Id: GetDeclaredFields.java 19566 2010-05-20 11:58:01Z hardy.ferentschik $
+/*
+* 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.util.privilegedactions;
+
+import java.security.PrivilegedAction;
+import java.lang.reflect.Field;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class GetDeclaredFields implements PrivilegedAction<Field[]> {
+	private final Class<?> clazz;
+
+	public static GetDeclaredFields action(Class<?> clazz) {
+		return new GetDeclaredFields( clazz );
+	}
+
+	private GetDeclaredFields(Class<?> clazz) {
+		this.clazz = clazz;
+	}
+
+	public Field[] run() {
+		return clazz.getDeclaredFields();
+	}
+}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/GetDeclaredMethods.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/GetDeclaredMethods.java
new file mode 100644
index 0000000..82e2fd6
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/GetDeclaredMethods.java
@@ -0,0 +1,40 @@
+// $Id: GetDeclaredMethods.java 19566 2010-05-20 11:58:01Z hardy.ferentschik $
+/*
+* 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.util.privilegedactions;
+
+import java.security.PrivilegedAction;
+import java.lang.reflect.Method;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class GetDeclaredMethods implements PrivilegedAction<Method[]> {
+	private final Class<?> clazz;
+
+	public static GetDeclaredMethods action(Class<?> clazz) {
+		return new GetDeclaredMethods( clazz );
+	}
+
+	private GetDeclaredMethods(Class<?> clazz) {
+		this.clazz = clazz;
+	}
+
+	public Method[] run() {
+		return clazz.getDeclaredMethods();
+	}
+}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/GetMethod.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/GetMethod.java
new file mode 100644
index 0000000..0f524fa
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/GetMethod.java
@@ -0,0 +1,47 @@
+// $Id: GetMethod.java 19566 2010-05-20 11:58:01Z hardy.ferentschik $
+/*
+* 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.util.privilegedactions;
+
+import java.lang.reflect.Method;
+import java.security.PrivilegedAction;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class GetMethod implements PrivilegedAction<Method> {
+	private final Class<?> clazz;
+	private final String methodName;
+
+	public static GetMethod action(Class<?> clazz, String methodName) {
+		return new GetMethod( clazz, methodName );
+	}
+
+	private GetMethod(Class<?> clazz, String methodName) {
+		this.clazz = clazz;
+		this.methodName = methodName;
+	}
+
+	public Method run() {
+		try {
+			return clazz.getMethod(methodName);
+		}
+		catch ( NoSuchMethodException e ) {
+			return null;
+		}
+	}
+}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/GetMethodFromPropertyName.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/GetMethodFromPropertyName.java
new file mode 100644
index 0000000..49de826
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/GetMethodFromPropertyName.java
@@ -0,0 +1,56 @@
+// $Id: GetMethodFromPropertyName.java 19573 2010-05-20 22:13:26Z hardy.ferentschik $
+/*
+* 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.util.privilegedactions;
+
+import java.lang.reflect.Method;
+import java.security.PrivilegedAction;
+
+/**
+ * @author Emmanuel Bernard
+ * @author Hardy Ferentschik
+ */
+public class GetMethodFromPropertyName implements PrivilegedAction<Method> {
+	private final Class<?> clazz;
+	private final String property;
+
+	public static GetMethodFromPropertyName action(Class<?> clazz, String property) {
+		return new GetMethodFromPropertyName( clazz, property );
+	}
+
+	private GetMethodFromPropertyName(Class<?> clazz, String property) {
+		this.clazz = clazz;
+		this.property = property;
+	}
+
+	public Method run() {
+		try {
+			char string[] = property.toCharArray();
+			string[0] = Character.toUpperCase( string[0] );
+			String fullMethodName = new String( string );
+			try {
+				return clazz.getMethod( "get" + fullMethodName );
+			}
+			catch ( NoSuchMethodException e ) {
+				return clazz.getMethod( "is" + fullMethodName );
+			}
+		}
+		catch ( NoSuchMethodException e ) {
+			return null;
+		}
+	}
+}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/GetMethods.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/GetMethods.java
new file mode 100644
index 0000000..57fb31b
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/GetMethods.java
@@ -0,0 +1,40 @@
+// $Id: GetMethods.java 19566 2010-05-20 11:58:01Z hardy.ferentschik $
+/*
+* 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.util.privilegedactions;
+
+import java.security.PrivilegedAction;
+import java.lang.reflect.Method;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class GetMethods implements PrivilegedAction<Method[]> {
+	private final Class<?> clazz;
+
+	public static GetMethods action(Class<?> clazz) {
+		return new GetMethods( clazz );
+	}
+
+	private GetMethods(Class<?> clazz) {
+		this.clazz = clazz;
+	}
+
+	public Method[] run() {
+		return clazz.getMethods();
+	}
+}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/LoadClass.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/LoadClass.java
new file mode 100644
index 0000000..641b4af
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/LoadClass.java
@@ -0,0 +1,59 @@
+// $Id: LoadClass.java 19606 2010-05-25 18:21:27Z hardy.ferentschik $
+/*
+* 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.util.privilegedactions;
+
+import java.security.PrivilegedAction;
+import javax.validation.ValidationException;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class LoadClass implements PrivilegedAction<Class<?>> {
+	private final String className;
+	private final Class<?> caller;
+
+	public static LoadClass action(String className, Class<?> caller) {
+		return new LoadClass( className, caller );
+	}
+
+	private LoadClass(String className, Class<?> caller) {
+		this.className = className;
+		this.caller = caller;
+	}
+
+	public Class<?> run() {
+		try {
+			ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+			if ( contextClassLoader != null ) {
+				return contextClassLoader.loadClass( className );
+			}
+		}
+		catch ( ClassNotFoundException e ) {
+			// ignore - try using the classloader of the caller first
+		}
+		catch ( RuntimeException e ) {
+			// ignore
+		}
+		try {
+			return Class.forName( className, true, caller.getClassLoader() );
+		}
+		catch ( ClassNotFoundException e ) {
+			throw new ValidationException( "Unable to load class: " + className, e );
+		}
+	}
+}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/NewInstance.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/NewInstance.java
new file mode 100644
index 0000000..5550943
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/NewInstance.java
@@ -0,0 +1,56 @@
+// $Id: NewInstance.java 19573 2010-05-20 22:13:26Z hardy.ferentschik $
+/*
+* 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.util.privilegedactions;
+
+import java.security.PrivilegedAction;
+import javax.validation.ValidationException;
+
+/**
+ * Execute instance creation as privileged action.
+ *
+ * @author Emmanuel Bernard
+ * @author Hardy Ferentschik
+ */
+public class NewInstance<T> implements PrivilegedAction<T> {
+	private final Class<T> clazz;
+	private final String message;
+
+	public static <T> NewInstance<T> action(Class<T> clazz, String message) {
+		return new NewInstance<T>( clazz, message );
+	}
+
+	private NewInstance(Class<T> clazz, String message) {
+		this.clazz = clazz;
+		this.message = message;
+	}
+
+	public T run() {
+		try {
+			return clazz.newInstance();
+		}
+		catch ( InstantiationException e ) {
+			throw new ValidationException( "Unable to instantiate " + message + ": " + clazz, e );
+		}
+		catch ( IllegalAccessException e ) {
+			throw new ValidationException( "Unable to instantiate " + clazz, e );
+		}
+		catch ( RuntimeException e ) {
+			throw new ValidationException( "Unable to instantiate " + clazz, e );
+		}
+	}
+}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/SetAccessibility.java b/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/SetAccessibility.java
new file mode 100644
index 0000000..51cffd0
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/SetAccessibility.java
@@ -0,0 +1,43 @@
+// $Id: SetAccessibility.java 19573 2010-05-20 22:13:26Z hardy.ferentschik $
+/*
+* 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.util.privilegedactions;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Member;
+import java.security.PrivilegedAction;
+
+/**
+ * @author Emmanuel Bernard
+ * @author Hardy Ferentschik
+ */
+public class SetAccessibility implements PrivilegedAction<Object> {
+	private final Member member;
+
+	public static SetAccessibility action(Member member) {
+		return new SetAccessibility( member );
+	}
+
+	private SetAccessibility(Member member) {
+		this.member = member;
+	}
+
+	public Object run() {
+		( ( AccessibleObject ) member ).setAccessible( true );
+		return member;
+	}
+}
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/package.html b/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/package.html
new file mode 100644
index 0000000..a666b0b
--- /dev/null
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/util/privilegedactions/package.html
@@ -0,0 +1,26 @@
+<!--
+  ~ $Id: package.html 19596 2010-05-24 10:31:09Z hardy.ferentschik $
+  ~
+  ~ 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.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+<head>
+</head>
+<body>
+Implementations of PrivilegedAction in order to execute reflection operations in a security manager.
+</body>
+</html>
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/xml/ValidationXmlParser.java b/hibernate-validator/src/main/java/org/hibernate/validator/xml/ValidationXmlParser.java
index 56b6e5d..b30bc7f 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/xml/ValidationXmlParser.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/xml/ValidationXmlParser.java
@@ -1,4 +1,4 @@
-// $Id: ValidationXmlParser.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: ValidationXmlParser.java 19573 2010-05-20 22:13:26Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -17,9 +17,9 @@
 */
 package org.hibernate.validator.xml;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
-import java.security.AccessController;
 import javax.validation.ConstraintValidatorFactory;
 import javax.validation.MessageInterpolator;
 import javax.validation.TraversableResolver;
@@ -36,10 +36,8 @@ import javax.xml.validation.SchemaFactory;
 import org.slf4j.Logger;
 import org.xml.sax.SAXException;
 
-import org.hibernate.validator.util.GetClassLoader;
-import org.hibernate.validator.util.LoadClass;
 import org.hibernate.validator.util.LoggerFactory;
-import org.hibernate.validator.util.NewInstance;
+import org.hibernate.validator.util.ReflectionHelper;
 
 /**
  * Parser for <i>validation.xml</i> using JAXB.
@@ -78,18 +76,12 @@ public class ValidationXmlParser {
 		if ( constraintFactoryClass != null ) {
 			try {
 				@SuppressWarnings("unchecked")
-				Class<ConstraintValidatorFactory> clazz = ( Class<ConstraintValidatorFactory> ) loadClass(
+				Class<ConstraintValidatorFactory> clazz = ( Class<ConstraintValidatorFactory> ) ReflectionHelper.loadClass(
 						constraintFactoryClass, this.getClass()
 				);
-				NewInstance<ConstraintValidatorFactory> newInstance = NewInstance.action(
+				xmlParameters.constraintValidatorFactory = ReflectionHelper.newInstance(
 						clazz, "constraint factory class"
 				);
-				if ( System.getSecurityManager() != null ) {
-					xmlParameters.constraintValidatorFactory = AccessController.doPrivileged( newInstance );
-				}
-				else {
-					xmlParameters.constraintValidatorFactory = newInstance.run();
-				}
 				log.info( "Using {} as constraint factory.", constraintFactoryClass );
 			}
 			catch ( ValidationException e ) {
@@ -100,16 +92,6 @@ public class ValidationXmlParser {
 		}
 	}
 
-	private Class<?> loadClass(String className, Class<?> caller) {
-		LoadClass action = LoadClass.action( className, caller );
-		if ( System.getSecurityManager() != null ) {
-			return AccessController.doPrivileged( action );
-		}
-		else {
-			return action.run();
-		}
-	}
-
 	private void setPropertiesFromXml(ValidationConfigType config, ValidationBootstrapParameters xmlParameters) {
 		for ( PropertyType property : config.getProperty() ) {
 			if ( log.isDebugEnabled() ) {
@@ -124,15 +106,15 @@ public class ValidationXmlParser {
 	}
 
 	private void setMappingStreamsFromXml(ValidationConfigType config, ValidationBootstrapParameters xmlParameters) {
-		for ( JAXBElement<String> mappingFileName : config.getConstraintMapping() ) {
+		for ( String mappingFileName : config.getConstraintMapping() ) {
 			if ( log.isDebugEnabled() ) {
 				log.debug(
-						"Trying to open input stream for {}.", mappingFileName.getValue()
+						"Trying to open input stream for {}.", mappingFileName
 				);
 			}
-			InputStream in = getInputStreamForPath( mappingFileName.getValue() );
+			InputStream in = getInputStreamForPath( mappingFileName );
 			if ( in == null ) {
-				throw new ValidationException( "Unable to open input stream for mapping file " + mappingFileName.getValue() + "." );
+				throw new ValidationException( "Unable to open input stream for mapping file " + mappingFileName + "." );
 			}
 			xmlParameters.mappings.add( in );
 		}
@@ -143,7 +125,7 @@ public class ValidationXmlParser {
 		if ( messageInterpolatorClass != null ) {
 			try {
 				@SuppressWarnings("unchecked")
-				Class<MessageInterpolator> clazz = ( Class<MessageInterpolator> ) loadClass(
+				Class<MessageInterpolator> clazz = ( Class<MessageInterpolator> ) ReflectionHelper.loadClass(
 						messageInterpolatorClass, this.getClass()
 				);
 				xmlParameters.messageInterpolator = clazz.newInstance();
@@ -172,7 +154,7 @@ public class ValidationXmlParser {
 		if ( traversableResolverClass != null ) {
 			try {
 				@SuppressWarnings("unchecked")
-				Class<TraversableResolver> clazz = ( Class<TraversableResolver> ) loadClass(
+				Class<TraversableResolver> clazz = ( Class<TraversableResolver> ) ReflectionHelper.loadClass(
 						traversableResolverClass, this.getClass()
 				);
 				xmlParameters.traversableResolver = clazz.newInstance();
@@ -201,7 +183,7 @@ public class ValidationXmlParser {
 		String providerClassName = config.getDefaultProvider();
 		if ( providerClassName != null ) {
 			try {
-				xmlParamters.providerClass = ( Class<? extends ValidationProvider<?>> ) loadClass(
+				xmlParamters.providerClass = ( Class<? extends ValidationProvider<?>> ) ReflectionHelper.loadClass(
 						providerClassName, this.getClass()
 				);
 				log.info( "Using {} as validation provider.", providerClassName );
@@ -235,6 +217,14 @@ public class ValidationXmlParser {
 			log.error( "Error parsing validation.xml: {}", e.getMessage() );
 			throw new ValidationException( "Unable to parse " + VALIDATION_XML_FILE );
 		}
+		finally {
+			try {
+				inputStream.close();
+			}
+			catch ( IOException io ) {
+				log.warn( "Unable to close input stream for " + VALIDATION_XML_FILE );
+			}
+		}
 		return validationConfig;
 	}
 
@@ -245,34 +235,27 @@ public class ValidationXmlParser {
 			path = path.substring( 1 );
 		}
 
-
-		boolean isSecured = System.getSecurityManager() != null;
 		boolean isContextCL = true;
 		// try the context class loader first
-		GetClassLoader action = GetClassLoader.fromContext();
-		ClassLoader loader = isSecured ? AccessController.doPrivileged( action ) : action.run();
+		ClassLoader loader = ReflectionHelper.getClassLoaderFromContext();
 
 		if ( loader == null ) {
 			log.debug( "No default context class loader, fall back to Bean Validation's loader" );
-			action = GetClassLoader.fromClass( ValidationXmlParser.class );
-			loader = isSecured ? AccessController.doPrivileged( action ) : action.run();
+			loader = ReflectionHelper.getClassLoaderFromClass( ValidationXmlParser.class );
 			isContextCL = false;
 		}
 		InputStream inputStream = loader.getResourceAsStream( path );
 
 		// try the current class loader
 		if ( isContextCL && inputStream == null ) {
-			action = GetClassLoader.fromClass( ValidationXmlParser.class );
-			loader = isSecured ? AccessController.doPrivileged( action ) : action.run();
+			loader = ReflectionHelper.getClassLoaderFromClass( ValidationXmlParser.class );
 			inputStream = loader.getResourceAsStream( path );
 		}
 		return inputStream;
 	}
 
 	private Schema getValidationConfigurationSchema() {
-		boolean isSecured = System.getSecurityManager() != null;
-		GetClassLoader action = GetClassLoader.fromClass( ValidationXmlParser.class );
-		ClassLoader loader = isSecured ? AccessController.doPrivileged( action ) : action.run();
+		ClassLoader loader = ReflectionHelper.getClassLoaderFromClass( ValidationXmlParser.class );
 		URL schemaUrl = loader.getResource( VALIDATION_CONFIGURATION_XSD );
 		SchemaFactory sf = SchemaFactory.newInstance( javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI );
 		Schema schema = null;
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/xml/XmlMappingParser.java b/hibernate-validator/src/main/java/org/hibernate/validator/xml/XmlMappingParser.java
index 727da01..4dde37e 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/xml/XmlMappingParser.java
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/xml/XmlMappingParser.java
@@ -1,4 +1,4 @@
-// $Id: XmlMappingParser.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
+// $Id: XmlMappingParser.java 19573 2010-05-20 22:13:26Z hardy.ferentschik $
 /*
 * JBoss, Home of Professional Open Source
 * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -25,7 +25,6 @@ import java.lang.reflect.Field;
 import java.lang.reflect.Member;
 import java.lang.reflect.Method;
 import java.net.URL;
-import java.security.AccessController;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -54,14 +53,8 @@ import org.hibernate.validator.metadata.ConstraintDescriptorImpl;
 import org.hibernate.validator.metadata.ConstraintHelper;
 import org.hibernate.validator.metadata.ConstraintOrigin;
 import org.hibernate.validator.metadata.MetaConstraint;
-import org.hibernate.validator.util.ContainsField;
-import org.hibernate.validator.util.ContainsMethod;
-import org.hibernate.validator.util.GetClassLoader;
-import org.hibernate.validator.util.GetDeclaredField;
-import org.hibernate.validator.util.GetMethod;
-import org.hibernate.validator.util.GetMethodFromPropertyName;
-import org.hibernate.validator.util.LoadClass;
 import org.hibernate.validator.util.LoggerFactory;
+import org.hibernate.validator.util.ReflectionHelper;
 import org.hibernate.validator.util.annotationfactory.AnnotationDescriptor;
 import org.hibernate.validator.util.annotationfactory.AnnotationFactory;
 
@@ -111,7 +104,7 @@ public class XmlMappingParser {
 		}
 	}
 
-	public Set<Class<?>> getProcessedClasses() {
+	public Set<Class<?>> getXmlConfiguredClasses() {
 		return processedClasses;
 	}
 
@@ -168,10 +161,10 @@ public class XmlMappingParser {
 			if ( validatedByType.isIncludeExistingValidators() != null && validatedByType.isIncludeExistingValidators() ) {
 				constraintValidatorClasses.addAll( findConstraintValidatorClasses( annotationClass ) );
 			}
-			for ( JAXBElement<String> validatorClassName : validatedByType.getValue() ) {
+			for ( String validatorClassName : validatedByType.getValue() ) {
 				Class<? extends ConstraintValidator<?, ?>> validatorClass;
-				validatorClass = ( Class<? extends ConstraintValidator<?, ?>> ) loadClass(
-						validatorClassName.getValue(),
+				validatorClass = ( Class<? extends ConstraintValidator<?, ?>> ) ReflectionHelper.loadClass(
+						validatorClassName,
 						this.getClass()
 				);
 
@@ -188,16 +181,6 @@ public class XmlMappingParser {
 		}
 	}
 
-	private Class<?> loadClass(String className, Class<?> caller) {
-		LoadClass action = LoadClass.action( className, caller );
-		if ( System.getSecurityManager() != null ) {
-			return AccessController.doPrivileged( action );
-		}
-		else {
-			return action.run();
-		}
-	}
-
 	private List<Class<? extends ConstraintValidator<? extends Annotation, ?>>> findConstraintValidatorClasses(Class<? extends Annotation> annotationType) {
 		List<Class<? extends ConstraintValidator<? extends Annotation, ?>>> constraintValidatorDefinitionClasses = new ArrayList<Class<? extends ConstraintValidator<? extends Annotation, ?>>>();
 		if ( constraintHelper.isBuiltinConstraint( annotationType ) ) {
@@ -228,25 +211,11 @@ public class XmlMappingParser {
 			else {
 				fieldNames.add( fieldName );
 			}
-			final boolean containsField;
-			ContainsField containsAction = ContainsField.action( beanClass, fieldName );
-			if ( System.getSecurityManager() != null ) {
-				containsField = AccessController.doPrivileged( containsAction );
-			}
-			else {
-				containsField = containsAction.run();
-			}
+			final boolean containsField = ReflectionHelper.containsField( beanClass, fieldName );
 			if ( !containsField ) {
 				throw new ValidationException( beanClass.getName() + " does not contain the fieldType  " + fieldName );
 			}
-			GetDeclaredField action = GetDeclaredField.action( beanClass, fieldName );
-			final Field field;
-			if ( System.getSecurityManager() != null ) {
-				field = AccessController.doPrivileged( action );
-			}
-			else {
-				field = action.run();
-			}
+			final Field field = ReflectionHelper.getField( beanClass, fieldName );
 
 			// ignore annotations
 			boolean ignoreFieldAnnotation = fieldType.isIgnoreAnnotations() == null ? false : fieldType.isIgnoreAnnotations();
@@ -279,25 +248,11 @@ public class XmlMappingParser {
 			else {
 				getterNames.add( getterName );
 			}
-			ContainsMethod cmAction = ContainsMethod.action( beanClass, getterName );
-			boolean containsMethod;
-			if ( System.getSecurityManager() != null ) {
-				containsMethod = AccessController.doPrivileged( cmAction );
-			}
-			else {
-				containsMethod = cmAction.run();
-			}
+			boolean containsMethod = ReflectionHelper.containsMethod( beanClass, getterName );
 			if ( !containsMethod ) {
 				throw new ValidationException( beanClass.getName() + " does not contain the property  " + getterName );
 			}
-			final Method method;
-			GetMethodFromPropertyName action = GetMethodFromPropertyName.action( beanClass, getterName );
-			if ( System.getSecurityManager() != null ) {
-				method = AccessController.doPrivileged( action );
-			}
-			else {
-				method = action.run();
-			}
+			final Method method = ReflectionHelper.getMethodFromPropertyName( beanClass, getterName );
 
 			// ignore annotations
 			boolean ignoreGetterAnnotation = getterType.isIgnoreAnnotations() == null ? false : getterType.isIgnoreAnnotations();
@@ -368,8 +323,8 @@ public class XmlMappingParser {
 	private List<Class<?>> createGroupSequence(GroupSequenceType groupSequenceType, String defaultPackage) {
 		List<Class<?>> groupSequence = new ArrayList<Class<?>>();
 		if ( groupSequenceType != null ) {
-			for ( JAXBElement<String> groupName : groupSequenceType.getValue() ) {
-				Class<?> group = getClass( groupName.getValue(), defaultPackage );
+			for ( String groupName : groupSequenceType.getValue() ) {
+				Class<?> group = getClass( groupName, defaultPackage );
 				groupSequence.add( group );
 			}
 		}
@@ -423,15 +378,7 @@ public class XmlMappingParser {
 	}
 
 	private <A extends Annotation> Class<?> getAnnotationParameterType(Class<A> annotationClass, String name) {
-		Method m;
-		GetMethod action = GetMethod.action( annotationClass, name );
-		if ( System.getSecurityManager() != null ) {
-			m = AccessController.doPrivileged( action );
-		}
-		else {
-			m = action.run();
-		}
-
+		Method m = ReflectionHelper.getMethod( annotationClass, name );
 		if ( m == null ) {
 			throw new ValidationException( "Annotation of type " + annotationClass.getName() + " does not contain a parameter " + name + "." );
 		}
@@ -574,7 +521,7 @@ public class XmlMappingParser {
 			returnValue = value;
 		}
 		else if ( returnType.getName().equals( Class.class.getName() ) ) {
-			returnValue = loadClass( value, this.getClass() );
+			returnValue = ReflectionHelper.loadClass( value, this.getClass() );
 		}
 		else {
 			try {
@@ -601,8 +548,8 @@ public class XmlMappingParser {
 		}
 
 		List<Class<?>> groupList = new ArrayList<Class<?>>();
-		for ( JAXBElement<String> groupClass : groupsType.getValue() ) {
-			groupList.add( getClass( groupClass.getValue(), defaultPackage ) );
+		for ( String groupClass : groupsType.getValue() ) {
+			groupList.add( getClass( groupClass, defaultPackage ) );
 		}
 		return groupList.toArray( new Class[groupList.size()] );
 	}
@@ -614,8 +561,8 @@ public class XmlMappingParser {
 		}
 
 		List<Class<? extends Payload>> payloadList = new ArrayList<Class<? extends Payload>>();
-		for ( JAXBElement<String> groupClass : payloadType.getValue() ) {
-			Class<?> payload = getClass( groupClass.getValue(), defaultPackage );
+		for ( String groupClass : payloadType.getValue() ) {
+			Class<?> payload = getClass( groupClass, defaultPackage );
 			if ( !Payload.class.isAssignableFrom( payload ) ) {
 				throw new ValidationException( "Specified payload class " + payload.getName() + " does not implement javax.validation.Payload" );
 			}
@@ -634,7 +581,7 @@ public class XmlMappingParser {
 		else {
 			fullyQualifiedClass = defaultPackage + PACKAGE_SEPARATOR + clazz;
 		}
-		return loadClass( fullyQualifiedClass, this.getClass() );
+		return ReflectionHelper.loadClass( fullyQualifiedClass, this.getClass() );
 	}
 
 	private boolean isQualifiedClass(String clazz) {
@@ -661,9 +608,7 @@ public class XmlMappingParser {
 	}
 
 	private Schema getMappingSchema() {
-		boolean isSecured = System.getSecurityManager() != null;
-		GetClassLoader action = GetClassLoader.fromClass( XmlMappingParser.class );
-		ClassLoader loader = isSecured ? AccessController.doPrivileged( action ) : action.run();
+		ClassLoader loader = ReflectionHelper.getClassLoaderFromClass( XmlMappingParser.class );
 		URL schemaUrl = loader.getResource( VALIDATION_MAPPING_XSD );
 		SchemaFactory sf = SchemaFactory.newInstance( javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI );
 		Schema schema = null;
diff --git a/hibernate-validator/src/main/java/org/hibernate/validator/xml/package.html b/hibernate-validator/src/main/java/org/hibernate/validator/xml/package.html
index b49759d..cd87dd9 100644
--- a/hibernate-validator/src/main/java/org/hibernate/validator/xml/package.html
+++ b/hibernate-validator/src/main/java/org/hibernate/validator/xml/package.html
@@ -1,24 +1,24 @@
+<!--
+  ~ $Id: package.html 19596 2010-05-24 10:31:09Z hardy.ferentschik $
+  ~
+  ~ 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.
+-->
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html>
 <head>
-<!--
-
-  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.
-
--->
 </head>
 <body>
 Classes used to parse Bean Validation XML configuration files.
diff --git a/hibernate-validator/src/main/javadoc/resources/bkg_blkheader.png b/hibernate-validator/src/main/javadoc/resources/bkg_blkheader.png
new file mode 100644
index 0000000..499e912
Binary files /dev/null and b/hibernate-validator/src/main/javadoc/resources/bkg_blkheader.png differ
diff --git a/hibernate-validator/src/main/javadoc/resources/bkg_gradient.gif b/hibernate-validator/src/main/javadoc/resources/bkg_gradient.gif
new file mode 100644
index 0000000..dca02ca
Binary files /dev/null and b/hibernate-validator/src/main/javadoc/resources/bkg_gradient.gif differ
diff --git a/hibernate-validator/src/main/javadoc/resources/bkgheader.png b/hibernate-validator/src/main/javadoc/resources/bkgheader.png
new file mode 100644
index 0000000..ec13b78
Binary files /dev/null and b/hibernate-validator/src/main/javadoc/resources/bkgheader.png differ
diff --git a/hibernate-validator/src/main/javadoc/resources/h1_hdr.png b/hibernate-validator/src/main/javadoc/resources/h1_hdr.png
new file mode 100644
index 0000000..31caf5e
Binary files /dev/null and b/hibernate-validator/src/main/javadoc/resources/h1_hdr.png differ
diff --git a/hibernate-validator/src/main/javadoc/stylesheet.css b/hibernate-validator/src/main/javadoc/stylesheet.css
new file mode 100644
index 0000000..60039c6
--- /dev/null
+++ b/hibernate-validator/src/main/javadoc/stylesheet.css
@@ -0,0 +1,174 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+
+/*
+ * Custom Hibernate javadoc style sheet
+ */
+
+/* Page background color */
+body {
+    background: #FFFFFF url(resources/bkg_gradient.gif) repeat-x;
+    margin:0 auto;
+	font-family:'Lucida Grande', Geneva, Verdana, Arial, sans-serif;
+	font-size:12px;
+	padding:0 2em;
+	color:#333;
+
+ }
+
+/* Common elements */
+
+font {
+	font-family: inherit, sans-serif;
+	font-size: inherit;
+	color: inherit;
+	font-weight: inherit;
+}
+
+hr {
+    border-style: none;
+    border-bottom: 1px solid #CCCCCC;
+}
+
+/* Links */
+a:link {
+    color:#003399;
+}
+a:visited {
+    color:#888888;
+}
+a:hover {
+    color:#6699cc;
+}
+a:active {
+    color: #003399;
+}
+
+/* Headings */
+h1 {
+    background: url(resources/h1_hdr.png) no-repeat;
+    line-height:1.2em;
+	color:#586464;
+	font-size:2em;
+	padding:1.5em;
+	margin-top: 0;
+	text-align:left;
+}
+
+h2 {
+	color:#586464;
+}
+
+
+/* Default Table elements and colors */
+
+th, table {
+	border-collapse:collapse;
+	border-color: #E6E7E8;
+}
+
+
+.TableHeadingColor     {
+	background:#000000 url(resources/bkg_blkheader.png) repeat-x scroll left top;
+	color:#FFFFFF;
+	font-size:12px;
+	font-weight:bold;
+	height:31px;
+	text-align:left;
+	padding:1.5em;
+}
+
+.TableHeadingColor th {
+	padding-left: 10px;
+}
+
+
+.TableSubHeadingColor  {
+    background: #ebe7d7;
+}
+.TableRowColor {
+    background: #FFFFFF;
+    border-color: #E6E7E8;
+}
+.TableRowColor td {
+    line-height: 175%;
+    padding-left: 10px;
+}
+
+/* Font used in left-hand frame lists */
+.FrameTitleFont   {
+    font-size: 125%;
+    font-family: Helvetica, Arial, sans-serif;
+    font-weight: bold;
+    margin-top: 1em;
+    display: block;
+}
+.FrameHeadingFont {
+    font-size: 125%;
+    font-family: 'Lucida Grande', Geneva, Verdana, Arial, sans-serif;
+    font-weight: bold;
+    margin-top: 1em;
+    display: block;
+    color:#586464;
+	border-bottom:1px dotted #CCCCCC;
+}
+.FrameItemFont {
+    font-size: 100%;
+    font-family: Helvetica, Arial, sans-serif
+}
+
+/* Navigation bar fonts and colors */
+
+.NavBarCell1    {
+    background: #ffffff url(resources/bkgheader.png) repeat-x;
+    line-height:3em;
+	padding-left:10px;
+	padding-right:10px;
+}
+
+.NavBarFont1 {
+	color: white;
+}
+.NavBarCell1 a {
+	color: white;
+}
+
+.NavBarCell1Rev {
+    background-color:#FFFFFF;
+    padding-left:6px;
+    padding-right:6px;
+}
+.NavBarFont1 {
+    color:#FFFFFF;
+}
+.NavBarFont1Rev {
+    color:#243446;
+}
+
+.NavBarCell2 {
+    background-color:#FFFFFF;
+}
+.NavBarCell3 {
+    background-color:#FFFFFF;
+}
diff --git a/hibernate-validator/src/main/resources/org/hibernate/validator/ValidationMessages.properties b/hibernate-validator/src/main/resources/org/hibernate/validator/ValidationMessages.properties
index f377969..0e92c8f 100644
--- a/hibernate-validator/src/main/resources/org/hibernate/validator/ValidationMessages.properties
+++ b/hibernate-validator/src/main/resources/org/hibernate/validator/ValidationMessages.properties
@@ -1,4 +1,5 @@
-# $Id: ValidationMessages.properties 17927 2009-11-05 09:51:52Z hardy.ferentschik $
+
+# $Id: ValidationMessages.properties 19251 2010-04-20 15:28:18Z hardy.ferentschik $
 javax.validation.constraints.AssertFalse.message=must be false
 javax.validation.constraints.AssertTrue.message=must be true
 javax.validation.constraints.DecimalMax.message=must be less than or equal to {value}
@@ -14,6 +15,9 @@ javax.validation.constraints.Pattern.message=must match "{regexp}"
 javax.validation.constraints.Size.message=size must be between {min} and {max}
 org.hibernate.validator.constraints.Email.message=not a well-formed email address
 org.hibernate.validator.constraints.Length.message=length must be between {min} and {max}
+org.hibernate.validator.constraints.NotBlank.message=may not be empty
 org.hibernate.validator.constraints.NotEmpty.message=may not be empty
 org.hibernate.validator.constraints.Range.message=must be between {min} and {max}
-
+org.hibernate.validator.constraints.URL.message=must be a valid URL
+org.hibernate.validator.constraints.CreditCardNumber.message=invalid credit card number
+org.hibernate.validator.constraints.ScriptAssert.message=script expression "{script}" didn't evaluate to true
diff --git a/hibernate-validator/src/main/resources/org/hibernate/validator/ValidationMessages_de.properties b/hibernate-validator/src/main/resources/org/hibernate/validator/ValidationMessages_de.properties
index 5244c6c..194b15d 100644
--- a/hibernate-validator/src/main/resources/org/hibernate/validator/ValidationMessages_de.properties
+++ b/hibernate-validator/src/main/resources/org/hibernate/validator/ValidationMessages_de.properties
@@ -1,8 +1,6 @@
-# $Id: ValidationMessages_de.properties 17927 2009-11-05 09:51:52Z hardy.ferentschik $
+# $Id: ValidationMessages_de.properties 19251 2010-04-20 15:28:18Z hardy.ferentschik $
 javax.validation.constraints.NotNull.message=kann nicht null sein
 javax.validation.constraints.Size.message=muss zwischen {min} und {max} liegen
-org.hibernate.validator.constraints.Length.message=muss zwischen {min} und {max} liegen
-org.hibernate.validator.constraints.NotEmpty.message=kann nicht leer sein
 javax.validation.constraints.Pattern.message=muss auf Ausdruck "{regexp}" passen
 javax.validation.constraints.Min.message=muss gr\u00F6ssergleich {value} sein
 javax.validation.constraints.Max.message=muss kleinergleich {value} sein
@@ -11,8 +9,14 @@ javax.validation.constraints.Past.message=muss in der Vergangenheit liegen
 javax.validation.constraints.Future.message=muss in der Zukunft liegen
 javax.validation.constraints.AssertTrue.message=muss wahr sein
 javax.validation.constraints.AssertFalse.message=muss falsch sein
-javax.validation.constraints.Digits.message=numerischer Wert au\u00DFerhalb erlaubten Wertebereichs (<{integer} Ziffern>.<{fraction} Ziffern> erwarted)
+javax.validation.constraints.Digits.message=numerischer Wert au\u00DFerhalb erlaubten Wertebereichs (<{integer} Ziffern>.<{fraction} Ziffern> erwartet)
 javax.validation.constraints.DecimalMin.message=muss gr\u00F6ssergleich {value} sein
 javax.validation.constraints.DecimalMax.message=muss kleinergleich {value} sein
 org.hibernate.validator.constraints.Email.message=keine g\u00FCltige E-Mail-Adresse
-org.hibernate.validator.constraints.Range.message=muss zwischen {min} und {max} liegen
\ No newline at end of file
+org.hibernate.validator.constraints.Length.message=muss zwischen {min} und {max} liegen
+org.hibernate.validator.constraints.NotBlank.message=kann nicht leer sein
+org.hibernate.validator.constraints.NotEmpty.message=kann nicht leer sein
+org.hibernate.validator.constraints.Range.message=muss zwischen {min} und {max} liegen
+org.hibernate.validator.constraints.URL.message=muss eine g\u00FCltige URL sein
+org.hibernate.validator.constraints.CreditCardNumber.message=ung\u00FCltige Kreditkartennummer
+org.hibernate.validator.constraints.ScriptAssert.message=Skriptausdruck "{script}" muss true zur\u00FCckliefern
diff --git a/hibernate-validator/src/main/resources/org/hibernate/validator/ValidationMessages_en.properties b/hibernate-validator/src/main/resources/org/hibernate/validator/ValidationMessages_en.properties
new file mode 100644
index 0000000..cea61f0
--- /dev/null
+++ b/hibernate-validator/src/main/resources/org/hibernate/validator/ValidationMessages_en.properties
@@ -0,0 +1,9 @@
+# $Id: ValidationMessages_en.properties 19090 2010-03-23 15:22:59Z hardy.ferentschik $
+# This file is intentionally left empty. All calls to this bundle will
+# be delegated to the parent bundle ValidationMessages (which contains 
+# English messages).
+#
+# Not providing this bundle would cause the bundle for the default 
+# locale to take precedence over the base bundle. If the default locale 
+# is not English but one, for which a resource bundle exists (e.g. German),
+# the English texts would never be returned.
diff --git a/hibernate-validator/src/main/resources/org/hibernate/validator/ValidationMessages_fr.properties b/hibernate-validator/src/main/resources/org/hibernate/validator/ValidationMessages_fr.properties
index cc7bba0..44713b5 100644
--- a/hibernate-validator/src/main/resources/org/hibernate/validator/ValidationMessages_fr.properties
+++ b/hibernate-validator/src/main/resources/org/hibernate/validator/ValidationMessages_fr.properties
@@ -1,8 +1,6 @@
-# $Id: ValidationMessages_fr.properties 17927 2009-11-05 09:51:52Z hardy.ferentschik $
+# $Id: ValidationMessages_fr.properties 19252 2010-04-20 15:29:43Z hardy.ferentschik $
 javax.validation.constraints.NotNull.message=ne peut pas \u00EAtre nul
 javax.validation.constraints.Size.message=la taille doit \u00EAtre entre {min} et {max}
-org.hibernate.validator.constraints.Length.message=length must be between {min} and {max}
-org.hibernate.validator.constraints.NotEmpty.message=ne peut pas \u00EAtre vide
 javax.validation.constraints.Pattern.message=doit suivre "{regexp}"
 javax.validation.constraints.Min.message=doit \u00EAtre plus grand que {value}
 javax.validation.constraints.Max.message=doit \u00EAtre plus petit que {value}
@@ -14,5 +12,10 @@ javax.validation.constraints.AssertFalse.message=doit \u00EAtre faux
 javax.validation.constraints.Digits.message=Valeur num\u00E9rique hors limite (<{integer} chiffres>.<{fraction} chiffres> attendus)
 javax.validation.constraints.DecimalMin.message=doit \u00EAtre plus grand que {value}
 javax.validation.constraints.DecimalMax.message=doit \u00EAtre plus petit que {value}
-org.hibernate.validator.constraints.Email.message=Address email mal form\u00E9e
-org.hibernate.validator.constraints.Range.message=doit \u00EAtre entre {min} et {max}
\ No newline at end of file
+org.hibernate.validator.constraints.Email.message=Addresse email mal form\u00E9e
+org.hibernate.validator.constraints.Length.message=la taille doit \u00EAtre entre {min} et {max}
+org.hibernate.validator.constraints.NotBlank.message=ne peut pas \u00EAtre vide
+org.hibernate.validator.constraints.NotEmpty.message=ne peut pas \u00EAtre vide
+org.hibernate.validator.constraints.Range.message=doit \u00EAtre entre {min} et {max}
+org.hibernate.validator.constraints.URL.message=URL mal form\u00E9e
+org.hibernate.validator.constraints.CreditCardNumber.message=Num\u00E9ro de carte de cr\u00E9dit invalide
\ No newline at end of file
diff --git a/hibernate-validator/src/main/resources/org/hibernate/validator/ValidationMessages_mn_MN.properties b/hibernate-validator/src/main/resources/org/hibernate/validator/ValidationMessages_mn_MN.properties
new file mode 100644
index 0000000..e31521f
--- /dev/null
+++ b/hibernate-validator/src/main/resources/org/hibernate/validator/ValidationMessages_mn_MN.properties
@@ -0,0 +1,18 @@
+javax.validation.constraints.AssertFalse.message=\u0425\u0443\u0434\u0430\u043B \u0431\u0430\u0439\u0445 \u0451\u0441\u0442\u043E\u0439
+javax.validation.constraints.AssertTrue.message=\u04AE\u043D\u044D\u043D \u0431\u0430\u0439\u0445 \u0451\u0441\u0442\u043E\u0439
+javax.validation.constraints.DecimalMax.message={value}-\u0430\u0430\u0441 \u0431\u0430\u0433\u0430 \u0431\u0443\u044E\u0443 \u0442\u044D\u043D\u0446\u04AF\u04AF \u0431\u0430\u0439\u0445 \u0451\u0441\u0442\u043E\u0439
+javax.validation.constraints.DecimalMin.message={value}-\u0430\u0430\u0441 \u0438\u0445 \u0431\u0443\u044E\u0443 \u0442\u044D\u043D\u0446\u04AF\u04AF \u0431\u0430\u0439\u0445 \u0451\u0441\u0442\u043E\u0439
+javax.validation.constraints.Digits.message=\u0422\u043E\u043E\u043D \u0445\u044F\u0437\u0433\u0430\u0430\u0440\u0430\u0430\u0441 \u0445\u044D\u0442\u044D\u0440\u0441\u044D\u043D \u0431\u0430\u0439\u043D\u0430 (<{integerDigits} digits>.<{fractionalDigits} digits> \u0445\u043E\u043E\u0440\u043E\u043D\u0434 \u0431\u0430\u0439\u043D\u0430)
+javax.validation.constraints.Future.message=\u0418\u0440\u044D\u044D\u0434\u04AF\u0439\u0434 \u0431\u0430\u0439\u0445 \u0451\u0441\u0442\u043E\u0439
+javax.validation.constraints.Max.message={value}-\u0430\u0430\u0441 \u0431\u0430\u0433\u0430 \u0431\u0443\u044E\u0443 \u0442\u044D\u043D\u0446\u04AF\u04AF \u0431\u0430\u0439\u0445 \u0451\u0441\u0442\u043E\u0439
+javax.validation.constraints.Min.message={value}-\u0430\u0430\u0441 \u0438\u0445 \u0431\u0443\u044E\u0443 \u0442\u044D\u043D\u0446\u04AF\u04AF \u0431\u0430\u0439\u0445 \u0451\u0441\u0442\u043E\u0439
+javax.validation.constraints.NotNull.message=null \u0431\u0430\u0439\u0436 \u0431\u043E\u043B\u043E\u0445\u0433\u04AF\u0439
+javax.validation.constraints.Null.message=null \u0431\u0430\u0439\u0445 \u0451\u0441\u0442\u043E\u0439
+javax.validation.constraints.Past.message=\u04E8\u043D\u0433\u04E9\u0440\u0441\u04E9\u043D\u0434 \u0431\u0430\u0439\u0445 \u0451\u0441\u0442\u043E\u0439
+javax.validation.constraints.Pattern.message=\"{regexp}\"-\u0434 \u0442\u0430\u0430\u0440\u0430\u0445 \u0451\u0441\u0442\u043E\u0439
+javax.validation.constraints.Size.message=\u0425\u044D\u043C\u0436\u044D\u044D {min}-\u0441 {max} \u0445\u043E\u043E\u0440\u043E\u043D\u0434 \u0431\u0430\u0439\u043D\u0430
+org.hibernate.validator.constraints.Email.message=\u0411\u0443\u0440\u0443\u0443 \u0438-\u043C\u044D\u0439\u043B \u0445\u0430\u044F\u0433 \u0431\u0430\u0439\u043D\u0430
+org.hibernate.validator.constraints.Length.message=\u0422\u044D\u043C\u0434\u044D\u0433\u0442\u0438\u0439\u043D \u0443\u0440\u0442 {min}-\u0441 {max} \u0445\u043E\u043E\u0440\u043E\u043D\u0434 \u0431\u0430\u0439\u043D\u0430
+org.hibernate.validator.constraints.NotBlank.message=\u0425\u043E\u043E\u0441\u043E\u043D \u0431\u0430\u0439\u0436 \u0431\u043E\u043B\u043E\u0445\u0433\u04AF\u0439
+org.hibernate.validator.constraints.NotEmpty.message=\u0425\u043E\u043E\u0441\u043E\u043D \u0431\u0430\u0439\u0436 \u0431\u043E\u043B\u043E\u0445\u0433\u04AF\u0439
+org.hibernate.validator.constraints.Range.message=\u0423\u0442\u0433\u0430 {min}-\u0441 {max} \u0445\u043E\u043E\u0440\u043E\u043D\u0434 \u0431\u0430\u0439\u043D\u0430
\ No newline at end of file
diff --git a/hibernate-validator/src/main/resources/org/hibernate/validator/ValidationMessages_tr.properties b/hibernate-validator/src/main/resources/org/hibernate/validator/ValidationMessages_tr.properties
new file mode 100644
index 0000000..01acd7f
--- /dev/null
+++ b/hibernate-validator/src/main/resources/org/hibernate/validator/ValidationMessages_tr.properties
@@ -0,0 +1,18 @@
+javax.validation.constraints.AssertFalse.message=teyit ba\u015far\u0131s\u0131z
+javax.validation.constraints.AssertTrue.message=teyit ba\u015far\u0131s\u0131z
+javax.validation.constraints.DecimalMax.message='{value}' de\u011ferinden k\u00fc\u00e7\u00fck yada e\u015fit olmal\u0131
+javax.validation.constraints.DecimalMin.message='{value}' de\u011ferinden b\u00fcy\u00fck yada e\u015fit olmal\u0131
+javax.validation.constraints.Digits.message=s\u0131n\u0131rlar\u0131n d\u0131\u015f\u0131nda say\u0131sal de\u011fer (beklenen <{integerDigits} basamak>.<{fractionalDigits} basamak>)
+javax.validation.constraints.Future.message=ileri bir tarih olmal\u0131
+javax.validation.constraints.Max.message='{value}' de\u011ferinden k\u00fc\u00e7\u00fck yada e\u015fit olmal\u0131
+javax.validation.constraints.Min.message='{value}' de\u011ferinden b\u00fcy\u00fck yada e\u015fit olmal\u0131
+javax.validation.constraints.NotNull.message=bo\u015f de\u011fer olamaz
+javax.validation.constraints.Null.message=bo\u015f de\u011fer olmal\u0131
+javax.validation.constraints.Past.message=ge\u00e7mi\u015f bir tarih olmal\u0131
+javax.validation.constraints.Pattern.message='{regexp}' ile e\u015fle\u015fmeli
+javax.validation.constraints.Size.message=boyut '{min}' ile '{max}' aras\u0131nda olmal\u0131
+org.hibernate.validator.constraints.Length.message=uzunluk '{min}' ile '{max}' aras\u0131nda olmal\u0131
+org.hibernate.validator.constraints.NotBlank.message=bo\u015f de\u011fer olamaz
+org.hibernate.validator.constraints.NotEmpty.message=bo\u015f de\u011fer olamaz
+org.hibernate.validator.constraints.Email.message=d\u00fczg\u00fcn bi\u00e7imli bir e-posta adresi de\u011fil!
+org.hibernate.validator.constraints.Range.message={min} ve {max} aras\u0131nda olmal\u0131d\u0131r!
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/bootstrap/Customer.java b/hibernate-validator/src/test/java/org/hibernate/validator/bootstrap/Customer.java
deleted file mode 100644
index 782897f..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/bootstrap/Customer.java
+++ /dev/null
@@ -1,70 +0,0 @@
-// $Id: Customer.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.bootstrap;
-
-import java.util.HashSet;
-import java.util.Set;
-import javax.validation.Valid;
-
-import org.hibernate.validator.constraints.NotEmpty;
-
-/**
- * @author Hardy Ferentschik
- */
-public class Customer {
-	@NotEmpty
-	private String firstName;
-	private String middleName;
-	@NotEmpty
-	private String lastName;
-
-	@Valid
-	private Set<Order> orders = new HashSet<Order>();
-
-	public void addOrder(Order order) {
-		orders.add( order );
-	}
-
-	public Set<Order> getOrders() {
-		return orders;
-	}
-
-	public String getFirstName() {
-		return firstName;
-	}
-
-	public void setFirstName(String firstName) {
-		this.firstName = firstName;
-	}
-
-	public String getMiddleName() {
-		return middleName;
-	}
-
-	public void setMiddleName(String middleName) {
-		this.middleName = middleName;
-	}
-
-	public String getLastName() {
-		return lastName;
-	}
-
-	public void setLastName(String lastName) {
-		this.lastName = lastName;
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/bootstrap/Order.java b/hibernate-validator/src/test/java/org/hibernate/validator/bootstrap/Order.java
deleted file mode 100644
index c9992c2..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/bootstrap/Order.java
+++ /dev/null
@@ -1,36 +0,0 @@
-// $Id: Order.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.bootstrap;
-
-import javax.validation.constraints.NotNull;
-
-/**
- * @author Hardy Ferentschik
- */
-public class Order {
-	@NotNull
-	Integer orderNumber;
-
-	public Integer getOrderNumber() {
-		return orderNumber;
-	}
-
-	public void setOrderNumber(Integer orderNumber) {
-		this.orderNumber = orderNumber;
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/bootstrap/ValidationTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/bootstrap/ValidationTest.java
deleted file mode 100644
index 68c2895..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/bootstrap/ValidationTest.java
+++ /dev/null
@@ -1,118 +0,0 @@
-// $Id: ValidationTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.bootstrap;
-
-import java.util.Set;
-import javax.validation.Configuration;
-import javax.validation.ConstraintValidator;
-import javax.validation.ConstraintValidatorContext;
-import javax.validation.ConstraintValidatorFactory;
-import javax.validation.ConstraintViolation;
-import javax.validation.Validation;
-import javax.validation.Validator;
-import javax.validation.ValidatorFactory;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-
-import org.hibernate.validator.constraints.impl.NotNullValidator;
-import org.hibernate.validator.engine.ConfigurationImpl;
-import org.hibernate.validator.engine.ConstraintValidatorFactoryImpl;
-import org.hibernate.validator.HibernateValidatorConfiguration;
-import org.hibernate.validator.engine.ValidatorFactoryImpl;
-import org.hibernate.validator.HibernateValidator;
-
-/**
- * Tests the Bean Validation bootstrapping.
- *
- * @author Hardy Ferentschik
- */
-public class ValidationTest {
-
-	@Test
-	public void testBootstrapAsServiceWithBuilder() {
-		HibernateValidatorConfiguration configuration = Validation
-				.byProvider( HibernateValidator.class )
-				.configure();
-		assertDefaultBuilderAndFactory( configuration );
-	}
-
-	@Test
-	public void testBootstrapAsServiceDefault() {
-		ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
-		assertDefaultFactory( factory );
-	}
-
-	@Test
-	public void testCustomConstraintValidatorFactory() {
-
-		Configuration<?> configuration = Validation.byDefaultProvider().configure();
-		assertDefaultBuilderAndFactory( configuration );
-
-		ValidatorFactory factory = configuration.buildValidatorFactory();
-		Validator validator = factory.getValidator();
-
-		Customer customer = new Customer();
-		customer.setFirstName( "John" );
-
-		Set<ConstraintViolation<Customer>> constraintViolations = validator.validate( customer );
-		assertEquals( constraintViolations.size(), 1, "Wrong number of constraints" );
-		ConstraintViolation<Customer> constraintViolation = constraintViolations.iterator().next();
-		assertEquals( "may not be empty", constraintViolation.getMessage(), "Wrong message" );
-
-		// get a new factory using a custom configuration
-		configuration = Validation.byDefaultProvider().configure();
-		configuration.constraintValidatorFactory(
-				new ConstraintValidatorFactory() {
-
-					public <T extends ConstraintValidator<?, ?>> T getInstance(Class<T> key) {
-						if ( key == NotNullValidator.class ) {
-							return ( T ) new BadlyBehavedNotNullConstraintValidator();
-						}
-						return new ConstraintValidatorFactoryImpl().getInstance( key );
-					}
-				}
-		);
-		factory = configuration.buildValidatorFactory();
-		validator = factory.getValidator();
-		constraintViolations = validator.validate( customer );
-		assertEquals( constraintViolations.size(), 0, "Wrong number of constraints" );
-	}
-
-	private void assertDefaultBuilderAndFactory(Configuration configuration) {
-		assertNotNull( configuration );
-		assertTrue( configuration instanceof ConfigurationImpl );
-
-		ValidatorFactory factory = configuration.buildValidatorFactory();
-		assertDefaultFactory( factory );
-	}
-
-	private void assertDefaultFactory(ValidatorFactory factory) {
-		assertNotNull( factory );
-		assertTrue( factory instanceof ValidatorFactoryImpl );
-	}
-
-	class BadlyBehavedNotNullConstraintValidator extends NotNullValidator {
-		@Override
-		public boolean isValid(Object object, ConstraintValidatorContext constraintValidatorContext) {
-			return true;
-		}
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/ClassValidatorWithTypeVariableTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/ClassValidatorWithTypeVariableTest.java
deleted file mode 100644
index 7754e9e..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/ClassValidatorWithTypeVariableTest.java
+++ /dev/null
@@ -1,127 +0,0 @@
-// $Id: ClassValidatorWithTypeVariableTest.java 17744 2009-10-14 14:38:57Z hardy.ferentschik $
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, 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.constraints;
-
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Set;
-import javax.validation.ConstraintViolation;
-import javax.validation.Valid;
-import javax.validation.Validator;
-import javax.validation.constraints.NotNull;
-
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import org.hibernate.validator.util.TestUtil;
-import static org.hibernate.validator.util.TestUtil.assertCorrectConstraintTypes;
-import static org.hibernate.validator.util.TestUtil.assertCorrectPropertyPaths;
-import static org.hibernate.validator.util.TestUtil.assertNumberOfViolations;
-
-/**
- * HV-250
- */
-public class ClassValidatorWithTypeVariableTest {
-
-	private Validator validator;
-
-	@BeforeClass
-	public void setUp() {
-		validator = TestUtil.getValidator();
-	}
-
-	@Test
-	public void offersNull() {
-		Batch batch = new Batch( null );
-
-		Set<ConstraintViolation<Batch>> violations = validator.validate( batch );
-		assertNumberOfViolations( violations, 1 );
-		assertCorrectPropertyPaths( violations, "offers" );
-		assertCorrectConstraintTypes( violations, NotNull.class );
-	}
-
-	@Test
-	public void offerItemNull() {
-		ItemAOffer offer = new ItemAOffer( null );
-		Set<ItemOffer<? extends Item>> offers = new HashSet<ItemOffer<? extends Item>>();
-		offers.add( offer );
-		Batch batch = new Batch( offers );
-
-		Set<ConstraintViolation<Batch>> violations = validator.validate( batch );
-		assertNumberOfViolations( violations, 1 );
-		assertCorrectPropertyPaths( violations, "offers[].item" );
-		assertCorrectConstraintTypes( violations, NotNull.class );
-	}
-
-	@Test
-	public void offerItemDateNull() {
-		ItemA item = new ItemA( null );
-		ItemOffer<? extends Item> offer = new ItemAOffer( item );
-		Set<ItemOffer<? extends Item>> offers = new HashSet<ItemOffer<? extends Item>>();
-		offers.add( offer );
-		Batch batch = new Batch( offers );
-
-		Set<ConstraintViolation<Batch>> violations = validator.validate( batch );
-		assertNumberOfViolations( violations, 1 );
-		assertCorrectPropertyPaths( violations, "offers[].item.date" );
-		assertCorrectConstraintTypes( violations, NotNull.class );
-	}
-
-	private class Batch {
-		@NotNull
-		@Valid
-		private Set<ItemOffer<? extends Item>> offers = new HashSet<ItemOffer<? extends Item>>();
-
-		public Batch(Set<ItemOffer<? extends Item>> offers) {
-			this.offers = offers;
-		}
-	}
-
-	private abstract class Item {
-		@NotNull
-		private Date date;
-
-		public Item(Date date) {
-			this.date = date;
-		}
-	}
-
-	private abstract class ItemOffer<T extends Item> {
-		@NotNull
-		@Valid
-		private T item;
-
-		public ItemOffer(T item) {
-			this.item = item;
-		}
-	}
-
-	private class ItemA extends Item {
-		public ItemA(Date date) {
-			super( date );
-		}
-	}
-
-	private class ItemAOffer extends ItemOffer<ItemA> {
-		public ItemAOffer(ItemA item) {
-			super( item );
-		}
-	}
-}
-
-
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Cloneable.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Cloneable.java
deleted file mode 100644
index bf8ef55..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Cloneable.java
+++ /dev/null
@@ -1,44 +0,0 @@
-// $Id: Cloneable.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints;
-
-import java.lang.annotation.Documented;
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-import javax.validation.Constraint;
-import javax.validation.Payload;
-
-
-/**
- * @author Hardy Ferentschik
- */
- at Constraint(validatedBy = { CloneableConstraintValidator.class })
- at Target({ METHOD, FIELD, ANNOTATION_TYPE })
- at Retention(RUNTIME)
- at Documented
-public @interface Cloneable {
-	public abstract String message() default "{org.hibernate.validator.constraints.Cloneable.message}";
-
-	public abstract Class<?>[] groups() default { };
-
-	public abstract Class<? extends Payload>[] payload() default { };
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/CloneableConstraintValidator.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/CloneableConstraintValidator.java
deleted file mode 100644
index 7d60a04..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/CloneableConstraintValidator.java
+++ /dev/null
@@ -1,34 +0,0 @@
-// $Id: CloneableConstraintValidator.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints;
-
-import javax.validation.ConstraintValidator;
-import javax.validation.ConstraintValidatorContext;
-
-/**
- * @author Hardy Ferentschik
- */
-public class CloneableConstraintValidator implements ConstraintValidator<Cloneable, java.lang.Cloneable> {
-
-	public void initialize(Cloneable annotation) {
-	}
-
-	public boolean isValid(java.lang.Cloneable value, ConstraintValidatorContext constraintValidatorContext) {
-		return true;
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/ConstraintTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/ConstraintTest.java
deleted file mode 100644
index be2fba2..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/ConstraintTest.java
+++ /dev/null
@@ -1,67 +0,0 @@
-// $Id: ConstraintTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints;
-
-import java.util.Set;
-import javax.validation.ConstraintViolation;
-import javax.validation.Validator;
-
-import org.testng.annotations.Test;
-
-import org.hibernate.validator.util.TestUtil;
-import static org.hibernate.validator.util.TestUtil.assertConstraintViolation;
-import static org.hibernate.validator.util.TestUtil.assertNumberOfViolations;
-
-/**
- * @author Hardy Ferentschik
- */
-public class ConstraintTest {
-
-	@Test
-	public void testRangeConstraint() {
-		Validator validator = TestUtil.getValidator();
-
-		Elevator elevator = new Elevator();
-		elevator.setCurrentFloor( -3 );
-		Set<ConstraintViolation<Elevator>> constraintViolations = validator.validate( elevator );
-
-		assertNumberOfViolations( constraintViolations, 1 );
-		assertConstraintViolation( constraintViolations.iterator().next(), "Invalid floor" );
-
-		elevator.setCurrentFloor( -2 );
-		constraintViolations = validator.validate( elevator );
-
-		assertNumberOfViolations( constraintViolations, 0 );
-
-		elevator.setCurrentFloor( 45 );
-		constraintViolations = validator.validate( elevator );
-
-		assertNumberOfViolations( constraintViolations, 0 );
-
-		elevator.setCurrentFloor( 50 );
-		constraintViolations = validator.validate( elevator );
-
-		assertNumberOfViolations( constraintViolations, 0 );
-
-		elevator.setCurrentFloor( 51 );
-		constraintViolations = validator.validate( elevator );
-
-		assertNumberOfViolations( constraintViolations, 1 );
-		assertConstraintViolation( constraintViolations.iterator().next(), "Invalid floor" );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/ConstraintValidatorContextTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/ConstraintValidatorContextTest.java
deleted file mode 100644
index f9603bd..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/ConstraintValidatorContextTest.java
+++ /dev/null
@@ -1,159 +0,0 @@
-// $Id: ConstraintValidatorContextTest.java 17764 2009-10-15 12:37:13Z hardy.ferentschik $
-/*
-* 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.constraints;
-
-import java.util.List;
-import java.util.Set;
-import javax.validation.ConstraintViolation;
-import javax.validation.Validator;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-
-import org.hibernate.validator.engine.ConstraintValidatorContextImpl;
-import org.hibernate.validator.engine.MessageAndPath;
-import org.hibernate.validator.engine.PathImpl;
-import org.hibernate.validator.util.TestUtil;
-import static org.hibernate.validator.util.TestUtil.assertCorrectPropertyPaths;
-import static org.hibernate.validator.util.TestUtil.assertNumberOfViolations;
-
-/**
- * @author Hardy Ferentschik
- */
-public class ConstraintValidatorContextTest {
-
-	/**
-	 * HV-198
-	 */
-	@Test
-	public void testCorrectSubNodePath() {
-		Validator validator = TestUtil.getValidator();
-
-		Item item = new Item();
-		item.interval = new Interval();
-		item.interval.start = 10;
-		item.interval.end = 5;
-
-		Set<ConstraintViolation<Item>> constraintViolations = validator.validate( item );
-		assertNumberOfViolations( constraintViolations, 1 );
-		assertCorrectPropertyPaths( constraintViolations, "interval.start" );
-	}
-
-	/**
-	 * HV-208
-	 */
-	@Test
-	public void testCorrectPath() {
-		Validator validator = TestUtil.getValidator();
-
-		Item item = new Item();
-		Interval interval = new Interval();
-		item.interval = interval;
-		item.interval.start = 10;
-		item.interval.end = 5;
-
-		Set<ConstraintViolation<Interval>> constraintViolations = validator.validate( interval );
-		assertNumberOfViolations( constraintViolations, 1 );
-		assertCorrectPropertyPaths( constraintViolations, "start" );
-	}
-
-	@Test
-	public void testDifferentPaths() {
-		String message = "message";
-		ConstraintValidatorContextImpl context = createEmptyConstraintValidatorContextImpl();
-		context.buildConstraintViolationWithTemplate( message )
-				.addNode( "foo" )
-				.addNode( "bar" ).inIterable().atIndex( 3 )
-				.addConstraintViolation();
-
-		List<MessageAndPath> messageAndPathList = context.getMessageAndPathList();
-		assertMessageAndPath( messageAndPathList.get( 0 ), message, "foo[3].bar" );
-
-
-		context = createEmptyConstraintValidatorContextImpl();
-		context.buildConstraintViolationWithTemplate( message )
-				.addNode( "foo" )
-				.addNode( null ).inIterable().atKey( "test" )
-				.addConstraintViolation();
-
-		messageAndPathList = context.getMessageAndPathList();
-		assertMessageAndPath( messageAndPathList.get( 0 ), message, "foo[test]" );
-
-		context = createEmptyConstraintValidatorContextImpl();
-		context.buildConstraintViolationWithTemplate( message )
-				.addNode( "foo" )
-				.addNode( "bar" ).inIterable().atKey( "test" )
-				.addNode( "fubar" )
-				.addConstraintViolation();
-
-		messageAndPathList = context.getMessageAndPathList();
-		assertMessageAndPath( messageAndPathList.get( 0 ), message, "foo[test].bar.fubar" );
-
-		context = createEmptyConstraintValidatorContextImpl();
-		context.buildConstraintViolationWithTemplate( message )
-				.addNode( "foo" )
-				.addNode( "bar" ).inIterable().atKey( "test" )
-				.addNode( "fubar" ).inIterable().atIndex( 10 )
-				.addConstraintViolation();
-
-		messageAndPathList = context.getMessageAndPathList();
-		assertMessageAndPath( messageAndPathList.get( 0 ), message, "foo[test].bar[10].fubar" );
-
-		context = createEmptyConstraintValidatorContextImpl();
-		context.buildConstraintViolationWithTemplate( message )
-				.addNode( "foo" )
-				.addNode( "bar" ).inIterable().atKey( "test" )
-				.addNode( "fubar" ).inIterable()
-				.addConstraintViolation();
-
-		messageAndPathList = context.getMessageAndPathList();
-		assertMessageAndPath( messageAndPathList.get( 0 ), message, "foo[test].bar[].fubar" );
-	}
-
-	@Test
-	public void testMultipleMessages() {
-		String message1 = "message1";
-		String message2 = "message2";
-		ConstraintValidatorContextImpl context = createEmptyConstraintValidatorContextImpl();
-		context.buildConstraintViolationWithTemplate( message1 )
-				.addNode( "foo" )
-				.addNode( "bar" ).inIterable().atKey( "key" )
-				.addConstraintViolation();
-		context.buildConstraintViolationWithTemplate( message2 )
-				.addConstraintViolation();
-
-		List<MessageAndPath> messageAndPathList = context.getMessageAndPathList();
-		assertTrue( messageAndPathList.size() == 2 );
-		assertMessageAndPath( messageAndPathList.get( 0 ), message1, "foo[key].bar" );
-		assertMessageAndPath( messageAndPathList.get( 1 ), message2, "" );
-	}
-
-	private ConstraintValidatorContextImpl createEmptyConstraintValidatorContextImpl() {
-		ConstraintValidatorContextImpl context = new ConstraintValidatorContextImpl(
-				PathImpl.createNewPath( null ), null
-		);
-		context.disableDefaultConstraintViolation();
-		return context;
-	}
-
-	private void assertMessageAndPath(MessageAndPath messageAndPath, String expectedMessage, String expectedPath) {
-		assertEquals( messageAndPath.getPath(), PathImpl.createPathFromString( expectedPath ), "Wrong path" );
-		assertEquals( messageAndPath.getMessage(), expectedMessage, "Wrong message" );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Coordinate.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Coordinate.java
deleted file mode 100644
index eee8b02..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Coordinate.java
+++ /dev/null
@@ -1,35 +0,0 @@
-// $Id: Coordinate.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints;
-
-/**
- * @author Hardy Ferentschik
- */
-/**
- * @author Hardy Ferentschik
- */
-public class Coordinate {
-
-	long longitude;
-	long latitude;
-
-	public Coordinate(long longitude, long latitude) {
-		this.longitude = longitude;
-		this.latitude = latitude;
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Elevator.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Elevator.java
deleted file mode 100644
index a06a23d..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Elevator.java
+++ /dev/null
@@ -1,35 +0,0 @@
-// $Id: Elevator.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints;
-
-/**
- * @author Hardy Ferentschik
- */
-public class Elevator {
-
-	@Range(min = -2, max = 50, message = "Invalid floor")
-	private int currentFloor;
-
-	public int getCurrentFloor() {
-		return currentFloor;
-	}
-
-	public void setCurrentFloor(int currentFloor) {
-		this.currentFloor = currentFloor;
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Interval.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Interval.java
deleted file mode 100644
index 4b78167..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Interval.java
+++ /dev/null
@@ -1,28 +0,0 @@
-// $Id: Interval.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints;
-
-/**
- * @author Hardy Ferentschik
- */
- at StartLessThanEnd 
-class Interval
-{
-  int start;
-  int end;
-} 
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Item.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Item.java
deleted file mode 100644
index 04d1de6..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Item.java
+++ /dev/null
@@ -1,28 +0,0 @@
-// $Id: Item.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints;
-
-import javax.validation.Valid;
-
-/**
- * @author Hardy Ferentschik
- */
-class Item {
-	@Valid
-	Interval interval;
-} 
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Object.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Object.java
deleted file mode 100644
index 0bcfad4..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Object.java
+++ /dev/null
@@ -1,44 +0,0 @@
-// $Id: Object.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints;
-
-import java.lang.annotation.Documented;
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-import javax.validation.Constraint;
-import javax.validation.Payload;
-
-
-/**
- * @author Hardy Ferentschik
- */
- at Constraint(validatedBy = { ObjectConstraintValidator.class })
- at Target({ METHOD, FIELD, ANNOTATION_TYPE })
- at Retention(RUNTIME)
- at Documented
-public @interface Object {
-	String message() default "{org.hibernate.validator.constraints.Object.message}";
-
-	Class<?>[] groups() default { };
-
-	Class<? extends Payload>[] payload() default { };
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/ObjectConstraintValidator.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/ObjectConstraintValidator.java
deleted file mode 100644
index a7b2987..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/ObjectConstraintValidator.java
+++ /dev/null
@@ -1,34 +0,0 @@
-// $Id: ObjectConstraintValidator.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints;
-
-import javax.validation.ConstraintValidator;
-import javax.validation.ConstraintValidatorContext;
-
-/**
- * @author Hardy Ferentschik
- */
-public class ObjectConstraintValidator implements ConstraintValidator<Object, java.lang.Object> {
-
-	public void initialize(Object annotation) {
-	}
-
-	public boolean isValid(java.lang.Object value, ConstraintValidatorContext constraintValidatorContext) {
-		return true;
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/PostCodeList.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/PostCodeList.java
deleted file mode 100644
index 99cfe3e..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/PostCodeList.java
+++ /dev/null
@@ -1,72 +0,0 @@
-// $Id: PostCodeList.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Target;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.TYPE;
-import java.util.Collection;
-import javax.validation.Constraint;
-import javax.validation.Payload;
-import javax.validation.ConstraintValidator;
-import javax.validation.ConstraintValidatorContext;
-
-/**
- * A test constraint which can lead to a error when trying to reslove the validator.
- *
- * @author Hardy Ferentschik
- */
- at Constraint(validatedBy = {
-		PostCodeList.PostCodeListValidatorForString.class, PostCodeList.PostCodeListValidatorForNumber.class
-})
- at Documented
- at Target({ METHOD, FIELD, TYPE })
- at Retention(RUNTIME)
-public @interface PostCodeList {
-	public abstract String message() default "foobar";
-
-	public abstract Class<?>[] groups() default { };
-
-	public abstract Class<? extends Payload>[] payload() default {};
-
-	public class PostCodeListValidatorForNumber
-			implements ConstraintValidator<PostCodeList, Collection<? extends Number>> {
-		public void initialize(PostCodeList constraintAnnotation) {
-		}
-
-		public boolean isValid(Collection<? extends Number> value, ConstraintValidatorContext constraintValidatorContext) {
-			return true;
-		}
-	}
-
-	public class PostCodeListValidatorForString implements ConstraintValidator<PostCodeList, Collection<String>> {
-		public void initialize(PostCodeList constraintAnnotation) {
-		}
-
-		public boolean isValid(Collection<String> value, ConstraintValidatorContext constraintValidatorContext) {
-			if ( value == null ) {
-				return true;
-			}
-			return false;
-		}
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Serializable.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Serializable.java
deleted file mode 100644
index b828e49..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Serializable.java
+++ /dev/null
@@ -1,44 +0,0 @@
-// $Id: Serializable.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints;
-
-import java.lang.annotation.Documented;
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-import javax.validation.Constraint;
-import javax.validation.Payload;
-
-
-/**
- * @author Hardy Ferentschik
- */
- at Constraint(validatedBy = { SerializableConstraintValidator.class })
- at Target({ METHOD, FIELD, ANNOTATION_TYPE })
- at Retention(RUNTIME)
- at Documented
-public @interface Serializable {
-	public abstract String message() default "{org.hibernate.validator.constraints.Serializable.message}";
-
-	public abstract Class<?>[] groups() default { };
-
-	public abstract Class<? extends Payload>[] payload() default { };
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/SerializableConstraintValidator.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/SerializableConstraintValidator.java
deleted file mode 100644
index a0e6bb5..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/SerializableConstraintValidator.java
+++ /dev/null
@@ -1,34 +0,0 @@
-// $Id: SerializableConstraintValidator.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints;
-
-import javax.validation.ConstraintValidator;
-import javax.validation.ConstraintValidatorContext;
-
-/**
- * @author Hardy Ferentschik
- */
-public class SerializableConstraintValidator implements ConstraintValidator<Serializable, java.io.Serializable > {
-
-	public void initialize(Serializable annotation) {
-	}
-
-	public boolean isValid( java.io.Serializable value, ConstraintValidatorContext constraintValidatorContext) {
-		return true;
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/StartLessThanEnd.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/StartLessThanEnd.java
deleted file mode 100644
index 86bdc99..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/StartLessThanEnd.java
+++ /dev/null
@@ -1,41 +0,0 @@
-// $Id: StartLessThanEnd.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import javax.validation.Constraint;
-import javax.validation.Payload;
-
-
-/**
- * @author Hardy Ferentschik
- */
- at Target(ElementType.TYPE)
- at Retention(RetentionPolicy.RUNTIME)
- at Constraint(validatedBy = StartLessThanEndImpl.class)
-public @interface StartLessThanEnd {
-	String message() default "x";
-
-	Class<?>[] groups() default { };
-
-	Class<? extends Payload>[] payload() default { };
-}
-
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/StartLessThanEndImpl.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/StartLessThanEndImpl.java
deleted file mode 100644
index 02e9fed..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/StartLessThanEndImpl.java
+++ /dev/null
@@ -1,39 +0,0 @@
-// $Id: StartLessThanEndImpl.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints;
-
-import javax.validation.ConstraintValidator;
-import javax.validation.ConstraintValidatorContext;
-
-/**
- * @author Hardy Ferentschik
- */
-public class StartLessThanEndImpl implements ConstraintValidator<StartLessThanEnd, Interval> {
-
-	public void initialize(StartLessThanEnd constraintAnnotation) {
-	}
-
-	public boolean isValid(Interval value, ConstraintValidatorContext c) {
-		if ( value.start > value.end ) {
-			c.disableDefaultConstraintViolation();
-			c.buildConstraintViolationWithTemplate( c.getDefaultConstraintMessageTemplate() ).addNode( "start" ).addConstraintViolation();
-			return false;
-		}
-		return true;
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/SubType.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/SubType.java
deleted file mode 100644
index bb17ecc..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/SubType.java
+++ /dev/null
@@ -1,24 +0,0 @@
-// $Id: SubType.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints;
-
-/**
- * @author Hardy Ferentschik
- */
-public class SubType extends SuperType {
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Suburb.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Suburb.java
deleted file mode 100644
index 1cb5de3..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Suburb.java
+++ /dev/null
@@ -1,96 +0,0 @@
-// $Id: Suburb.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import javax.validation.constraints.Size;
-
-/**
- * @author Hardy Ferentschik
- */
-public class Suburb {
-	public enum Facility {
-		SHOPPING_MALL, BUS_TERMINAL
-	}
-
-	@Size(min = 5, max = 10, message = "size must be between {min} and {max}")
-	private String name;
-
-	@Size(min = 2, max = 2, message = "size must be between {min} and {max}")
-	private Map<Facility, Boolean> facilities;
-
-	@Size(min = 2, message = "size must be between {min} and {max}")
-	private Set<String> streetNames;
-
-	@Size(min = 4, max = 1000, message = "size must be between {min} and {max}")
-	private Coordinate[] boundingBox;
-
-	@PostCodeList
-	private Collection<? extends Number> includedPostCodes;
-
-	public void setIncludedPostCodes(Collection<? extends Number> includedPostCodes) {
-		this.includedPostCodes = includedPostCodes;
-	}
-
-	public Collection<? extends Number> getIncludedPostcodes() {
-		return includedPostCodes;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public Map<Facility, Boolean> getFacilities() {
-		return facilities;
-	}
-
-	public void addFacility(Facility f, Boolean exist) {
-		if ( facilities == null ) {
-			facilities = new HashMap<Facility, Boolean>();
-		}
-		facilities.put( f, exist );
-	}
-
-	public Set<String> getStreetNames() {
-		return streetNames;
-	}
-
-	public void addStreetName(String streetName) {
-		if ( streetNames == null ) {
-			streetNames = new HashSet<String>();
-		}
-		streetNames.add( streetName );
-	}
-
-	public Coordinate[] getBoundingBox() {
-		return boundingBox;
-	}
-
-	public void setBoundingBox(Coordinate[] boundingBox) {
-		this.boundingBox = boundingBox;
-	}
-}
-
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/SuperType.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/SuperType.java
deleted file mode 100644
index ba9c2d3..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/SuperType.java
+++ /dev/null
@@ -1,24 +0,0 @@
-// $Id: SuperType.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints;
-
-/**
- * @author Hardy Ferentschik
- */
-public class SuperType {
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/SuperTypeArray.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/SuperTypeArray.java
deleted file mode 100644
index 8d15c5f..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/SuperTypeArray.java
+++ /dev/null
@@ -1,44 +0,0 @@
-// $Id: SuperTypeArray.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints;
-
-import java.lang.annotation.Documented;
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-import javax.validation.Constraint;
-import javax.validation.Payload;
-
-
-/**
- * @author Hardy Ferentschik
- */
- at Constraint(validatedBy = { SuperTypeArrayValidator.class })
- at Target({ METHOD, FIELD, ANNOTATION_TYPE })
- at Retention(RUNTIME)
- at Documented
-public @interface SuperTypeArray {
-	public abstract String message() default "{org.hibernate.validator.constraints.SuperTypeArray.message}";
-
-	public abstract Class<?>[] groups() default { };
-
-	public abstract Class<? extends Payload>[] payload() default { };
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/SuperTypeArrayValidator.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/SuperTypeArrayValidator.java
deleted file mode 100644
index 9724314..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/SuperTypeArrayValidator.java
+++ /dev/null
@@ -1,34 +0,0 @@
-// $Id: SuperTypeArrayValidator.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints;
-
-import javax.validation.ConstraintValidator;
-import javax.validation.ConstraintValidatorContext;
-
-/**
- * @author Hardy Ferentschik
- */
-public class SuperTypeArrayValidator implements ConstraintValidator<SuperTypeArray, SuperType[]> {
-
-	public void initialize(SuperTypeArray annotation) {
-	}
-
-	public boolean isValid(SuperType[] value, ConstraintValidatorContext constraintValidatorContext) {
-		return true;
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/ValidatorResolutionTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/ValidatorResolutionTest.java
deleted file mode 100644
index 8c738d3..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/ValidatorResolutionTest.java
+++ /dev/null
@@ -1,212 +0,0 @@
-// $Id: ValidatorResolutionTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import javax.validation.ConstraintViolation;
-import javax.validation.Validator;
-
-import org.testng.annotations.Test;
-
-import org.hibernate.validator.util.TestUtil;
-import static org.hibernate.validator.util.TestUtil.assertConstraintViolation;
-import static org.hibernate.validator.util.TestUtil.assertNumberOfViolations;
-
-/**
- * @author Hardy Ferentschik
- */
-public class ValidatorResolutionTest {
-
-	@Test
-	public void testResolutionOfMultipleSizeValidators() {
-		Validator validator = TestUtil.getValidator();
-
-		Suburb suburb = new Suburb();
-
-		List<Integer> postcodes = new ArrayList<Integer>();
-		postcodes.add( 12345 );
-		suburb.setIncludedPostCodes( postcodes );
-
-		// all values are null and should pass
-		Set<ConstraintViolation<Suburb>> constraintViolations = validator.validate( suburb );
-		assertNumberOfViolations( constraintViolations, 0 );
-
-		suburb.setName( "" );
-		constraintViolations = validator.validate( suburb );
-		assertNumberOfViolations( constraintViolations, 1 );
-		assertConstraintViolation(
-				constraintViolations.iterator().next(), "size must be between 5 and 10", Suburb.class, "", "name"
-		);
-
-		suburb.setName( "Hoegsbo" );
-		constraintViolations = validator.validate( suburb );
-		assertNumberOfViolations( constraintViolations, 0 );
-
-		suburb.addFacility( Suburb.Facility.SHOPPING_MALL, false );
-		constraintViolations = validator.validate( suburb );
-		assertNumberOfViolations( constraintViolations, 1 );
-		assertConstraintViolation(
-				constraintViolations.iterator().next(),
-				"size must be between 2 and 2",
-				Suburb.class,
-				suburb.getFacilities(),
-				"facilities"
-		);
-
-		suburb.addFacility( Suburb.Facility.BUS_TERMINAL, true );
-		constraintViolations = validator.validate( suburb );
-		assertNumberOfViolations( constraintViolations, 0 );
-
-		suburb.addStreetName( "Sikelsgatan" );
-		constraintViolations = validator.validate( suburb );
-		assertNumberOfViolations( constraintViolations, 1 );
-		assertConstraintViolation(
-				constraintViolations.iterator().next(),
-				"size must be between 2 and 2147483647",
-				Suburb.class,
-				suburb.getStreetNames(),
-				"streetNames"
-		);
-
-		suburb.addStreetName( "Marklandsgatan" );
-		constraintViolations = validator.validate( suburb );
-		assertNumberOfViolations( constraintViolations, 0 );
-
-		Coordinate[] boundingBox = new Coordinate[3];
-		boundingBox[0] = new Coordinate( 0l, 0l );
-		boundingBox[1] = new Coordinate( 0l, 1l );
-		boundingBox[2] = new Coordinate( 1l, 0l );
-		suburb.setBoundingBox( boundingBox );
-		constraintViolations = validator.validate( suburb );
-		assertNumberOfViolations( constraintViolations, 1 );
-		assertConstraintViolation(
-				constraintViolations.iterator().next(),
-				"size must be between 4 and 1000",
-				Suburb.class,
-				suburb.getBoundingBox(),
-				"boundingBox"
-		);
-
-		boundingBox = new Coordinate[4];
-		boundingBox[0] = new Coordinate( 0l, 0l );
-		boundingBox[1] = new Coordinate( 0l, 1l );
-		boundingBox[2] = new Coordinate( 1l, 0l );
-		boundingBox[3] = new Coordinate( 1l, 1l );
-		suburb.setBoundingBox( boundingBox );
-		constraintViolations = validator.validate( suburb );
-		assertNumberOfViolations( constraintViolations, 0 );
-	}
-
-	/**
-	 * HV-233
-	 */
-	@Test
-	public void testObjectArraysAndPrimitiveArraysAreSubtypesOfObject() {
-		Validator validator = TestUtil.getValidator();
-
-		Foo testEntity = new Foo( new Object[] { }, new int[] { } );
-		Set<ConstraintViolation<Foo>> constraintViolations = validator.validate( testEntity );
-		assertNumberOfViolations( constraintViolations, 0 );
-	}
-
-	/**
-	 * HV-233
-	 */
-	@Test
-	public void testObjectArraysAndPrimitiveArraysAreSubtypesOfClonable() {
-		Validator validator = TestUtil.getValidator();
-
-		Bar testEntity = new Bar( new Object[] { }, new int[] { } );
-		Set<ConstraintViolation<Bar>> constraintViolations = validator.validate( testEntity );
-		assertNumberOfViolations( constraintViolations, 0 );
-	}
-
-	/**
-	 * HV-233
-	 */
-	@Test
-	public void testObjectArraysAndPrimitiveArraysAreSubtypesOfSerializable() {
-		Validator validator = TestUtil.getValidator();
-
-		Fubar testEntity = new Fubar( new Object[] { }, new int[] { } );
-		Set<ConstraintViolation<Fubar>> constraintViolations = validator.validate( testEntity );
-		assertNumberOfViolations( constraintViolations, 0 );
-	}
-
-	/**
-	 * HV-233
-	 */
-	@Test
-	public void testSubTypeArrayIsSubtypeOfSuperTypeArray() {
-		Validator validator = TestUtil.getValidator();
-
-		SubTypeEntity testEntity = new SubTypeEntity( new SubType[] { } );
-		Set<ConstraintViolation<SubTypeEntity>> constraintViolations = validator.validate( testEntity );
-		assertNumberOfViolations( constraintViolations, 0 );
-	}
-
-	public class Foo {
-		@Object
-		private Object[] objectArray;
-
-		@Object
-		private int[] intArray;
-
-		public Foo(Object[] objectArray, int[] intArray) {
-			this.objectArray = objectArray;
-			this.intArray = intArray;
-		}
-	}
-
-	public class Bar {
-		@Cloneable
-		private Object[] objectArray;
-
-		@Cloneable
-		private int[] intArray;
-
-		public Bar(Object[] objectArray, int[] intArray) {
-			this.objectArray = objectArray;
-			this.intArray = intArray;
-		}
-	}
-
-	public class Fubar {
-		@Serializable
-		private Object[] objectArray;
-
-		@Serializable
-		private int[] intArray;
-
-		public Fubar(Object[] objectArray, int[] intArray) {
-			this.objectArray = objectArray;
-			this.intArray = intArray;
-		}
-	}
-
-	public class SubTypeEntity {
-		@SuperTypeArray
-		private SubType[] subTypeArray;
-
-		public SubTypeEntity(SubType[] subTypeArray) {
-			this.subTypeArray = subTypeArray;
-		}
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/composition/CompositeConstraintTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/composition/CompositeConstraintTest.java
deleted file mode 100644
index 953e1b0..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/composition/CompositeConstraintTest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-// $Id: CompositeConstraintTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints.composition;
-
-import java.util.Set;
-import javax.validation.ConstraintViolation;
-import javax.validation.Validator;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-
-import static org.testng.Assert.assertEquals;
-import org.testng.annotations.Test;
-
-import org.hibernate.validator.util.TestUtil;
-import static org.hibernate.validator.util.TestUtil.assertCorrectConstraintTypes;
-import static org.hibernate.validator.util.TestUtil.assertCorrectConstraintViolationMessages;
-import static org.hibernate.validator.util.TestUtil.assertNumberOfViolations;
-
-/**
- * @author Gerhard Petracek
- * @author Hardy Ferentschik
- */
-public class CompositeConstraintTest {
-
-	/**
-	 * HV-182
-	 */
-	@Test
-	public void testCorrectAnnotationTypeForWithReportAsSingleViolation() {
-
-		Validator currentValidator = TestUtil.getValidator();
-
-		for ( int i = 0; i < 100; i++ ) {
-			Set<ConstraintViolation<Person>> constraintViolations = currentValidator.validate(
-					new Person(
-							null, "Gerhard"
-					)
-			);
-
-			assertNumberOfViolations( constraintViolations, 1 );
-			assertCorrectConstraintTypes( constraintViolations, ValidNameSingleViolation.class );
-			assertCorrectConstraintViolationMessages( constraintViolations, "invalid name" );
-
-			constraintViolations = currentValidator.validate(
-					new Person(
-							"G", "Gerhard"
-					)
-			);
-			assertNumberOfViolations( constraintViolations, 1 );
-			assertCorrectConstraintTypes( constraintViolations, ValidNameSingleViolation.class );
-			assertCorrectConstraintViolationMessages( constraintViolations, "invalid name" );
-		}
-	}
-
-	/**
-	 * HV-182
-	 */
-	@Test
-	public void testCorrectAnnotationTypeReportMultipleViolations() {
-
-		Validator currentValidator = TestUtil.getValidator();
-
-		for ( int i = 0; i < 100; i++ ) {
-			Set<ConstraintViolation<Person>> constraintViolations = currentValidator.validate(
-					new Person(
-							"Gerd", null
-					)
-			);
-
-			assertNumberOfViolations( constraintViolations, 1 );
-			assertCorrectConstraintTypes( constraintViolations, NotNull.class );
-			assertCorrectConstraintViolationMessages( constraintViolations, "may not be null" );
-
-			constraintViolations = currentValidator.validate(
-					new Person(
-							"Gerd", "G"
-					)
-			);
-			assertNumberOfViolations( constraintViolations, 1 );
-			assertCorrectConstraintTypes( constraintViolations, Size.class );
-			assertCorrectConstraintViolationMessages( constraintViolations, "size must be between 2 and 10" );
-		}
-	}
-}
-
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/composition/Person.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/composition/Person.java
deleted file mode 100644
index 8de9530..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/composition/Person.java
+++ /dev/null
@@ -1,54 +0,0 @@
-// $Id: Person.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints.composition;
-
-/**
- * Test mode for HV-182.
- *
- * @author Gerhard Petracek
- * @author Hardy Ferentschik
- */
-
-public class Person {
-	@ValidNameSingleViolation
-	private String nickName;
-
-	@ValidName
-	private String name;
-
-	public Person(String nickName, String name) {
-		this.nickName = nickName;
-		this.name = name;
-	}
-
-	public String getNickName() {
-		return nickName;
-	}
-
-	public void setNickName(String nickName) {
-		this.nickName = nickName;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/composition/ValidName.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/composition/ValidName.java
deleted file mode 100644
index 4d13251..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/composition/ValidName.java
+++ /dev/null
@@ -1,47 +0,0 @@
-// $Id: ValidName.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints.composition;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-import javax.validation.Constraint;
-import javax.validation.Payload;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-
-/**
- * Test constraint for HV-182.
- *
- * @author Gerhard Petracek
- * @author Hardy Ferentschik
- */
- at NotNull
- at Size(min = 2, max = 10)
- at Target({ METHOD, FIELD })
- at Retention(RUNTIME)
- at Constraint(validatedBy = { })
-public @interface ValidName {
-	public abstract String message() default "invalid name";
-
-	public abstract Class<?>[] groups() default { };
-
-	public abstract Class<? extends Payload>[] payload() default { };
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/composition/ValidNameSingleViolation.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/composition/ValidNameSingleViolation.java
deleted file mode 100644
index 141f93b..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/composition/ValidNameSingleViolation.java
+++ /dev/null
@@ -1,49 +0,0 @@
-// $Id: ValidNameSingleViolation.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints.composition;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-import javax.validation.Constraint;
-import javax.validation.Payload;
-import javax.validation.ReportAsSingleViolation;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-
-/**
- * Test constraint for HV-182.
- *
- * @author Gerhard Petracek
- * @author Hardy Ferentschik
- */
- at NotNull
- at Size(min = 2, max = 10)
- at ReportAsSingleViolation
- at Target({ METHOD, FIELD })
- at Retention(RUNTIME)
- at Constraint(validatedBy = { })
-public @interface ValidNameSingleViolation {
-	String message() default "invalid name";
-
-	Class<?>[] groups() default { };
-
-	Class<? extends Payload>[] payload() default { };
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/AssertFalseValidatorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/AssertFalseValidatorTest.java
deleted file mode 100644
index 26d1d47..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/AssertFalseValidatorTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-// $Id: AssertFalseValidatorTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints.impl;
-
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/**
- * @author Alaa Nassef
- */
-public class AssertFalseValidatorTest {
-
-	private static AssertFalseValidator constraint;
-
-	@BeforeClass
-	public static void init() {
-		constraint = new AssertFalseValidator();
-	}
-
-	@Test
-	public void testIsValid() {
-		assertTrue( constraint.isValid( null, null ) );
-		assertTrue( constraint.isValid( false, null ) );
-		assertTrue( constraint.isValid( Boolean.FALSE, null ) );
-		assertFalse( constraint.isValid( true, null ) );
-		assertFalse( constraint.isValid( Boolean.TRUE, null ) );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/AssertTrueValidatorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/AssertTrueValidatorTest.java
deleted file mode 100644
index 4ebefd5..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/AssertTrueValidatorTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-// $Id: AssertTrueValidatorTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints.impl;
-
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/**
- * @author Alaa Nassef
- */
-public class AssertTrueValidatorTest {
-
-	private static AssertTrueValidator constraint;
-
-	@BeforeClass
-	public static void init() {
-		constraint = new AssertTrueValidator();
-	}
-
-	@Test
-	public void testIsValid() {
-		assertTrue( constraint.isValid( null, null ) );
-		assertTrue( constraint.isValid( true, null ) );
-		assertTrue( constraint.isValid( Boolean.TRUE, null ) );
-		assertFalse( constraint.isValid( false, null ) );
-		assertFalse( constraint.isValid( Boolean.FALSE, null ) );
-	}
-}
-
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/DateHolder.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/DateHolder.java
deleted file mode 100644
index f0fad61..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/DateHolder.java
+++ /dev/null
@@ -1,67 +0,0 @@
-// $Id: DateHolder.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints.impl;
-
-import java.util.Calendar;
-import java.util.Date;
-import javax.validation.constraints.Future;
-import javax.validation.constraints.Past;
-
-/**
- * @author Hardy Ferentschik
- */
-public class DateHolder {
-
-	@Past
-	private Calendar calendarWithPastDate;
-
-	@Future
-	private Calendar calendarWithFutureDate;
-
-	@Past
-	private Date past;
-
-	@Past
-	private Date future;
-
-	public DateHolder() {
-		calendarWithPastDate = Calendar.getInstance();
-		calendarWithPastDate.add( Calendar.YEAR, -1 );
-		past = calendarWithPastDate.getTime();
-
-		calendarWithFutureDate = Calendar.getInstance();
-		calendarWithFutureDate.add( Calendar.YEAR, 1 );
-		future = calendarWithFutureDate.getTime();
-	}
-
-	public Calendar getCalendarWithPastDate() {
-		return calendarWithPastDate;
-	}
-
-	public Calendar getCalendarWithFutureDate() {
-		return calendarWithFutureDate;
-	}
-
-	public Date getPast() {
-		return past;
-	}
-
-	public Date getFuture() {
-		return future;
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/DigitsValidatorForNumberTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/DigitsValidatorForNumberTest.java
deleted file mode 100644
index 77211c3..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/DigitsValidatorForNumberTest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-// $Id: DigitsValidatorForNumberTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints.impl;
-
-import java.math.BigDecimal;
-import javax.validation.constraints.Digits;
-
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-
-import org.hibernate.validator.util.annotationfactory.AnnotationDescriptor;
-import org.hibernate.validator.util.annotationfactory.AnnotationFactory;
-
-/**
- * @author Alaa Nassef
- * @author Hardy Ferentschik
- */
-public class DigitsValidatorForNumberTest {
-
-	@Test
-	public void testIsValid() {
-
-		AnnotationDescriptor<Digits> descriptor = new AnnotationDescriptor<Digits>( Digits.class );
-		descriptor.setValue( "integer", 5 );
-		descriptor.setValue( "fraction", 2 );
-		descriptor.setValue( "message", "{validator.digits}" );
-		Digits p = AnnotationFactory.create( descriptor );
-
-		DigitsValidatorForNumber constraint = new DigitsValidatorForNumber();
-		constraint.initialize( p );
-
-
-		assertTrue( constraint.isValid( null, null ) );
-		assertTrue( constraint.isValid( Byte.valueOf( "0" ), null ) );
-		assertTrue( constraint.isValid( Double.valueOf( "500.2" ), null ) );
-
-		assertTrue( constraint.isValid( new BigDecimal( "-12345.12" ), null ) );
-		assertFalse( constraint.isValid( new BigDecimal( "-123456.12" ), null ) );
-		assertFalse( constraint.isValid( new BigDecimal( "-123456.123" ), null ) );
-		assertFalse( constraint.isValid( new BigDecimal( "-12345.123" ), null ) );
-		assertFalse( constraint.isValid( new BigDecimal( "12345.123" ), null ) );
-
-		assertTrue( constraint.isValid( Float.valueOf( "-000000000.22" ), null ) );
-		assertFalse( constraint.isValid( Integer.valueOf( "256874" ), null ) );
-		assertFalse( constraint.isValid( Double.valueOf( "12.0001" ), null ) );
-	}
-
-	@Test
-	public void testIsValidZeroLength() {
-
-		AnnotationDescriptor<Digits> descriptor = new AnnotationDescriptor<Digits>( Digits.class );
-		descriptor.setValue( "integer", 0 );
-		descriptor.setValue( "fraction", 0 );
-		descriptor.setValue( "message", "{validator.digits}" );
-		Digits p = AnnotationFactory.create( descriptor );
-
-		DigitsValidatorForNumber constraint = new DigitsValidatorForNumber();
-		constraint.initialize( p );
-
-
-		assertTrue( constraint.isValid( null, null ) );
-		assertFalse( constraint.isValid( Byte.valueOf( "0" ), null ) );
-		assertFalse( constraint.isValid( Double.valueOf( "500.2" ), null ) );
-	}
-
-	@Test(expectedExceptions = IllegalArgumentException.class)
-	public void testNegativeIntegerLength() {
-
-		AnnotationDescriptor<Digits> descriptor = new AnnotationDescriptor<Digits>( Digits.class );
-		descriptor.setValue( "integer", -1 );
-		descriptor.setValue( "fraction", 1 );
-		descriptor.setValue( "message", "{validator.digits}" );
-		Digits p = AnnotationFactory.create( descriptor );
-
-		DigitsValidatorForNumber constraint = new DigitsValidatorForNumber();
-		constraint.initialize( p );
-	}
-
-	@Test(expectedExceptions = IllegalArgumentException.class)
-	public void testNegativeFractionLength() {
-
-		AnnotationDescriptor<Digits> descriptor = new AnnotationDescriptor<Digits>( Digits.class );
-		descriptor.setValue( "integer", 1 );
-		descriptor.setValue( "fraction", -1 );
-		descriptor.setValue( "message", "{validator.digits}" );
-		Digits p = AnnotationFactory.create( descriptor );
-
-		DigitsValidatorForNumber constraint = new DigitsValidatorForNumber();
-		constraint.initialize( p );
-	}
-
-	@Test
-	public void testTrailingZerosAreTrimmed() {
-		AnnotationDescriptor<Digits> descriptor = new AnnotationDescriptor<Digits>( Digits.class );
-		descriptor.setValue( "integer", 12 );
-		descriptor.setValue( "fraction", 3 );
-		descriptor.setValue( "message", "{validator.digits}" );
-		Digits p = AnnotationFactory.create( descriptor );
-
-		DigitsValidatorForNumber constraint = new DigitsValidatorForNumber();
-		constraint.initialize( p );
-
-		assertTrue( constraint.isValid( 0.001d, null ) );
-		assertTrue( constraint.isValid( 0.00100d, null ) );
-		assertFalse( constraint.isValid( 0.0001d, null ) );
-	}
-
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/DigitsValidatorForStringTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/DigitsValidatorForStringTest.java
deleted file mode 100644
index 5a3179f..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/DigitsValidatorForStringTest.java
+++ /dev/null
@@ -1,89 +0,0 @@
-// $Id: DigitsValidatorForStringTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints.impl;
-
-import javax.validation.constraints.Digits;
-
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import org.hibernate.validator.util.annotationfactory.AnnotationDescriptor;
-import org.hibernate.validator.util.annotationfactory.AnnotationFactory;
-
-/**
- * @author Alaa Nassef
- */
-public class DigitsValidatorForStringTest {
-
-	private static DigitsValidatorForString constraint;
-
-	@BeforeClass
-	public static void init() {
-
-		AnnotationDescriptor<Digits> descriptor = new AnnotationDescriptor<Digits>( Digits.class );
-		descriptor.setValue( "integer", 5 );
-		descriptor.setValue( "fraction", 2 );
-		descriptor.setValue( "message", "{validator.digits}" );
-		Digits p = AnnotationFactory.create( descriptor );
-
-		constraint = new DigitsValidatorForString();
-		constraint.initialize( p );
-	}
-
-	@Test
-	public void testIsValid() {
-
-		assertTrue( constraint.isValid( null, null ) );
-		assertTrue( constraint.isValid( "0", null ) );
-		assertTrue( constraint.isValid( "500.2", null ) );
-		assertTrue( constraint.isValid( "-12456.22", null ) );
-		assertTrue( constraint.isValid( "-000000000.22", null ) );
-		//should throw number format exception
-		assertFalse( constraint.isValid( "", null ) );
-		assertFalse( constraint.isValid( "256874.0", null ) );
-		assertFalse( constraint.isValid( "12.0001", null ) );
-	}
-
-	@Test(expectedExceptions = IllegalArgumentException.class)
-	public void testNegativeIntegerLength() {
-
-		AnnotationDescriptor<Digits> descriptor = new AnnotationDescriptor<Digits>( Digits.class );
-		descriptor.setValue( "integer", -1 );
-		descriptor.setValue( "fraction", 1 );
-		descriptor.setValue( "message", "{validator.digits}" );
-		Digits p = AnnotationFactory.create( descriptor );
-
-		DigitsValidatorForString constraint = new DigitsValidatorForString();
-		constraint.initialize( p );
-	}
-
-	@Test(expectedExceptions = IllegalArgumentException.class)
-	public void testNegativeFractionLength() {
-
-		AnnotationDescriptor<Digits> descriptor = new AnnotationDescriptor<Digits>( Digits.class );
-		descriptor.setValue( "integer", 1 );
-		descriptor.setValue( "fraction", -1 );
-		descriptor.setValue( "message", "{validator.digits}" );
-		Digits p = AnnotationFactory.create( descriptor );
-
-		DigitsValidatorForString constraint = new DigitsValidatorForString();
-		constraint.initialize( p );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/EmailValidatorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/EmailValidatorTest.java
deleted file mode 100644
index 373ef78..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/EmailValidatorTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-// $Id: EmailValidatorTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints.impl;
-
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/**
- * @author Hardy Ferentschik
- */
-public class EmailValidatorTest {
-
-	private static EmailValidator validator;
-
-	@BeforeClass
-	public static void init() {
-		validator = new EmailValidator();
-	}
-
-	@Test
-	public void testEmail() throws Exception {
-		isRightEmail( "emmanuel at hibernate.org" );
-		isRightEmail( "" );
-		isRightEmail( null );
-		isRightEmail( "emmanuel at hibernate" );
-		isRightEmail( "emma-n_uel at hibernate" );
-		isRightEmail( "emma+nuel at hibernate.org" );
-		isRightEmail( "emma=nuel at hibernate.org" );
-		isRightEmail( "emmanuel@[123.12.2.11]" );
-		isWrongEmail( "emmanuel.hibernate.org" );
-		isWrongEmail( "emma nuel at hibernate.org" );
-		isWrongEmail( "emma(nuel at hibernate.org" );
-		isWrongEmail( "emmanuel@" );
-		isWrongEmail( "emma\nnuel at hibernate.org" );
-		isWrongEmail( "emma at nuel@hibernate.org" );
-	}
-
-	private void isRightEmail(String email) {
-		assertTrue( validator.isValid( email, null ), "Expected a valid email." );
-	}
-
-	private void isWrongEmail(String email) {
-		assertFalse( validator.isValid( email, null ), "Expected a invalid email." );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/FutureValidatorForCalendarTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/FutureValidatorForCalendarTest.java
deleted file mode 100644
index a437538..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/FutureValidatorForCalendarTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-// $Id: FutureValidatorForCalendarTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints.impl;
-
-import java.util.Calendar;
-
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/**
- * @author Alaa Nassef
- * @author Hardy Ferentschik
- */
-public class FutureValidatorForCalendarTest {
-
-	private static FutureValidatorForCalendar constraint;
-
-	@BeforeClass
-	public static void init() {
-		constraint = new FutureValidatorForCalendar();
-	}
-
-	@Test
-	public void testIsValid() {
-		Calendar futureDate = getFutureDate();
-		Calendar pastDate = getPastDate();
-		assertTrue( constraint.isValid( null, null ) );
-		assertTrue( constraint.isValid( futureDate, null ) );
-		assertFalse( constraint.isValid( pastDate, null ) );
-	}
-
-	private Calendar getFutureDate() {
-		Calendar cal = Calendar.getInstance();
-		int year = cal.get( Calendar.YEAR );
-		cal.set( Calendar.YEAR, year + 1 );
-		return cal;
-	}
-
-	private Calendar getPastDate() {
-		Calendar cal = Calendar.getInstance();
-		int year = cal.get( Calendar.YEAR );
-		cal.set( Calendar.YEAR, year - 1 );
-		return cal;
-	}
-
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/FutureValidatorForDateTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/FutureValidatorForDateTest.java
deleted file mode 100644
index 7839bc1..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/FutureValidatorForDateTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-// $Id: FutureValidatorForDateTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints.impl;
-
-import java.util.Date;
-
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-public class FutureValidatorForDateTest {
-
-	private static FutureValidatorForDate constraint;
-
-	@BeforeClass
-	public static void init() {
-		constraint = new FutureValidatorForDate();
-	}
-
-	@Test
-	public void testIsValid() {
-		Date futureDate = getFutureDate();
-		Date pastDate = getPastDate();
-		assertTrue( constraint.isValid( null, null ) );
-		assertTrue( constraint.isValid( futureDate, null ) );
-		assertFalse( constraint.isValid( new Date(), null ) );
-		assertFalse( constraint.isValid( pastDate, null ) );
-	}
-
-	private Date getFutureDate() {
-		Date date = new Date();
-		long timeStamp = date.getTime();
-		date.setTime( timeStamp + 31557600000l );
-		return date;
-	}
-
-	private Date getPastDate() {
-		Date date = new Date();
-		long timeStamp = date.getTime();
-		date.setTime( timeStamp - 31557600000l );
-		return date;
-	}
-
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/FutureValidatorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/FutureValidatorTest.java
deleted file mode 100644
index 9f38770..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/FutureValidatorTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-// $Id: FutureValidatorTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints.impl;
-
-import java.util.Set;
-import javax.validation.ConstraintViolation;
-import javax.validation.Validator;
-
-import static org.testng.Assert.assertEquals;
-import org.testng.annotations.Test;
-
-import org.hibernate.validator.util.TestUtil;
-
-/**
- * @author Hardy Ferentschik
- */
-public class FutureValidatorTest {
-
-	/**
-	 * HV-158
-	 */
-	@Test
-	public void testFutureAndPast() {
-		Validator validator = TestUtil.getValidator();
-		DateHolder dateHolder = new DateHolder();
-		Set<ConstraintViolation<DateHolder>> constraintViolations = validator.validate( dateHolder );
-		assertEquals( constraintViolations.size(), 1, "Wrong number of constraints" );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/LengthValidatorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/LengthValidatorTest.java
deleted file mode 100644
index 4c330ed..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/LengthValidatorTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-// $Id: LengthValidatorTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints.impl;
-
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-
-import org.hibernate.validator.constraints.Length;
-import org.hibernate.validator.util.annotationfactory.AnnotationDescriptor;
-import org.hibernate.validator.util.annotationfactory.AnnotationFactory;
-
-/**
- * Tests the <code>LengthConstraint</code>.
- *
- * @author Hardy Ferentschik
- */
-public class LengthValidatorTest {
-
-	@Test
-	public void testIsValid() {
-		AnnotationDescriptor<Length> descriptor = new AnnotationDescriptor<Length>( Length.class );
-		descriptor.setValue( "min", 1 );
-		descriptor.setValue( "max", 3 );
-		descriptor.setValue( "message", "{validator.length}" );
-		Length l = AnnotationFactory.create( descriptor );
-		LengthValidator constraint = new LengthValidator();
-		constraint.initialize( l );
-		assertTrue( constraint.isValid( null, null ) );
-		assertFalse( constraint.isValid( "", null ) );
-		assertTrue( constraint.isValid( "f", null ) );
-		assertTrue( constraint.isValid( "fo", null ) );
-		assertTrue( constraint.isValid( "foo", null ) );
-		assertFalse( constraint.isValid( "foobar", null ) );
-	}
-
-	@Test(expectedExceptions = IllegalArgumentException.class)
-	public void testNegativeMinValue() {
-		AnnotationDescriptor<Length> descriptor = new AnnotationDescriptor<Length>( Length.class );
-		descriptor.setValue( "min", -1 );
-		descriptor.setValue( "max", 1 );
-		descriptor.setValue( "message", "{validator.length}" );
-		Length p = AnnotationFactory.create( descriptor );
-
-		LengthValidator constraint = new LengthValidator();
-		constraint.initialize( p );
-	}
-
-	@Test(expectedExceptions = IllegalArgumentException.class)
-	public void testNegativeMaxValue() {
-		AnnotationDescriptor<Length> descriptor = new AnnotationDescriptor<Length>( Length.class );
-		descriptor.setValue( "min", 1 );
-		descriptor.setValue( "max", -1 );
-		descriptor.setValue( "message", "{validator.length}" );
-		Length p = AnnotationFactory.create( descriptor );
-
-		LengthValidator constraint = new LengthValidator();
-		constraint.initialize( p );
-	}
-
-	@Test(expectedExceptions = IllegalArgumentException.class)
-	public void testNegativeLength() {
-		AnnotationDescriptor<Length> descriptor = new AnnotationDescriptor<Length>( Length.class );
-		descriptor.setValue( "min", 5 );
-		descriptor.setValue( "max", 4 );
-		descriptor.setValue( "message", "{validator.length}" );
-		Length p = AnnotationFactory.create( descriptor );
-
-		LengthValidator constraint = new LengthValidator();
-		constraint.initialize( p );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/MaxValidatorForNumberTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/MaxValidatorForNumberTest.java
deleted file mode 100644
index 67d8312..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/MaxValidatorForNumberTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-// $Id: MaxValidatorForNumberTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints.impl;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import javax.validation.ConstraintValidator;
-import javax.validation.constraints.DecimalMax;
-import javax.validation.constraints.Max;
-
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-import org.testng.annotations.Test;
-
-import org.hibernate.validator.util.annotationfactory.AnnotationDescriptor;
-import org.hibernate.validator.util.annotationfactory.AnnotationFactory;
-
-/**
- * @author Alaa Nassef
- * @author Hardy Ferentschik
- */
-public class MaxValidatorForNumberTest {
-
-	@Test
-	public void testIsValidMax() {
-
-		AnnotationDescriptor<Max> descriptor = new AnnotationDescriptor<Max>( Max.class );
-		descriptor.setValue( "value", 15l );
-		descriptor.setValue( "message", "{validator.max}" );
-		Max m = AnnotationFactory.create( descriptor );
-
-		MaxValidatorForNumber constraint = new MaxValidatorForNumber();
-		constraint.initialize( m );
-		testMaxValidator( constraint );
-	}
-
-	@Test
-	public void testIsValidDecimalMax() {
-
-		AnnotationDescriptor<DecimalMax> descriptor = new AnnotationDescriptor<DecimalMax>( DecimalMax.class );
-		descriptor.setValue( "value", "15.0E0" );
-		descriptor.setValue( "message", "{validator.max}" );
-		DecimalMax m = AnnotationFactory.create( descriptor );
-
-		DecimalMaxValidatorForNumber constraint = new DecimalMaxValidatorForNumber();
-		constraint.initialize( m );
-		testMaxValidator( constraint );
-	}
-
-	@Test
-	public void testInitializeDecimalMaxWithInvalidValue() {
-
-		AnnotationDescriptor<DecimalMax> descriptor = new AnnotationDescriptor<DecimalMax>( DecimalMax.class );
-		descriptor.setValue( "value", "foobar" );
-		descriptor.setValue( "message", "{validator.max}" );
-		DecimalMax m = AnnotationFactory.create( descriptor );
-
-		DecimalMaxValidatorForNumber constraint = new DecimalMaxValidatorForNumber();
-		try {
-			constraint.initialize( m );
-			fail();
-		}
-		catch ( IllegalArgumentException e ) {
-			// success
-		}
-	}
-
-	private void testMaxValidator(ConstraintValidator<?, Number> constraint) {
-		byte b = 1;
-		Byte bWrapper = 127;
-		assertTrue( constraint.isValid( null, null ) );
-		assertTrue( constraint.isValid( b, null ) );
-		assertTrue( constraint.isValid( 15l, null ) );
-		assertTrue( constraint.isValid( 15, null ) );
-		assertTrue( constraint.isValid( 15.0, null ) );
-		assertTrue( constraint.isValid( BigDecimal.valueOf( -156000000000.0 ), null ) );
-		assertTrue( constraint.isValid( BigInteger.valueOf( -10000000l ), null ) );
-		assertTrue( constraint.isValid( 10, null ) );
-		assertTrue( constraint.isValid( 14.99, null ) );
-		assertTrue( constraint.isValid( -14.99, null ) );
-		assertFalse( constraint.isValid( 20, null ) );
-		assertFalse( constraint.isValid( bWrapper, null ) );
-		assertFalse( constraint.isValid( BigDecimal.valueOf( 156000000000.0 ), null ) );
-		assertFalse( constraint.isValid( BigInteger.valueOf( 10000000l ), null ) );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/MaxValidatorForStringTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/MaxValidatorForStringTest.java
deleted file mode 100644
index f2b1705..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/MaxValidatorForStringTest.java
+++ /dev/null
@@ -1,92 +0,0 @@
-// $Id: MaxValidatorForStringTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints.impl;
-
-import javax.validation.ConstraintValidator;
-import javax.validation.constraints.DecimalMax;
-import javax.validation.constraints.Max;
-
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-import org.testng.annotations.Test;
-
-import org.hibernate.validator.util.annotationfactory.AnnotationDescriptor;
-import org.hibernate.validator.util.annotationfactory.AnnotationFactory;
-
-/**
- * @author Hardy Ferentschik
- */
-public class MaxValidatorForStringTest {
-
-	@Test
-	public void testIsValidMax() {
-
-		AnnotationDescriptor<Max> descriptor = new AnnotationDescriptor<Max>( Max.class );
-		descriptor.setValue( "value", 15l );
-		descriptor.setValue( "message", "{validator.max}" );
-		Max m = AnnotationFactory.create( descriptor );
-
-		MaxValidatorForString constraint = new MaxValidatorForString();
-		constraint.initialize( m );
-		testMaxValidator( constraint );
-	}
-
-	@Test
-	public void testIsValidDecimalMax() {
-
-		AnnotationDescriptor<DecimalMax> descriptor = new AnnotationDescriptor<DecimalMax>( DecimalMax.class );
-		descriptor.setValue( "value", "15.0E0" );
-		descriptor.setValue( "message", "{validator.max}" );
-		DecimalMax m = AnnotationFactory.create( descriptor );
-
-		DecimalMaxValidatorForString constraint = new DecimalMaxValidatorForString();
-		constraint.initialize( m );
-		testMaxValidator( constraint );
-	}
-
-	@Test
-	public void testInitializeDecimalMaxWithInvalidValue() {
-
-		AnnotationDescriptor<DecimalMax> descriptor = new AnnotationDescriptor<DecimalMax>( DecimalMax.class );
-		descriptor.setValue( "value", "foobar" );
-		descriptor.setValue( "message", "{validator.max}" );
-		DecimalMax m = AnnotationFactory.create( descriptor );
-
-		DecimalMaxValidatorForNumber constraint = new DecimalMaxValidatorForNumber();
-		try {
-			constraint.initialize( m );
-			fail();
-		}
-		catch ( IllegalArgumentException e ) {
-			// success
-		}
-	}
-
-	private void testMaxValidator(ConstraintValidator<?, String> constraint) {
-		assertTrue( constraint.isValid( null, null ) );
-		assertTrue( constraint.isValid( "15", null ) );
-		assertTrue( constraint.isValid( "15.0", null ) );
-		assertTrue( constraint.isValid( "10", null ) );
-		assertTrue( constraint.isValid( "14.99", null ) );
-		assertTrue( constraint.isValid( "-14.99", null ) );
-		assertFalse( constraint.isValid( "20", null ) );
-		//number format exception
-		assertFalse( constraint.isValid( "15l", null ) );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/MinValidatorForNumberTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/MinValidatorForNumberTest.java
deleted file mode 100644
index 7aa9024..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/MinValidatorForNumberTest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-// $Id: MinValidatorForNumberTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints.impl;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import javax.validation.ConstraintValidator;
-import javax.validation.constraints.DecimalMin;
-import javax.validation.constraints.Min;
-
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-import org.testng.annotations.Test;
-
-import org.hibernate.validator.util.annotationfactory.AnnotationDescriptor;
-import org.hibernate.validator.util.annotationfactory.AnnotationFactory;
-
-/**
- * @author Alaa Nassef
- * @author Hardy Ferentschik
- */
-public class MinValidatorForNumberTest {
-
-	@Test
-	public void testIsValidMinValidator() {
-		AnnotationDescriptor<Min> descriptor = new AnnotationDescriptor<Min>( Min.class );
-		descriptor.setValue( "value", 15l );
-		descriptor.setValue( "message", "{validator.min}" );
-		Min m = AnnotationFactory.create( descriptor );
-
-		MinValidatorForNumber constraint = new MinValidatorForNumber();
-		constraint.initialize( m );
-		testMinValidator( constraint );
-	}
-
-	@Test
-	public void testIsValidDecimalMinValidator() {
-		AnnotationDescriptor<DecimalMin> descriptor = new AnnotationDescriptor<DecimalMin>( DecimalMin.class );
-		descriptor.setValue( "value", "1500E-2" );
-		descriptor.setValue( "message", "{validator.min}" );
-		DecimalMin m = AnnotationFactory.create( descriptor );
-
-		DecimalMinValidatorForNumber constraint = new DecimalMinValidatorForNumber();
-		constraint.initialize( m );
-		testMinValidator( constraint );
-	}
-
-	@Test
-	public void testInitializeDecimalMaxWithInvalidValue() {
-
-		AnnotationDescriptor<DecimalMin> descriptor = new AnnotationDescriptor<DecimalMin>( DecimalMin.class );
-		descriptor.setValue( "value", "foobar" );
-		descriptor.setValue( "message", "{validator.min}" );
-		DecimalMin m = AnnotationFactory.create( descriptor );
-
-		DecimalMinValidatorForNumber constraint = new DecimalMinValidatorForNumber();
-		try {
-			constraint.initialize( m );
-			fail();
-		}
-		catch ( IllegalArgumentException e ) {
-			// success
-		}
-	}
-
-	private void testMinValidator(ConstraintValidator<?, Number> constraint) {
-		byte b = 1;
-		Byte bWrapper = 127;
-		assertTrue( constraint.isValid( null, null ) );
-		assertTrue( constraint.isValid( bWrapper, null ) );
-		assertTrue( constraint.isValid( 20, null ) );
-		assertTrue( constraint.isValid( 15l, null ) );
-		assertTrue( constraint.isValid( 15, null ) );
-		assertTrue( constraint.isValid( 15.0, null ) );
-		assertTrue( constraint.isValid( BigDecimal.valueOf( 156000000000.0 ), null ) );
-		assertTrue( constraint.isValid( BigInteger.valueOf( 10000000l ), null ) );
-		assertFalse( constraint.isValid( b, null ) );
-		assertFalse( constraint.isValid( BigDecimal.valueOf( -156000000000.0 ), null ) );
-		assertFalse( constraint.isValid( BigInteger.valueOf( -10000000l ), null ) );
-		assertFalse( constraint.isValid( 10, null ) );
-		assertFalse( constraint.isValid( 14.99, null ) );
-		assertFalse( constraint.isValid( -14.99, null ) );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/MinValidatorForStringTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/MinValidatorForStringTest.java
deleted file mode 100644
index 8629050..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/MinValidatorForStringTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-// $Id: MinValidatorForStringTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints.impl;
-
-import javax.validation.ConstraintValidator;
-import javax.validation.constraints.DecimalMin;
-import javax.validation.constraints.Min;
-
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-import org.testng.annotations.Test;
-
-import org.hibernate.validator.util.annotationfactory.AnnotationDescriptor;
-import org.hibernate.validator.util.annotationfactory.AnnotationFactory;
-
-/**
- * @author Alaa Nassef
- * @author Hardy Ferentschik
- */
-public class MinValidatorForStringTest {
-
-	@Test
-	public void testIsValidMinValidator() {
-		AnnotationDescriptor<Min> descriptor = new AnnotationDescriptor<Min>( Min.class );
-		descriptor.setValue( "value", 15l );
-		descriptor.setValue( "message", "{validator.min}" );
-		Min m = AnnotationFactory.create( descriptor );
-
-		MinValidatorForString constraint = new MinValidatorForString();
-		constraint.initialize( m );
-		testMinValidator( constraint );
-	}
-
-	@Test
-	public void testIsValidDecimalMinValidator() {
-		AnnotationDescriptor<DecimalMin> descriptor = new AnnotationDescriptor<DecimalMin>( DecimalMin.class );
-		descriptor.setValue( "value", "1500E-2" );
-		descriptor.setValue( "message", "{validator.min}" );
-		DecimalMin m = AnnotationFactory.create( descriptor );
-
-		DecimalMinValidatorForString constraint = new DecimalMinValidatorForString();
-		constraint.initialize( m );
-		testMinValidator( constraint );
-	}
-
-	@Test
-	public void testInitializeDecimalMaxWithInvalidValue() {
-
-		AnnotationDescriptor<DecimalMin> descriptor = new AnnotationDescriptor<DecimalMin>( DecimalMin.class );
-		descriptor.setValue( "value", "foobar" );
-		descriptor.setValue( "message", "{validator.min}" );
-		DecimalMin m = AnnotationFactory.create( descriptor );
-
-		DecimalMinValidatorForNumber constraint = new DecimalMinValidatorForNumber();
-		try {
-			constraint.initialize( m );
-			fail();
-		}
-		catch ( IllegalArgumentException e ) {
-			// success
-		}
-	}
-
-	private void testMinValidator(ConstraintValidator<?, String> constraint) {
-		assertTrue( constraint.isValid( null, null ) );
-		assertTrue( constraint.isValid( "20", null ) );
-		assertTrue( constraint.isValid( "15", null ) );
-		assertTrue( constraint.isValid( "15.0", null ) );
-		assertFalse( constraint.isValid( "10", null ) );
-		assertFalse( constraint.isValid( "14.99", null ) );
-		assertFalse( constraint.isValid( "-14.99", null ) );
-		//number format exception
-		assertFalse( constraint.isValid( "15l", null ) );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/NotNullValidatorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/NotNullValidatorTest.java
deleted file mode 100644
index 7d8e27f..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/NotNullValidatorTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-// $Id: NotNullValidatorTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints.impl;
-
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-
-/**
- * @author Hardy Ferentschik
- */
-public class NotNullValidatorTest {
-
-	@Test
-	public void testIsValid() {
-		NotNullValidator constraint = new NotNullValidator();
-
-		assertFalse( constraint.isValid( null, null ) );
-		assertTrue( constraint.isValid( new Object(), null ) );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/NullValidatorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/NullValidatorTest.java
deleted file mode 100644
index a24d790..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/NullValidatorTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-// $Id: NullValidatorTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints.impl;
-
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/**
- * @author Alaa Nassef
- */
-public class NullValidatorTest {
-
-	private static NullValidator constraint;
-
-	@BeforeClass
-	public static void init() {
-		constraint = new NullValidator();
-	}
-
-	@Test
-	public void testIsValid() {
-		assertTrue( constraint.isValid( null, null ) );
-		assertFalse( constraint.isValid( new Object(), null ) );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/PastValidatorForCalendarTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/PastValidatorForCalendarTest.java
deleted file mode 100644
index 2640091..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/PastValidatorForCalendarTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-// $Id: PastValidatorForCalendarTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints.impl;
-
-import java.util.Calendar;
-
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import org.hibernate.validator.constraints.impl.PastValidatorForCalendar;
-
-/**
- * @author Alaa Nassef
- * @author Hardy Ferentschik
- */
-public class PastValidatorForCalendarTest {
-
-	private static PastValidatorForCalendar constraint;
-
-	@BeforeClass
-	public static void init() {
-		constraint = new PastValidatorForCalendar();
-	}
-
-	@Test
-	public void testIsValid() {
-		Calendar futureDate = getFutureDate();
-		Calendar pastDate = getPastDate();
-		assertTrue( constraint.isValid( null, null ) );
-		assertTrue( constraint.isValid( pastDate, null ) );
-		assertFalse( constraint.isValid( futureDate, null ) );
-	}
-
-	private Calendar getFutureDate() {
-		Calendar cal = Calendar.getInstance();
-		int year = cal.get( Calendar.YEAR );
-		cal.set( Calendar.YEAR, year + 1 );
-		return cal;
-	}
-
-	private Calendar getPastDate() {
-		Calendar cal = Calendar.getInstance();
-		int year = cal.get( Calendar.YEAR );
-		cal.set( Calendar.YEAR, year - 1 );
-		return cal;
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/PastValidatorForDateTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/PastValidatorForDateTest.java
deleted file mode 100644
index 155ca64..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/PastValidatorForDateTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-// $Id: PastValidatorForDateTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints.impl;
-
-import java.util.Date;
-
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-public class PastValidatorForDateTest {
-
-	private static PastValidatorForDate constraint;
-
-	@BeforeClass
-	public static void init() {
-		constraint = new PastValidatorForDate();
-	}
-
-	@Test
-	public void testIsValid() {
-		Date futureDate = getFutureDate();
-		Date pastDate = getPastDate();
-		assertTrue( constraint.isValid( null, null ) );
-		assertTrue( constraint.isValid( pastDate, null ) );
-		assertFalse( constraint.isValid( new Date(), null ) );
-		assertFalse( constraint.isValid( futureDate, null ) );
-	}
-
-	private Date getFutureDate() {
-		Date date = new Date();
-		long timeStamp = date.getTime();
-		date.setTime( timeStamp + 31557600000l );
-		return date;
-	}
-
-	private Date getPastDate() {
-		Date date = new Date();
-		long timeStamp = date.getTime();
-		date.setTime( timeStamp - 31557600000l );
-		return date;
-	}
-
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/PatternValidatorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/PatternValidatorTest.java
deleted file mode 100644
index 0a7c619..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/PatternValidatorTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-// $Id: PatternValidatorTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.constraints.impl;
-
-import javax.validation.constraints.Pattern;
-
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-
-import org.hibernate.validator.util.annotationfactory.AnnotationDescriptor;
-import org.hibernate.validator.util.annotationfactory.AnnotationFactory;
-
-/**
- * @author Hardy Ferentschik
- */
-public class PatternValidatorTest {
-
-	@Test
-	public void testIsValid() {
-		AnnotationDescriptor<Pattern> descriptor = new AnnotationDescriptor<Pattern>( Pattern.class );
-		descriptor.setValue( "regexp", "foobar" );
-		descriptor.setValue( "message", "pattern does not match" );
-		Pattern p = AnnotationFactory.create( descriptor );
-
-		PatternValidator constraint = new PatternValidator();
-		constraint.initialize( p );
-
-		assertTrue( constraint.isValid( null, null ) );
-		assertFalse( constraint.isValid( "", null ) );
-		assertFalse( constraint.isValid( "bla bla", null ) );
-		assertFalse( constraint.isValid( "This test is not foobar", null ) );
-	}
-
-	@Test
-	public void testIsValidForEmptyStringRegexp() {
-		AnnotationDescriptor<Pattern> descriptor = new AnnotationDescriptor<Pattern>( Pattern.class );
-		descriptor.setValue( "regexp", "|^.*foo$" );
-		descriptor.setValue( "message", "pattern does not match" );
-		Pattern p = AnnotationFactory.create( descriptor );
-
-		PatternValidator constraint = new PatternValidator();
-		constraint.initialize( p );
-
-		assertTrue( constraint.isValid( null, null ) );
-		assertTrue( constraint.isValid( "", null ) );
-		assertFalse( constraint.isValid( "bla bla", null ) );
-		assertTrue( constraint.isValid( "foo", null ) );
-		assertTrue( constraint.isValid( "a b c foo", null ) );
-	}
-
-	@Test(expectedExceptions = IllegalArgumentException.class)
-	public void testInvalidRegularExpression() {
-		AnnotationDescriptor<Pattern> descriptor = new AnnotationDescriptor<Pattern>( Pattern.class );
-		descriptor.setValue( "regexp", "(unbalanced parentheses" );
-		descriptor.setValue( "message", "pattern does not match" );
-		Pattern p = AnnotationFactory.create( descriptor );
-
-		PatternValidator constraint = new PatternValidator();
-		constraint.initialize( p );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/SizeValidatorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/SizeValidatorTest.java
deleted file mode 100644
index a012c24..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/constraints/impl/SizeValidatorTest.java
+++ /dev/null
@@ -1,172 +0,0 @@
-// $Id: SizeValidatorTest.java 17747 2009-10-14 17:06:14Z hardy.ferentschik $
-/*
-* 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.constraints.impl;
-
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import javax.validation.ConstraintValidator;
-import javax.validation.constraints.Size;
-
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.assertFalse;
-import org.testng.annotations.Test;
-
-import org.hibernate.validator.util.annotationfactory.AnnotationDescriptor;
-import org.hibernate.validator.util.annotationfactory.AnnotationFactory;
-
-/**
- * @author Alaa Nassef
- */
-public class SizeValidatorTest {
-
-
-	@Test
-	public void testIsValidObjectArray() throws Exception {
-		ConstraintValidator<Size, Object[]> validator = getValidator( SizeValidatorForArray.class );
-		assertSizes( validator, Object[].class );
-	}
-
-	@Test
-	public void testIsValidBooleanArray() throws Exception {
-		ConstraintValidator<Size, boolean[]> validator = getValidator( SizeValidatorForArraysOfBoolean.class );
-		assertSizes( validator, boolean[].class );
-	}
-
-	@Test
-	public void testIsValidByteArray() throws Exception {
-		ConstraintValidator<Size, byte[]> validator = getValidator( SizeValidatorForArraysOfByte.class );
-		assertSizes( validator, byte[].class );
-	}
-
-	@Test
-	public void testIsValidCharArray() throws Exception {
-		ConstraintValidator<Size, char[]> validator = getValidator( SizeValidatorForArraysOfChar.class );
-		assertSizes( validator, char[].class );
-	}
-
-	@Test
-	public void testIsValidDoubleArray() throws Exception {
-		ConstraintValidator<Size, double[]> validator = getValidator( SizeValidatorForArraysOfDouble.class );
-		assertSizes( validator, double[].class );
-	}
-
-	@Test
-	public void testIsValidFloatArray() throws Exception {
-		ConstraintValidator<Size, float[]> validator = getValidator( SizeValidatorForArraysOfFloat.class );
-		assertSizes( validator, float[].class );
-	}
-
-	@Test
-	public void testIsValidIntArray() throws Exception {
-		ConstraintValidator<Size, int[]> validator = getValidator( SizeValidatorForArraysOfInt.class );
-		assertSizes( validator, int[].class );
-	}
-
-	@Test
-	public void testIsValidLongArray() throws Exception {
-		ConstraintValidator<Size, long[]> validator = getValidator( SizeValidatorForArraysOfLong.class );
-		assertSizes( validator, long[].class );
-	}
-
-	@Test
-	public void testIsValidShortArray() throws Exception {
-		ConstraintValidator<Size, short[]> validator = getValidator( SizeValidatorForArraysOfShort.class );
-		assertSizes( validator, short[].class );
-	}
-
-	@Test
-	public void testIsValidCollection() throws Exception {
-		ConstraintValidator<Size, Collection> validator = getValidator( SizeValidatorForCollection.class );
-
-		assertTrue( validator.isValid( null, null ) );
-
-		Collection<String> collection = new ArrayList<String>();
-		assertFalse( validator.isValid( collection, null ) );
-
-		collection.add( "firstItem" );
-		assertTrue( validator.isValid( collection, null ) );
-
-		collection.add( "secondItem" );
-		assertTrue( validator.isValid( collection, null ) );
-
-		collection.add( "thirdItem" );
-		assertFalse( validator.isValid( collection, null ) );
-	}
-
-	@Test
-	public void testIsValidMap() throws Exception {
-		ConstraintValidator<Size, Map> validator = getValidator( SizeValidatorForMap.class );
-
-		assertTrue( validator.isValid( null, null ) );
-
-		Map<String, String> map = new HashMap<String, String>();
-		assertFalse( validator.isValid( map, null ) );
-
-		map.put( "key1", "firstItem" );
-		assertTrue( validator.isValid( map, null ) );
-
-		map.put( "key3", "secondItem" );
-		assertTrue( validator.isValid( map, null ) );
-
-		map.put( "key2", "thirdItem" );
-		assertFalse( validator.isValid( map, null ) );
-	}
-
-	@Test
-	public void testIsValiString() throws Exception {
-		ConstraintValidator<Size, String> validator = getValidator( SizeValidatorForString.class );
-
-		assertTrue( validator.isValid( null, null ) );
-		assertFalse( validator.isValid( "", null ) );
-		assertTrue( validator.isValid( "a", null ) );
-		assertTrue( validator.isValid( "ab", null ) );
-		assertFalse( validator.isValid( "abc", null ) );
-	}
-
-	private <T> ConstraintValidator<Size, T> getValidator(Class<?> validatorClass) throws Exception {
-		AnnotationDescriptor<Size> descriptor = new AnnotationDescriptor<Size>( Size.class );
-		descriptor.setValue( "min", 1 );
-		descriptor.setValue( "max", 2 );
-		descriptor.setValue( "message", "{validator.max}" );
-		Size m = AnnotationFactory.create( descriptor );
-		@SuppressWarnings("unchecked")
-		ConstraintValidator<Size, T> validator = ( ConstraintValidator<Size, T> ) validatorClass.newInstance();
-		validator.initialize( m );
-		return validator;
-	}
-
-	@SuppressWarnings("unchecked")
-	private <T> void assertSizes(ConstraintValidator<Size, T> validator, Class<T> arrayType) {
-		assertTrue( validator.isValid( null, null ) );
-
-		T array = ( T ) Array.newInstance( arrayType.getComponentType(), 0 );
-		assertFalse( validator.isValid( array, null ) );
-
-		array = ( T ) Array.newInstance( arrayType.getComponentType(), 1 );
-		assertTrue( validator.isValid( array, null ) );
-
-		array = ( T ) Array.newInstance( arrayType.getComponentType(), 2 );
-		assertTrue( validator.isValid( array, null ) );
-
-		array = ( T ) Array.newInstance( arrayType.getComponentType(), 3 );
-		assertFalse( validator.isValid( array, null ) );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/engine/PathImplTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/engine/PathImplTest.java
deleted file mode 100644
index 90f9628..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/engine/PathImplTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-// $Id: PathImplTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.engine;
-
-import java.util.Iterator;
-import javax.validation.Path;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-
-/**
- * @author Hardy Ferentschik
- */
-public class PathImplTest {
-
-	@Test
-	public void testParsing() {
-		String property = "order[3].deliveryAddress.addressline[1]";
-		Path path = PathImpl.createPathFromString( property );
-		Iterator<Path.Node> propIter = path.iterator();
-
-		assertTrue( propIter.hasNext() );
-		Path.Node elem = propIter.next();
-		assertEquals( "order", elem.getName() );
-		assertTrue( elem.isInIterable() );
-		assertEquals( new Integer( 3 ), elem.getIndex() );
-
-		assertTrue( propIter.hasNext() );
-		elem = propIter.next();
-		assertEquals( "deliveryAddress", elem.getName() );
-		assertFalse( elem.isInIterable() );
-		assertEquals( null, elem.getIndex() );
-
-		assertTrue( propIter.hasNext() );
-		elem = propIter.next();
-		assertEquals( "addressline", elem.getName() );
-		assertTrue( elem.isInIterable() );
-		assertEquals( new Integer( 1 ), elem.getIndex() );
-
-		assertFalse( propIter.hasNext() );
-	}
-
-	@Test
-	public void testParseMapBasedProperty() {
-		String property = "order[foo].deliveryAddress";
-		Path path = PathImpl.createPathFromString( property );
-		Iterator<Path.Node> propIter = path.iterator();
-
-		assertTrue( propIter.hasNext() );
-		Path.Node elem = propIter.next();
-		assertEquals( "order", elem.getName() );
-		assertTrue( elem.isInIterable() );
-		assertEquals( "foo", elem.getKey() );
-
-		assertTrue( propIter.hasNext() );
-		elem = propIter.next();
-		assertEquals( "deliveryAddress", elem.getName() );
-		assertFalse( elem.isInIterable() );
-		assertEquals( null, elem.getIndex() );
-
-		assertFalse( propIter.hasNext() );
-	}
-
-	@Test(expectedExceptions = IllegalArgumentException.class)
-	public void testNull() {
-		PathImpl.createPathFromString( null );
-	}
-
-	@Test(expectedExceptions = IllegalArgumentException.class)
-	public void testUnbalancedBraces() {
-		PathImpl.createPathFromString( "foo[.bar" );
-	}
-
-	@Test(expectedExceptions = IllegalArgumentException.class)
-	public void testIndexInMiddleOfProperty() {
-		PathImpl.createPathFromString( "f[1]oo.bar" );
-	}
-
-	@Test(expectedExceptions = IllegalArgumentException.class)
-	public void testTrailingPathSeperator() {
-		PathImpl.createPathFromString( "foo.bar." );
-	}
-
-	@Test(expectedExceptions = IllegalArgumentException.class)
-	public void testLeadingPathSeperator() {
-		PathImpl.createPathFromString( ".foo.bar" );
-	}
-
-	@Test
-	public void testEmptyString() {
-		Path path = PathImpl.createPathFromString( "" );
-		assertTrue( path.iterator().hasNext() );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/engine/ValidatorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/engine/ValidatorTest.java
deleted file mode 100644
index 2bb1ed4..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/engine/ValidatorTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-// $Id: ValidatorTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.engine;
-
-import java.util.Set;
-import javax.validation.ConstraintViolation;
-import javax.validation.Validator;
-import javax.validation.constraints.AssertTrue;
-import javax.validation.constraints.NotNull;
-import javax.validation.metadata.BeanDescriptor;
-
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-
-import org.hibernate.validator.util.TestUtil;
-import static org.hibernate.validator.util.TestUtil.assertCorrectPropertyPaths;
-import static org.hibernate.validator.util.TestUtil.assertNumberOfViolations;
-
-/**
- * @author Hardy Ferentschik
- */
-public class ValidatorTest {
-
-	/**
-	 * HV-208
-	 */
-	@Test
-	public void testPropertyPathDoesNotStartWithLeadingDot() {
-		Validator validator = TestUtil.getValidator();
-		A testInstance = new A();
-		Set<ConstraintViolation<A>> constraintViolations = validator.validate( testInstance );
-		assertNumberOfViolations( constraintViolations, 1 );
-		assertCorrectPropertyPaths( constraintViolations, "b" );
-	}
-
-	/**
-	 * HV-132 - supper hasBoolean format
-	 */
-	@Test
-	public void testHasBoolean() {
-		Validator validator = TestUtil.getValidator();
-		BeanDescriptor beanDescr = validator.getConstraintsForClass( B.class );
-		assertTrue( beanDescr.isBeanConstrained() );
-	}
-
-	class A {
-		@NotNull
-		String b;
-	}
-
-	class B {
-		private boolean b;
-
-		@AssertTrue
-		public boolean hasB() {
-			return b;
-		}
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/Address.java b/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/Address.java
deleted file mode 100644
index e344424..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/Address.java
+++ /dev/null
@@ -1,81 +0,0 @@
-// $Id: Address.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.engine.groups;
-
-import javax.validation.GroupSequence;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-import javax.validation.groups.Default;
-
-/**
- * @author Emmanuel Bernard
- */
- at GroupSequence({ Address.class, Address.HighLevelCoherence.class })
- at ZipCodeCoherenceChecker(groups = Address.HighLevelCoherence.class)
-public class Address {
-	@NotNull
-	@Size(max = 50)
-	private String street;
-
-	@NotNull
-	@Size(max = 5)
-	private String zipcode;
-
-	@NotNull
-	@Size(max = 30)
-	private String city;
-
-	public String getStreet() {
-		return street;
-	}
-
-	public void setStreet(String street) {
-		this.street = street;
-	}
-
-	public String getZipcode() {
-		return zipcode;
-	}
-
-	public void setZipcode(String zipcode) {
-		this.zipcode = zipcode;
-	}
-
-	public String getCity() {
-		return city;
-	}
-
-	public void setCity(String city) {
-		this.city = city;
-	}
-
-	/**
-	 * Check conherence on the overall object
-	 * Needs basic checking to be green first
-	 */
-	public interface HighLevelCoherence {
-	}
-
-	/**
-	 * Check both basic constraints and high level ones.
-	 * High level constraints are not checked if basic constraints fail.
-	 */
-	@GroupSequence(value = { Default.class, HighLevelCoherence.class })
-	public interface Complete {
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/CyclicGroupSequence.java b/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/CyclicGroupSequence.java
deleted file mode 100644
index 99cbaf8..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/CyclicGroupSequence.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// $Id: CyclicGroupSequence.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.engine.groups;
-
-import javax.validation.GroupSequence;
-
-/**
- * @author Hardy Ferentschik
- */
- at GroupSequence(value = CyclicGroupSequence.class)
-public interface CyclicGroupSequence {
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/CyclicGroupSequence1.java b/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/CyclicGroupSequence1.java
deleted file mode 100644
index d9a5dc8..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/CyclicGroupSequence1.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// $Id: CyclicGroupSequence1.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.engine.groups;
-
-import javax.validation.GroupSequence;
-
-/**
- * @author Hardy Ferentschik
- */
- at GroupSequence(value = CyclicGroupSequence2.class)
-public interface CyclicGroupSequence1 {
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/CyclicGroupSequence2.java b/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/CyclicGroupSequence2.java
deleted file mode 100644
index 6e1e6b0..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/CyclicGroupSequence2.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// $Id: CyclicGroupSequence2.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.engine.groups;
-
-import javax.validation.GroupSequence;
-
-/**
- * @author Hardy Ferentschik
- */
- at GroupSequence(value = CyclicGroupSequence1.class)
-public interface CyclicGroupSequence2 {
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/First.java b/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/First.java
deleted file mode 100644
index 75e296b..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/First.java
+++ /dev/null
@@ -1,26 +0,0 @@
-// $Id: First.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.engine.groups;
-
-/**
- * Group executed first in the validation
- *
- * @author Emmanuel Bernard
- */
-public interface First {
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/GroupChainGeneratorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/GroupChainGeneratorTest.java
deleted file mode 100644
index c8bfe0d..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/GroupChainGeneratorTest.java
+++ /dev/null
@@ -1,121 +0,0 @@
-// $Id: GroupChainGeneratorTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.engine.groups;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import javax.validation.ValidationException;
-import javax.validation.groups.Default;
-
-import static org.testng.Assert.assertEquals;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Test;
-
-/**
- * @author Hardy Ferentschik
- */
-public class GroupChainGeneratorTest {
-
-	GroupChainGenerator generator;
-
-	@BeforeTest
-	public void init() {
-		generator = new GroupChainGenerator();
-	}
-
-	@Test(expectedExceptions = ValidationException.class)
-	public void testGroupChainForNonInterface() {
-		Set<Class<?>> groups = new HashSet<Class<?>>();
-		groups.add( String.class );
-		generator.getGroupChainFor( groups );
-	}
-
-	@Test(expectedExceptions = IllegalArgumentException.class)
-	public void testGroupChainForNull() {
-		generator.getGroupChainFor( null );
-	}
-
-	@Test(expectedExceptions = IllegalArgumentException.class)
-	public void testGroupChainForEmptySet() {
-		generator.getGroupChainFor( new HashSet<Class<?>>() );
-	}
-
-	@Test(expectedExceptions = ValidationException.class)
-	public void testCyclicGroupSequences() {
-		Set<Class<?>> groups = new HashSet<Class<?>>();
-		groups.add( CyclicGroupSequence1.class );
-		generator.getGroupChainFor( groups );
-	}
-
-	@Test(expectedExceptions = ValidationException.class)
-	public void testCyclicGroupSequence() {
-		Set<Class<?>> groups = new HashSet<Class<?>>();
-		groups.add( CyclicGroupSequence.class );
-		generator.getGroupChainFor( groups );
-	}
-
-	@Test
-	public void testGroupDuplicates() {
-		Set<Class<?>> groups = new HashSet<Class<?>>();
-		groups.add( First.class );
-		groups.add( Second.class );
-		groups.add( Last.class );
-		GroupChain chain = generator.getGroupChainFor( groups );
-		int count = countGroups( chain );
-		assertEquals( count, 3, "Wrong number of groups" );
-
-		groups.clear();
-		groups.add( First.class );
-		groups.add( First.class );
-		chain = generator.getGroupChainFor( groups );
-		count = countGroups( chain );
-		assertEquals( count, 1, "Wrong number of groups" );
-
-		groups.clear();
-		groups.add( First.class );
-		groups.add( Last.class );
-		groups.add( First.class );
-		chain = generator.getGroupChainFor( groups );
-		count = countGroups( chain );
-		assertEquals( count, 2, "Wrong number of groups" );
-	}
-
-	private int countGroups(GroupChain chain) {
-		Iterator<Group> groupIterator = chain.getGroupIterator();
-		int count = 0;
-		while ( groupIterator.hasNext() ) {
-			groupIterator.next();
-			count++;
-		}
-		return count;
-	}
-
-	@Test
-	public void testSequenceResolution() {
-		Set<Class<?>> groups = new HashSet<Class<?>>();
-		groups.add( Address.Complete.class );
-		GroupChain chain = generator.getGroupChainFor( groups );
-		Iterator<List<Group>> sequences = chain.getSequenceIterator();
-		List<Group> sequence = sequences.next();
-
-		assertEquals( sequence.get( 0 ).getGroup(), Default.class, "Wrong group" );
-		assertEquals( sequence.get( 1 ).getGroup(), Address.HighLevelCoherence.class, "Wrong group" );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/GroupChainTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/GroupChainTest.java
deleted file mode 100644
index b33ce60..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/GroupChainTest.java
+++ /dev/null
@@ -1,162 +0,0 @@
-// $Id: GroupChainTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.engine.groups;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.validation.GroupDefinitionException;
-import javax.validation.groups.Default;
-
-import static org.testng.FileAssert.fail;
-import org.testng.annotations.Test;
-
-
-/**
- * @author Hardy Ferentschik
- */
-public class GroupChainTest {
-	@Test
-	public void testAssertDefaultGroupSequenceIsExpandableWithDefaultAtEndOfSequence() {
-		// create a dummy sequence
-		Group a = new Group( GroupA.class, TestSequence.class );
-		Group b = new Group( GroupB.class, TestSequence.class );
-		Group c = new Group( GroupC.class, TestSequence.class );
-		Group defaultGroup = new Group(
-				Default.class, TestSequence.class
-		);
-		List<Group> sequence = new ArrayList<Group>();
-		sequence.add( a );
-		sequence.add( b );
-		sequence.add( c );
-		sequence.add( defaultGroup );
-
-		GroupChain chain = new GroupChain();
-		chain.insertSequence( sequence );
-
-		// create test default sequence
-		List<Class<?>> defaultSequence = new ArrayList<Class<?>>();
-		defaultSequence.add( Default.class );
-		defaultSequence.add( GroupA.class );
-		try {
-			chain.assertDefaultGroupSequenceIsExpandable( defaultSequence );
-			fail();
-		}
-		catch ( GroupDefinitionException e ) {
-			// success
-		}
-
-		defaultSequence.clear();
-		defaultSequence.add( GroupA.class );
-		defaultSequence.add( Default.class );
-		try {
-			chain.assertDefaultGroupSequenceIsExpandable( defaultSequence );
-			fail();
-		}
-		catch ( GroupDefinitionException e ) {
-			// success
-		}
-
-		defaultSequence.clear();
-		defaultSequence.add( Default.class );
-		defaultSequence.add( GroupC.class );
-		try {
-			chain.assertDefaultGroupSequenceIsExpandable( defaultSequence );
-			fail();
-		}
-		catch ( GroupDefinitionException e ) {
-			// success
-		}
-
-		defaultSequence.clear();
-		defaultSequence.add( GroupC.class );
-		defaultSequence.add( Default.class );
-		chain.assertDefaultGroupSequenceIsExpandable( defaultSequence );
-	}
-
-
-	@Test
-	public void testAssertDefaulGroupSequenceIsExpandableWithDefaultAtBeginningOfSequence() {
-		// create a dummy sequence
-		Group a = new Group( GroupA.class, TestSequence.class );
-		Group b = new Group( GroupB.class, TestSequence.class );
-		Group c = new Group( GroupC.class, TestSequence.class );
-		Group defaultGroup = new Group(
-				Default.class, TestSequence.class
-		);
-		List<Group> sequence = new ArrayList<Group>();
-		sequence.add( defaultGroup );
-		sequence.add( a );
-		sequence.add( b );
-		sequence.add( c );
-
-		GroupChain chain = new GroupChain();
-		chain.insertSequence( sequence );
-
-		// create test default sequence
-		List<Class<?>> defaultSequence = new ArrayList<Class<?>>();
-		defaultSequence.add( Default.class );
-		defaultSequence.add( GroupA.class );
-		chain.assertDefaultGroupSequenceIsExpandable( defaultSequence );
-
-
-		defaultSequence.clear();
-		defaultSequence.add( GroupA.class );
-		defaultSequence.add( Default.class );
-		try {
-			chain.assertDefaultGroupSequenceIsExpandable( defaultSequence );
-			fail();
-		}
-		catch ( GroupDefinitionException e ) {
-			// success
-		}
-
-		defaultSequence.clear();
-		defaultSequence.add( Default.class );
-		defaultSequence.add( GroupC.class );
-		try {
-			chain.assertDefaultGroupSequenceIsExpandable( defaultSequence );
-			fail();
-		}
-		catch ( GroupDefinitionException e ) {
-			// success
-		}
-
-		defaultSequence.clear();
-		defaultSequence.add( GroupC.class );
-		defaultSequence.add( Default.class );
-		try {
-			chain.assertDefaultGroupSequenceIsExpandable( defaultSequence );
-			fail();
-		}
-		catch ( GroupDefinitionException e ) {
-			// success
-		}
-	}
-}
-
-interface TestSequence {
-}
-
-interface GroupA {
-}
-
-interface GroupB {
-}
-
-interface GroupC {
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/Last.java b/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/Last.java
deleted file mode 100644
index f91ef3b..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/Last.java
+++ /dev/null
@@ -1,26 +0,0 @@
-// $Id: Last.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.engine.groups;
-
-/**
- * Group executed Last in the validation
- *
- * @author Emmanuel Bernard
- */
-public interface Last {
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/Second.java b/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/Second.java
deleted file mode 100644
index 52a876e..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/Second.java
+++ /dev/null
@@ -1,26 +0,0 @@
-// $Id: Second.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.engine.groups;
-
-/**
- * Group executed second during the validation
- *
- * @author Emmanuel Bernard
- */
-public interface Second {
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/ZipCodeCoherenceChecker.java b/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/ZipCodeCoherenceChecker.java
deleted file mode 100644
index a3ef87a..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/ZipCodeCoherenceChecker.java
+++ /dev/null
@@ -1,39 +0,0 @@
-// $Id: ZipCodeCoherenceChecker.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.engine.groups;
-
-import java.lang.annotation.Documented;
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import static java.lang.annotation.ElementType.TYPE;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-import javax.validation.Constraint;
-
-/**
- * @author Emmanuel Bernard
- */
- at Target({ TYPE, ANNOTATION_TYPE })
- at Retention(RUNTIME)
- at Documented
- at Constraint(validatedBy = ZipCodeCoherenceValidator.class)
-public @interface ZipCodeCoherenceChecker {
-	public abstract String message() default "{validator.zipCodeCoherenceChecker}";
-
-	public abstract Class<?>[] groups() default { };
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/ZipCodeCoherenceValidator.java b/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/ZipCodeCoherenceValidator.java
deleted file mode 100644
index efdb2ea..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/engine/groups/ZipCodeCoherenceValidator.java
+++ /dev/null
@@ -1,34 +0,0 @@
-// $Id: ZipCodeCoherenceValidator.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.engine.groups;
-
-import javax.validation.ConstraintValidator;
-import javax.validation.ConstraintValidatorContext;
-
-/**
- * @author Hardy Ferentschik
- */
-public class ZipCodeCoherenceValidator implements ConstraintValidator<ZipCodeCoherenceChecker, Address> {
-
-	public void initialize(ZipCodeCoherenceChecker parameters) {
-	}
-
-	public boolean isValid(Address value, ConstraintValidatorContext constraintValidatorContext) {
-		return false;
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/engine/messageinterpolation/MessageInterpolationTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/engine/messageinterpolation/MessageInterpolationTest.java
deleted file mode 100644
index 16b3097..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/engine/messageinterpolation/MessageInterpolationTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-// $Id: MessageInterpolationTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.engine.messageinterpolation;
-
-import java.io.ByteArrayInputStream;
-import java.util.PropertyResourceBundle;
-import java.util.ResourceBundle;
-import javax.validation.Configuration;
-import javax.validation.ConstraintViolation;
-import javax.validation.Validation;
-import javax.validation.Validator;
-import javax.validation.ValidatorFactory;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-
-import static org.testng.Assert.assertEquals;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import org.hibernate.validator.engine.ResourceBundleMessageInterpolator;
-
-/**
- * Tests for HV-184
- *
- * @author Hardy Ferentschik
- */
-public class MessageInterpolationTest {
-	private Validator validator;
-
-	@BeforeClass
-	public void createValidator() throws Exception {
-		final StringBuilder lines = new StringBuilder();
-		lines.append( "bar=Message is \\\\{escaped\\\\}" ).append( "\r\n" );
-		lines.append( "baz=Message is US$ {value}" ).append( "\r\n" );
-		lines.append( "qux=Message is {missing}" ).append( "\r\n" );
-		lines.append( "escaped=wrong" ).append( "\r\n" );
-		final ResourceBundle bundle = new PropertyResourceBundle(
-				new ByteArrayInputStream( lines.toString().getBytes() )
-		);
-		Configuration<?> config = ( Configuration<?> ) Validation.byDefaultProvider()
-				.configure()
-				.messageInterpolator(
-						new ResourceBundleMessageInterpolator( bundle )
-				);
-
-		ValidatorFactory factory = config.buildValidatorFactory();
-		validator = factory.getValidator();
-	}
-
-	@Test
-	public void testCurlyBracesEscapingShouldBeRespected() {
-		final ConstraintViolation<Foo> violation = validator.validate( new Foo(), Bar.class ).iterator().next();
-		assertEquals( violation.getMessage(), "Message is {escaped}" );
-	}
-
-	@Test
-	public void testAppendReplacementNeedsToEscapeBackslashAndDollarSign() {
-		final ConstraintViolation<Foo> violation = validator.validate( new Foo(), Baz.class ).iterator().next();
-		assertEquals( violation.getMessage(), "Message is US$ 5" );
-	}
-
-	@Test
-	public void testUnknownParametersShouldBePreserved() {
-		final ConstraintViolation<Foo> violation = validator.validate( new Foo(), Qux.class ).iterator().next();
-		assertEquals( violation.getMessage(), "Message is {missing}" );
-	}
-
-	public static interface Bar {
-	}
-
-	public static interface Baz {
-	}
-
-	public static interface Qux {
-	}
-
-	public static class Foo {
-		@NotNull(message = "{bar}", groups = { Bar.class })
-		public String getBar() {
-			return null;
-		}
-
-		@Min(value = 5, message = "{baz}", groups = { Baz.class })
-		public int getBaz() {
-			return 0;
-		}
-
-
-		@NotNull(message = "{qux}", groups = { Qux.class })
-		public String getQux() {
-			return null;
-		}
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/engine/messageinterpolation/MessageInterpolationWithDefaultBundleTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/engine/messageinterpolation/MessageInterpolationWithDefaultBundleTest.java
deleted file mode 100644
index efa9c78..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/engine/messageinterpolation/MessageInterpolationWithDefaultBundleTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-// $Id:$
-/*
-* 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.engine.messageinterpolation;
-
-import java.util.Locale;
-import java.util.Set;
-import javax.validation.Configuration;
-import javax.validation.ConstraintViolation;
-import javax.validation.Validator;
-
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import org.hibernate.validator.engine.ResourceBundleMessageInterpolator;
-import org.hibernate.validator.util.TestUtil;
-import static org.hibernate.validator.util.TestUtil.assertCorrectConstraintViolationMessages;
-import static org.hibernate.validator.util.TestUtil.assertNumberOfViolations;
-
-/**
- * @author Hardy Ferentschik
- */
-public class MessageInterpolationWithDefaultBundleTest {
-	private Locale defaultLocale;
-
-	@BeforeClass
-	public void storeDefaultLocale() {
-		defaultLocale = Locale.getDefault();
-	}
-
-	@AfterClass
-	public void restoreDefaultLocale() {
-		Locale.setDefault( defaultLocale );
-	}
-
-	/**
-	 * HV-268
-	 */
-	@Test
-	public void testEmailAndRangeMessageEnglishLocale() {
-		Locale.setDefault( Locale.ENGLISH );
-		Configuration config = TestUtil.getConfiguration();
-		config.messageInterpolator( new ResourceBundleMessageInterpolator() );
-		Validator validator = config.buildValidatorFactory().getValidator();
-		User user = new User();
-		user.setEmail( "foo" );
-		user.setAge( 16 );
-		Set<ConstraintViolation<User>> constraintViolations = validator.validate( user );
-		assertNumberOfViolations( constraintViolations, 2 );
-		assertCorrectConstraintViolationMessages(
-				constraintViolations, "not a well-formed email address", "must be between 18 and 21"
-		);
-	}
-
-	/**
-	 * HV-268
-	 */
-	@Test
-	public void testEmailAndRangeMessageGermanLocale() {
-		Locale.setDefault( Locale.GERMAN );
-		Configuration config = TestUtil.getConfiguration();
-		config.messageInterpolator( new ResourceBundleMessageInterpolator() );
-		Validator validator = config.buildValidatorFactory().getValidator();
-		User user = new User();
-		user.setEmail( "foo" );
-		user.setAge( 16 );
-		Set<ConstraintViolation<User>> constraintViolations = validator.validate( user );
-		assertNumberOfViolations( constraintViolations, 2 );
-		assertCorrectConstraintViolationMessages(
-				constraintViolations, "keine g\u00FCltige E-Mail-Adresse", "muss zwischen 18 und 21 liegen"
-		);
-	}
-
-	/**
-	 * HV-268
-	 */
-	@Test
-	public void testEmailAndRangeMessageFrenchLocale() {
-		Locale.setDefault( Locale.FRENCH );
-		Configuration config = TestUtil.getConfiguration();
-		config.messageInterpolator( new ResourceBundleMessageInterpolator() );
-		Validator validator = config.buildValidatorFactory().getValidator();
-		User user = new User();
-		user.setEmail( "foo" );
-		user.setAge( 16 );
-		Set<ConstraintViolation<User>> constraintViolations = validator.validate( user );
-		assertNumberOfViolations( constraintViolations, 2 );
-		assertCorrectConstraintViolationMessages(
-				constraintViolations, "Address email mal form\u00E9e", "doit \u00EAtre entre 18 et 21"
-		);
-	}
-}
-
-
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/engine/messageinterpolation/ResourceBundleMessageInterpolatorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/engine/messageinterpolation/ResourceBundleMessageInterpolatorTest.java
deleted file mode 100644
index 9f26784..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/engine/messageinterpolation/ResourceBundleMessageInterpolatorTest.java
+++ /dev/null
@@ -1,286 +0,0 @@
-// $Id: ResourceBundleMessageInterpolatorTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.engine.messageinterpolation;
-
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.ResourceBundle;
-import javax.validation.MessageInterpolator;
-import javax.validation.constraints.Max;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-
-import static org.testng.Assert.assertEquals;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Test;
-
-import org.hibernate.validator.engine.MessageInterpolatorContext;
-import org.hibernate.validator.engine.ResourceBundleMessageInterpolator;
-import org.hibernate.validator.metadata.ConstraintDescriptorImpl;
-import org.hibernate.validator.metadata.ConstraintHelper;
-import org.hibernate.validator.metadata.ConstraintOrigin;
-import org.hibernate.validator.util.annotationfactory.AnnotationDescriptor;
-import org.hibernate.validator.util.annotationfactory.AnnotationFactory;
-
-/**
- * Tests for message interpolation.
- *
- * @author Hardy Ferentschik
- */
-public class ResourceBundleMessageInterpolatorTest {
-
-	private ResourceBundleMessageInterpolator interpolator;
-	private NotNull notNull;
-	private ConstraintDescriptorImpl<NotNull> notNullDescriptor;
-	private Size size;
-	private ConstraintDescriptorImpl<Size> sizeDescriptor;
-
-	@BeforeTest
-	public void setUp() {
-		// Create some annotations for testing using AnnotationProxies
-		AnnotationDescriptor<NotNull> descriptor = new AnnotationDescriptor<NotNull>( NotNull.class );
-		notNull = AnnotationFactory.create( descriptor );
-		notNullDescriptor = new ConstraintDescriptorImpl<NotNull>(
-				notNull,
-				new ConstraintHelper(),
-				java.lang.annotation.ElementType.FIELD,
-				ConstraintOrigin.DEFINED_LOCALLY
-		);
-
-		AnnotationDescriptor<Size> sizeAnnotationDescriptor = new AnnotationDescriptor<Size>( Size.class );
-		size = AnnotationFactory.create( sizeAnnotationDescriptor );
-		sizeDescriptor = new ConstraintDescriptorImpl<Size>(
-				size, new ConstraintHelper(), java.lang.annotation.ElementType.FIELD, ConstraintOrigin.DEFINED_LOCALLY
-		);
-	}
-
-	@Test
-	public void testSuccessfulInterpolation() {
-		interpolator = new ResourceBundleMessageInterpolator( new TestResourceBundle() );
-		MessageInterpolator.Context context = new MessageInterpolatorContext( notNullDescriptor, null );
-		String expected = "message interpolation successful";
-		String actual = interpolator.interpolate( "{simple.key}", context );
-		assertEquals( actual, expected, "Wrong substitution" );
-
-		expected = "message interpolation successful message interpolation successful";
-		actual = interpolator.interpolate( "{simple.key} {simple.key}", context );
-		assertEquals( actual, expected, "Wrong substitution" );
-
-		expected = "The message interpolation successful completed";
-		actual = interpolator.interpolate( "The {simple.key} completed", context );
-		assertEquals( actual, expected, "Wrong substitution" );
-
-		expected = "{{simple.key}}";
-		actual = interpolator.interpolate( "{{simple.key}}", context );
-		assertEquals( actual, expected, "Wrong substitution" );
-	}
-
-	@Test
-	public void testMessageLiterals() {
-
-		interpolator = new ResourceBundleMessageInterpolator( new TestResourceBundle() );
-		MessageInterpolator.Context context = new MessageInterpolatorContext( notNullDescriptor, null );
-
-		String expected = "{";
-		String actual = interpolator.interpolate( "\\{", context );
-		assertEquals( actual, expected, "Wrong substitution" );
-
-		expected = "}";
-		actual = interpolator.interpolate( "\\}", context );
-		assertEquals( actual, expected, "Wrong substitution" );
-
-		expected = "\\";
-		actual = interpolator.interpolate( "\\", context );
-		assertEquals( actual, expected, "Wrong substitution" );
-	}
-
-	@Test
-	public void testUnSuccessfulInterpolation() {
-		interpolator = new ResourceBundleMessageInterpolator( new TestResourceBundle() );
-		MessageInterpolator.Context context = new MessageInterpolatorContext( notNullDescriptor, null );
-
-		String expected = "foo";  // missing {}
-		String actual = interpolator.interpolate( "foo", context );
-		assertEquals( actual, expected, "Wrong substitution" );
-
-		expected = "#{foo  {}";
-		actual = interpolator.interpolate( "#{foo  {}", context );
-		assertEquals( actual, expected, "Wrong substitution" );
-	}
-
-	@Test
-	public void testUnknownTokenInterpolation() {
-		interpolator = new ResourceBundleMessageInterpolator( new TestResourceBundle() );
-		MessageInterpolator.Context context = new MessageInterpolatorContext( notNullDescriptor, null );
-
-		String expected = "{bar}";  // unknown token {}
-		String actual = interpolator.interpolate( "{bar}", context );
-		assertEquals( actual, expected, "Wrong substitution" );
-	}
-
-	@Test
-	public void testKeyWithDashes() {
-		interpolator = new ResourceBundleMessageInterpolator( new TestResourceBundle() );
-		MessageInterpolator.Context context = new MessageInterpolatorContext( notNullDescriptor, null );
-
-		String expected = "message interpolation successful";  // unknown token {}
-		String actual = interpolator.interpolate( "{key-with-dashes}", context );
-		assertEquals( actual, expected, "Wrong substitution" );
-	}
-
-	@Test
-	public void testKeyWithSpaces() {
-		interpolator = new ResourceBundleMessageInterpolator( new TestResourceBundle() );
-		MessageInterpolator.Context context = new MessageInterpolatorContext( notNullDescriptor, null );
-
-		String expected = "message interpolation successful";  // unknown token {}
-		String actual = interpolator.interpolate( "{key with spaces}", context );
-		assertEquals( actual, expected, "Wrong substitution" );
-	}
-
-	@Test
-	public void testDefaultInterpolation() {
-		interpolator = new ResourceBundleMessageInterpolator( new TestResourceBundle() );
-		MessageInterpolator.Context context = new MessageInterpolatorContext( notNullDescriptor, null );
-
-		String expected = "may not be null";
-		String actual = interpolator.interpolate( notNull.message(), context );
-		assertEquals( actual, expected, "Wrong substitution" );
-
-		expected = "size must be between 0 and 2147483647";  // unknown token {}
-		context = new MessageInterpolatorContext( sizeDescriptor, null );
-		actual = interpolator.interpolate( size.message(), context );
-		assertEquals( actual, expected, "Wrong substitution" );
-	}
-
-	@Test
-	public void testMessageInterpolationWithLocale() {
-		interpolator = new ResourceBundleMessageInterpolator();
-
-		String expected = "kann nicht null sein";
-		MessageInterpolator.Context context = new MessageInterpolatorContext( notNullDescriptor, null );
-		String actual = interpolator.interpolate( notNull.message(), context, Locale.GERMAN );
-		assertEquals( actual, expected, "Wrong substitution" );
-	}
-
-	@Test
-	public void testUserResourceBundle() {
-		interpolator = new ResourceBundleMessageInterpolator();
-		MessageInterpolator.Context context = new MessageInterpolatorContext( notNullDescriptor, null );
-
-		String expected = "no puede ser null";
-		String actual = interpolator.interpolate( notNull.message(), context, new Locale( "es", "ES" ) );
-		assertEquals( actual, expected, "Wrong substitution" );
-	}
-
-	/**
-	 * HV-102
-	 */
-	@Test
-	public void testRecursiveMessageInterpolation() {
-		AnnotationDescriptor<Max> descriptor = new AnnotationDescriptor<Max>( Max.class );
-		descriptor.setValue( "message", "{replace.in.user.bundle1}" );
-		descriptor.setValue( "value", 10l );
-		Max max = AnnotationFactory.create( descriptor );
-
-
-		ConstraintDescriptorImpl<Max> constraintDescriptor = new ConstraintDescriptorImpl<Max>(
-				max, new ConstraintHelper(), java.lang.annotation.ElementType.FIELD, ConstraintOrigin.DEFINED_LOCALLY
-		);
-
-		interpolator = new ResourceBundleMessageInterpolator( new TestResourceBundle() );
-		MessageInterpolator.Context context = new MessageInterpolatorContext( constraintDescriptor, null );
-
-		String expected = "{replace.in.default.bundle2}";
-		String actual = interpolator.interpolate( max.message(), context );
-		assertEquals(
-				actual, expected, "Within default bundle replacement parameter evaluation should not be recursive!"
-		);
-	}
-
-	/**
-	 * HV-182
-	 */
-	@Test
-	public void testCorrectMessageInterpolationIfParameterCannotBeReplaced() {
-		AnnotationDescriptor<Max> descriptor = new AnnotationDescriptor<Max>( Max.class );
-		String message = "Message should stay unchanged since {fubar} is not replaceable";
-		descriptor.setValue( "message", message );
-		descriptor.setValue( "value", 10l );
-		Max max = AnnotationFactory.create( descriptor );
-
-
-		ConstraintDescriptorImpl<Max> constraintDescriptor = new ConstraintDescriptorImpl<Max>(
-				max, new ConstraintHelper(), java.lang.annotation.ElementType.FIELD, ConstraintOrigin.DEFINED_LOCALLY
-		);
-
-		interpolator = new ResourceBundleMessageInterpolator( new TestResourceBundle() );
-		MessageInterpolator.Context context = new MessageInterpolatorContext( constraintDescriptor, null );
-
-		String actual = interpolator.interpolate( max.message(), context );
-		assertEquals(
-				actual, message, "The message should not have changed."
-		);
-	}
-
-	/**
-	 * A dummy resource bundle which can be passed to the constructor of ResourceBundleMessageInterpolator to replace
-	 * the user specified resource bundle.
-	 */
-	class TestResourceBundle extends ResourceBundle implements Enumeration<String> {
-		private Map<String, String> testResources;
-		Iterator<String> iter;
-
-		public TestResourceBundle() {
-			testResources = new HashMap<String, String>();
-			// add some test messages
-			testResources.put( "simple.key", "message interpolation successful" );
-			testResources.put( "key-with-dashes", "message interpolation successful" );
-			testResources.put( "key with spaces", "message interpolation successful" );
-			testResources.put( "replace.in.user.bundle1", "{replace.in.user.bundle2}" );
-			testResources.put( "replace.in.user.bundle2", "{replace.in.default.bundle1}" );
-
-			iter = testResources.keySet().iterator();
-		}
-
-		public Object handleGetObject(String key) {
-			return testResources.get( key );
-		}
-
-		public Enumeration<String> getKeys() {
-			return this;
-		}
-
-		public boolean hasMoreElements() {
-			return iter.hasNext();
-		}
-
-		public String nextElement() {
-			if ( hasMoreElements() ) {
-				return iter.next();
-			}
-			else {
-				throw new NoSuchElementException();
-			}
-		}
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/engine/messageinterpolation/User.java b/hibernate-validator/src/test/java/org/hibernate/validator/engine/messageinterpolation/User.java
deleted file mode 100644
index b67acbd..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/engine/messageinterpolation/User.java
+++ /dev/null
@@ -1,50 +0,0 @@
-// $Id:$
-/*
-* 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.engine.messageinterpolation;
-
-import org.hibernate.validator.constraints.Email;
-import org.hibernate.validator.constraints.Range;
-
-/**
- * @author Hardy Ferentschik
- */
-public class User {
-	@Email
-	private String email;
-
-	@Range(min = 18, max = 21)
-	private int age;
-
-	public int getAge() {
-		return age;
-	}
-
-	public void setAge(int age) {
-		this.age = age;
-	}
-
-	public String getEmail() {
-		return email;
-	}
-
-	public void setEmail(String email) {
-		this.email = email;
-	}
-}
-
-
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/engine/proxy/A.java b/hibernate-validator/src/test/java/org/hibernate/validator/engine/proxy/A.java
deleted file mode 100644
index 80a2522..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/engine/proxy/A.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// $Id: A.java 17838 2009-10-26 16:11:42Z hardy.ferentschik $
-/*
-* 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.engine.proxy;
-
-import javax.validation.constraints.Min;
-import javax.validation.constraints.Size;
-
-interface A {
-	@Min(5)
-	public Integer getInteger();
-
-	@Size(min = 2)
-	public String getString();
-}
\ No newline at end of file
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/engine/proxy/B.java b/hibernate-validator/src/test/java/org/hibernate/validator/engine/proxy/B.java
deleted file mode 100644
index 5412552..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/engine/proxy/B.java
+++ /dev/null
@@ -1,24 +0,0 @@
-// $Id: B.java 17838 2009-10-26 16:11:42Z hardy.ferentschik $
-/*
-* 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.engine.proxy;
-
-import javax.validation.constraints.Min;
-import javax.validation.constraints.Size;
-
-public interface B extends A {
-}
\ No newline at end of file
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/engine/proxy/ProxyTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/engine/proxy/ProxyTest.java
deleted file mode 100644
index 9a26361..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/engine/proxy/ProxyTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-// $Id: ProxyTest.java 17838 2009-10-26 16:11:42Z hardy.ferentschik $
-/*
-* 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.engine.proxy;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.Set;
-import javax.validation.ConstraintViolation;
-import javax.validation.Validator;
-
-import static org.testng.Assert.assertEquals;
-import org.testng.annotations.Test;
-
-import org.hibernate.validator.util.TestUtil;
-import static org.hibernate.validator.util.TestUtil.assertNumberOfViolations;
-
-/**
- * See HV-257
- *
- * @author Hardy Ferentschik
- */
-public class ProxyTest {
-	@Test
-	public void testValidateA() {
-		InvocationHandler handler = new CustomInvocationHandler( "some object" );
-
-		A a = ( A ) Proxy.newProxyInstance( getClass().getClassLoader(), new Class<?>[] { A.class }, handler );
-		assertEquals( Integer.valueOf( 0 ), a.getInteger() );
-
-		Validator validator = TestUtil.getValidator();
-		Set<ConstraintViolation<A>> violations = validator.validate( a );
-		assertNumberOfViolations( violations, 2 );
-	}
-
-	@Test
-	public void testValidateB() {
-		InvocationHandler handler = new CustomInvocationHandler( "some object" );
-
-		B b = ( B ) Proxy.newProxyInstance( getClass().getClassLoader(), new Class<?>[] { B.class }, handler );
-		assertEquals( Integer.valueOf( 0 ), b.getInteger() );
-
-		Validator validator = TestUtil.getValidator();
-		Set<ConstraintViolation<B>> violations = validator.validate( b );
-		assertNumberOfViolations( violations, 2 );
-	}
-
-	private class CustomInvocationHandler implements InvocationHandler {
-		private Object o;
-
-		public CustomInvocationHandler(Object o) {
-			this.o = o;
-		}
-
-		public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
-			if ( method.getName().equals( "getInteger" ) ) {
-				method.setAccessible( true );
-				return 0;
-			}
-			if ( method.getName().equals( "getString" ) ) {
-				return "a";
-			}
-			return method.invoke( o, args );
-		}
-	}
-}
-
-
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/engine/serialization/ConstraintViolationSerializationTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/engine/serialization/ConstraintViolationSerializationTest.java
deleted file mode 100644
index b9cd077..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/engine/serialization/ConstraintViolationSerializationTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-// $Id: ConstraintViolationSerializationTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.engine.serialization;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
-import java.io.NotSerializableException;
-import java.util.Set;
-import javax.validation.ConstraintViolation;
-import javax.validation.Validator;
-
-import org.testng.annotations.Test;
-
-import org.hibernate.validator.util.TestUtil;
-import static org.hibernate.validator.util.TestUtil.assertNumberOfViolations;
-
-/**
- * @author Hardy Ferentschik
- */
-public class ConstraintViolationSerializationTest {
-
-	/**
-	 * HV-245
-	 */
-	@Test
-	public void testSuccessfulSerialization() throws Exception {
-		Validator validator = TestUtil.getValidator();
-		SerializableClass testInstance = new SerializableClass();
-		Set<ConstraintViolation<SerializableClass>> constraintViolations = validator.validate( testInstance );
-
-		byte[] bytes = serialize( constraintViolations );
-		Set<ConstraintViolation<?>> deserializedViolations = deserialize( bytes );
-		assertNumberOfViolations( deserializedViolations, 1 );
-	}
-
-	/**
-	 * HV-245
-	 */
-	@Test(expectedExceptions = NotSerializableException.class)
-	public void testUnSuccessfulSerialization() throws Exception {
-		Validator validator = TestUtil.getValidator();
-		UnSerializableClass testInstance = new UnSerializableClass();
-		Set<ConstraintViolation<UnSerializableClass>> constraintViolations = validator.validate( testInstance );
-
-		serialize( constraintViolations );
-	}
-
-	private byte[] serialize(Object o) throws Exception {
-		ByteArrayOutputStream stream = new ByteArrayOutputStream();
-		ObjectOutput out = new ObjectOutputStream( stream );
-		out.writeObject( o );
-		out.close();
-		byte[] serialized = stream.toByteArray();
-		stream.close();
-		return serialized;
-
-	}
-
-	private Set<ConstraintViolation<?>> deserialize(byte[] byteData) throws Exception {
-		ByteArrayInputStream byteIn = new ByteArrayInputStream( byteData );
-		ObjectInputStream in = new ObjectInputStream( byteIn );
-		Set<ConstraintViolation<?>> deserializedViolations = ( Set<ConstraintViolation<?>> ) in.readObject();
-		in.close();
-		byteIn.close();
-		return deserializedViolations;
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/engine/serialization/SerializableClass.java b/hibernate-validator/src/test/java/org/hibernate/validator/engine/serialization/SerializableClass.java
deleted file mode 100644
index a3d125f..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/engine/serialization/SerializableClass.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// $Id: SerializableClass.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Middleware LLC, 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.engine.serialization;
-
-import java.io.Serializable;
-import javax.validation.constraints.NotNull;
-
-/**
- * @author Hardy Ferentschik
- */
-public class SerializableClass implements Serializable {
-	@NotNull
-	private String foo;
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/engine/serialization/UnSerializableClass.java b/hibernate-validator/src/test/java/org/hibernate/validator/engine/serialization/UnSerializableClass.java
deleted file mode 100644
index 02bd6bd..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/engine/serialization/UnSerializableClass.java
+++ /dev/null
@@ -1,28 +0,0 @@
-// $Id: UnSerializableClass.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Middleware LLC, 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.engine.serialization;
-
-import javax.validation.constraints.NotNull;
-
-/**
- * @author Hardy Ferentschik
- */
-public class UnSerializableClass {
-	@NotNull
-	private String foo;
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/CachedTraversableResolverTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/CachedTraversableResolverTest.java
deleted file mode 100644
index 79861dc..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/CachedTraversableResolverTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-// $Id: CachedTraversableResolverTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.engine.traversableresolver;
-
-import java.lang.annotation.ElementType;
-import java.util.HashSet;
-import java.util.Set;
-import javax.validation.Configuration;
-import javax.validation.TraversableResolver;
-import javax.validation.Validation;
-import javax.validation.Validator;
-import javax.validation.ValidatorFactory;
-import javax.validation.Path;
-import javax.validation.groups.Default;
-
-import static org.testng.Assert.fail;
-import org.testng.annotations.Test;
-
-/**
- * @author Emmanuel Bernard
- */
-//this test is specific to Hibernate Validator
-public class CachedTraversableResolverTest {
-	@Test
-	public void testCache() {
-		TraversableResolver resolver = new AskOnceTR();
-		Configuration<?> config = (Configuration<?>) Validation.byDefaultProvider()
-				.configure()
-				.traversableResolver( resolver );
-		ValidatorFactory factory = config.buildValidatorFactory();
-		Suit suit = new Suit();
-		suit.setTrousers( new Trousers() );
-		suit.setJacket( new Jacket() );
-		suit.setSize( 3333 );
-		suit.getTrousers().setLength( 32321 );
-		suit.getJacket().setWidth( 432432 );
-		Validator v = factory.getValidator();
-		try {
-			v.validate( suit, Default.class, Cloth.class );
-		}
-		catch ( IllegalStateException e ) {
-			fail( "Traversable Called several times for a given object" );
-		}
-
-		v = factory.usingContext().traversableResolver( new AskOnceTR() ).getValidator();
-		try {
-			v.validateProperty( suit, "size", Default.class, Cloth.class );
-		}
-		catch ( IllegalStateException e ) {
-			fail( "Traversable Called several times for a given object" );
-		}
-
-		v = factory.usingContext().traversableResolver( new AskOnceTR() ).getValidator();
-		try {
-			v.validateValue( Suit.class, "size", 2, Default.class, Cloth.class );
-		}
-		catch ( IllegalStateException e ) {
-			fail( "Traversable Called several times for a given object" );
-		}
-	}
-
-	private static class AskOnceTR implements TraversableResolver {
-		private Set<Holder> askedReach = new HashSet<Holder>();
-		private Set<Holder> askedCascade = new HashSet<Holder>();
-
-		private boolean isTraversable(Set<Holder> asked, Object traversableObject, Path.Node traversableProperty, Class<?> rootBeanType, Path pathToTraversableObject, ElementType elementType) {
-			Holder h = new Holder( traversableObject, traversableProperty );
-			if ( asked.contains( h ) ) {
-				throw new IllegalStateException( "Called twice" );
-			}
-			asked.add( h );
-			return true;
-		}
-
-		public boolean isReachable(Object traversableObject, Path.Node traversableProperty, Class<?> rootBeanType, Path pathToTraversableObject, ElementType elementType) {
-			return isTraversable(
-					askedReach,
-					traversableObject,
-					traversableProperty,
-					rootBeanType,
-					pathToTraversableObject,
-					elementType
-			);
-		}
-
-		public boolean isCascadable(Object traversableObject, Path.Node traversableProperty, Class<?> rootBeanType, Path pathToTraversableObject, ElementType elementType) {
-			return isTraversable(
-					askedCascade,
-					traversableObject,
-					traversableProperty,
-					rootBeanType,
-					pathToTraversableObject,
-					elementType
-			);
-		}
-
-		public static class Holder {
-			Object NULL = new Object();
-			Object to;
-			Path.Node tp;
-
-			public Holder(Object traversableObject, Path.Node traversableProperty) {
-				to = traversableObject == null ? NULL : traversableObject;
-				tp = traversableProperty;
-			}
-
-			@Override
-			public int hashCode() {
-				return to.hashCode() + tp.hashCode();
-			}
-
-			@Override
-			public boolean equals(Object obj) {
-				if ( !( obj instanceof Holder ) ) {
-					return false;
-				}
-				Holder that = ( Holder ) obj;
-
-				return to != NULL && to == that.to && tp.equals( that.tp );
-			}
-		}
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/Cloth.java b/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/Cloth.java
deleted file mode 100644
index 50087a2..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/Cloth.java
+++ /dev/null
@@ -1,24 +0,0 @@
-// $Id: Cloth.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.engine.traversableresolver;
-
-/**
- * @author Emmanuel Bernard
- */
-public interface Cloth {
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/Jacket.java b/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/Jacket.java
deleted file mode 100644
index 5521ef4..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/Jacket.java
+++ /dev/null
@@ -1,37 +0,0 @@
-// $Id: Jacket.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.engine.traversableresolver;
-
-import javax.validation.constraints.Max;
-
-
-/**
- * @author Emmanuel Bernard
- */
-public class Jacket {
-	Integer width;
-
-	@Max(30)
-	public Integer getWidth() {
-		return width;
-	}
-
-	public void setWidth(Integer width) {
-		this.width = width;
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/Suit.java b/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/Suit.java
deleted file mode 100644
index 0f962ab..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/Suit.java
+++ /dev/null
@@ -1,61 +0,0 @@
-// $Id: Suit.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.engine.traversableresolver;
-
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-import javax.validation.Valid;
-import javax.validation.GroupSequence;
-import javax.validation.groups.Default;
-
-/**
- * @author Emmanuel Bernard
- */
- at GroupSequence( {Suit.class, Cloth.class })
-public class Suit {
-	@Max(value=50, groups = { Default.class, Cloth.class})
-	@Min(1)
-	private Integer size;
-	@Valid private Trousers trousers;
-	private Jacket jacket;
-
-	public Trousers getTrousers() {
-		return trousers;
-	}
-
-	public void setTrousers(Trousers trousers) {
-		this.trousers = trousers;
-	}
-
-	@Valid
-	public Jacket getJacket() {
-		return jacket;
-	}
-
-	public void setJacket(Jacket jacket) {
-		this.jacket = jacket;
-	}
-
-	public Integer getSize() {
-		return size;
-	}
-
-	public void setSize(Integer size) {
-		this.size = size;
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/Trousers.java b/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/Trousers.java
deleted file mode 100644
index 2bc84ec..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/Trousers.java
+++ /dev/null
@@ -1,39 +0,0 @@
-// $Id: Trousers.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.engine.traversableresolver;
-
-import javax.validation.constraints.Min;
-import javax.validation.constraints.Max;
-import javax.validation.groups.Default;
-
-/**
- * @author Emmanuel Bernard
- */
-public class Trousers {
-	@Min(value=70, groups = {Default.class, Cloth.class})
-	@Max(value=220)
-	private Integer length;
-
-	public Integer getLength() {
-		return length;
-	}
-
-	public void setLength(Integer length) {
-		this.length = length;
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/metadata/ConstraintHelperTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/metadata/ConstraintHelperTest.java
deleted file mode 100644
index 0c7e528..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/metadata/ConstraintHelperTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-// $Id: ConstraintHelperTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.metadata;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Field;
-import java.lang.reflect.Member;
-import java.util.List;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
-
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import org.hibernate.validator.util.SetAccessibility;
-
-/**
- * @author Hardy Ferentschik
- */
-public class ConstraintHelperTest {
-
-	private static ConstraintHelper constraintHelper;
-
-	@BeforeClass
-	public static void init() {
-		constraintHelper = new ConstraintHelper();
-	}
-
-	@Test
-	public void testGetMultiValueConstraints() throws Exception {
-		Engine engine = new Engine();
-		Field[] fields = engine.getClass().getDeclaredFields();
-		assertNotNull( fields );
-		assertTrue( fields.length == 1 );
-		setAccessibility( fields[0] );
-
-		Annotation annotation = fields[0].getAnnotation( Pattern.List.class );
-		assertNotNull( annotation );
-		List<Annotation> multiValueConstraintAnnotations = constraintHelper.getMultiValueConstraints( annotation );
-		assertTrue( multiValueConstraintAnnotations.size() == 2, "There should be two constraint annotations" );
-		assertTrue( multiValueConstraintAnnotations.get( 0 ) instanceof Pattern, "Wrong constraint annotation" );
-		assertTrue( multiValueConstraintAnnotations.get( 1 ) instanceof Pattern, "Wrong constraint annotation" );
-
-
-		Order order = new Order();
-		fields = order.getClass().getDeclaredFields();
-		assertNotNull( fields );
-		assertTrue( fields.length == 1 );
-		setAccessibility( fields[0] );
-
-		annotation = fields[0].getAnnotation( NotNull.class );
-		assertNotNull( annotation );
-		multiValueConstraintAnnotations = constraintHelper.getMultiValueConstraints( annotation );
-		assertTrue( multiValueConstraintAnnotations.size() == 0, "There should be no constraint annotations" );
-	}
-
-	void setAccessibility(Member member) {
-		SetAccessibility.action( member ).run();
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/metadata/Customer.java b/hibernate-validator/src/test/java/org/hibernate/validator/metadata/Customer.java
deleted file mode 100644
index 65b84c6..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/metadata/Customer.java
+++ /dev/null
@@ -1,67 +0,0 @@
-// $Id: Customer.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.metadata;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.validation.Valid;
-
-/**
- * @author Hardy Ferentschik
- */
-public class Customer implements Person {
-
-	private String firstName;
-	private String middleName;
-	private String lastName;
-
-	@Valid
-	private List<Order> orderList = new ArrayList<Order>();
-
-	public void addOrder(Order order) {
-		orderList.add( order );
-	}
-
-	public List<Order> getOrderList() {
-		return orderList;
-	}
-
-	public String getFirstName() {
-		return firstName;
-	}
-
-	public void setFirstName(String firstName) {
-		this.firstName = firstName;
-	}
-
-	public String getMiddleName() {
-		return middleName;
-	}
-
-	public void setMiddleName(String middleName) {
-		this.middleName = middleName;
-	}
-
-	public String getLastName() {
-		return lastName;
-	}
-
-	public void setLastName(String lastName) {
-		this.lastName = lastName;
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/metadata/ElementDescriptorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/metadata/ElementDescriptorTest.java
deleted file mode 100644
index 0b5f8c4..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/metadata/ElementDescriptorTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-// $Id: ElementDescriptorTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.metadata;
-
-import java.util.Set;
-import javax.validation.Validator;
-import javax.validation.metadata.BeanDescriptor;
-import javax.validation.metadata.ConstraintDescriptor;
-import javax.validation.metadata.ElementDescriptor;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-import org.testng.annotations.Test;
-
-import org.hibernate.validator.util.TestUtil;
-
-
-/**
- * @author Hardy Ferentschik
- */
-public class ElementDescriptorTest {
-
-
-	@Test
-	public void testGetTypeForConstrainedBean() {
-		Validator validator = TestUtil.getValidator();
-		BeanDescriptor beanDescriptor = validator.getConstraintsForClass( Customer.class );
-		assertEquals( beanDescriptor.getElementClass(), Customer.class, "Wrong type." );
-	}
-
-	@Test
-	public void testGetTypeForConstrainedProperty() {
-		ElementDescriptor elementDescriptor = TestUtil.getPropertyDescriptor( Order.class, "orderNumber" );
-		assertEquals( elementDescriptor.getElementClass(), Integer.class, "Wrong type." );
-	}
-
-	/**
-	 * HV-95
-	 */
-	@Test
-	public void testElementDescriptorForProperty() {
-		ElementDescriptor elementDescriptor = TestUtil.getPropertyDescriptor( Order.class, "orderNumber" );
-		Set<ConstraintDescriptor<?>> constraintDescriptors = elementDescriptor.getConstraintDescriptors();
-		assertTrue( constraintDescriptors.size() == 1, "There should be a descriptor" );
-	}
-
-	/**
-	 * HV-95
-	 */
-	@Test
-	public void testElementDescriptorImmutable() {
-		ElementDescriptor elementDescriptor = TestUtil.getPropertyDescriptor( Order.class, "orderNumber" );
-		Set<ConstraintDescriptor<?>> constraintDescriptors = elementDescriptor.getConstraintDescriptors();
-
-		try {
-			constraintDescriptors.add( null );
-			fail( "Set should be immutable" );
-		}
-		catch ( UnsupportedOperationException e ) {
-			// success
-		}
-
-		try {
-			constraintDescriptors.remove( null );
-			fail( "Set should be immutable" );
-		}
-		catch ( UnsupportedOperationException e ) {
-			// success
-		}
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/metadata/Engine.java b/hibernate-validator/src/test/java/org/hibernate/validator/metadata/Engine.java
deleted file mode 100644
index 2edc47c..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/metadata/Engine.java
+++ /dev/null
@@ -1,41 +0,0 @@
-// $Id: Engine.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.metadata;
-
-import javax.validation.constraints.Pattern;
-
-
-/**
- * @author Hardy Ferentschik
- */
-public class Engine {
-	@Pattern.List({
-			@Pattern(regexp = "^[A-Z0-9-]+$",
-					message = "must contain alphabetical characters only"),
-			@Pattern(regexp = "^....-....-....$", message = "must match ....-....-....")
-	})
-	private String serialNumber;
-
-	public String getSerialNumber() {
-		return serialNumber;
-	}
-
-	public void setSerialNumber(String serialNumber) {
-		this.serialNumber = serialNumber;
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/metadata/Order.java b/hibernate-validator/src/test/java/org/hibernate/validator/metadata/Order.java
deleted file mode 100644
index 37d4987..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/metadata/Order.java
+++ /dev/null
@@ -1,36 +0,0 @@
-// $Id: Order.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.metadata;
-
-import javax.validation.constraints.NotNull;
-
-/**
- * @author Hardy Ferentschik
- */
-public class Order {
-	@NotNull(message = "Order number must be specified")
-	Integer orderNumber;
-
-	public Integer getOrderNumber() {
-		return orderNumber;
-	}
-
-	public void setOrderNumber(Integer orderNumber) {
-		this.orderNumber = orderNumber;
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/metadata/Person.java b/hibernate-validator/src/test/java/org/hibernate/validator/metadata/Person.java
deleted file mode 100644
index 1abcd34..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/metadata/Person.java
+++ /dev/null
@@ -1,36 +0,0 @@
-// $Id: Person.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.metadata;
-
-import org.hibernate.validator.constraints.NotEmpty;
-
-/**
- * @author Hardy Ferentschik
- */
-public interface Person {
-	@NotEmpty(groups = PersonValidation.class)
-	String getFirstName();
-
-	String getMiddleName();
-
-	@NotEmpty
-	String getLastName();
-
-	public interface PersonValidation {
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/HibernateValidatorConfigurationTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/HibernateValidatorConfigurationTest.java
new file mode 100644
index 0000000..03a3e9a
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/HibernateValidatorConfigurationTest.java
@@ -0,0 +1,45 @@
+/*
+ * $Id: HibernateValidatorConfigurationTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+ *
+ * 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.test;
+
+import javax.validation.Validation;
+
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.HibernateValidator;
+import org.hibernate.validator.HibernateValidatorConfiguration;
+import org.hibernate.validator.resourceloading.ResourceBundleLocator;
+
+import static org.testng.Assert.assertNotNull;
+
+/**
+ * Test for {@link org.hibernate.validator.HibernateValidatorConfiguration}.
+ *
+ * @author Gunnar Morling
+ */
+public class HibernateValidatorConfigurationTest {
+
+	@Test
+	public void defaultResourceBundleLocatorCanBeRetrieved() {
+		HibernateValidatorConfiguration configure = Validation.byProvider( HibernateValidator.class ).configure();
+		ResourceBundleLocator defaultResourceBundleLocator = configure.getDefaultResourceBundleLocator();
+
+		assertNotNull( defaultResourceBundleLocator );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/bootstrap/Customer.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/bootstrap/Customer.java
new file mode 100644
index 0000000..6873de7
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/bootstrap/Customer.java
@@ -0,0 +1,70 @@
+// $Id: Customer.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.bootstrap;
+
+import java.util.HashSet;
+import java.util.Set;
+import javax.validation.Valid;
+
+import org.hibernate.validator.constraints.NotEmpty;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Customer {
+	@NotEmpty
+	private String firstName;
+	private String middleName;
+	@NotEmpty
+	private String lastName;
+
+	@Valid
+	private Set<Order> orders = new HashSet<Order>();
+
+	public void addOrder(Order order) {
+		orders.add( order );
+	}
+
+	public Set<Order> getOrders() {
+		return orders;
+	}
+
+	public String getFirstName() {
+		return firstName;
+	}
+
+	public void setFirstName(String firstName) {
+		this.firstName = firstName;
+	}
+
+	public String getMiddleName() {
+		return middleName;
+	}
+
+	public void setMiddleName(String middleName) {
+		this.middleName = middleName;
+	}
+
+	public String getLastName() {
+		return lastName;
+	}
+
+	public void setLastName(String lastName) {
+		this.lastName = lastName;
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/bootstrap/Order.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/bootstrap/Order.java
new file mode 100644
index 0000000..1c7cbd9
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/bootstrap/Order.java
@@ -0,0 +1,36 @@
+// $Id: Order.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.bootstrap;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Order {
+	@NotNull
+	Integer orderNumber;
+
+	public Integer getOrderNumber() {
+		return orderNumber;
+	}
+
+	public void setOrderNumber(Integer orderNumber) {
+		this.orderNumber = orderNumber;
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/bootstrap/ValidationTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/bootstrap/ValidationTest.java
new file mode 100644
index 0000000..4a1c67d
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/bootstrap/ValidationTest.java
@@ -0,0 +1,129 @@
+// $Id: ValidationTest.java 19640 2010-06-01 12:16:12Z hardy.ferentschik $
+/*
+* 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.test.bootstrap;
+
+import java.util.Set;
+import javax.validation.Configuration;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import javax.validation.ConstraintValidatorFactory;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validation;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.HibernateValidator;
+import org.hibernate.validator.HibernateValidatorConfiguration;
+import org.hibernate.validator.constraints.impl.NotNullValidator;
+import org.hibernate.validator.engine.ConfigurationImpl;
+import org.hibernate.validator.engine.ConstraintValidatorFactoryImpl;
+import org.hibernate.validator.engine.ValidatorFactoryImpl;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+/**
+ * Tests the Bean Validation bootstrapping.
+ *
+ * @author Hardy Ferentschik
+ */
+public class ValidationTest {
+
+	@Test
+	public void testBootstrapAsServiceWithBuilder() {
+		HibernateValidatorConfiguration configuration = Validation
+				.byProvider( HibernateValidator.class )
+				.configure();
+		assertDefaultBuilderAndFactory( configuration );
+	}
+
+	@Test
+	public void testBootstrapAsServiceDefault() {
+		ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
+		assertDefaultFactory( factory );
+	}
+
+	@Test
+	public void testCustomConstraintValidatorFactory() {
+
+		Configuration<?> configuration = Validation.byDefaultProvider().configure();
+		assertDefaultBuilderAndFactory( configuration );
+
+		ValidatorFactory factory = configuration.buildValidatorFactory();
+		Validator validator = factory.getValidator();
+
+		Customer customer = new Customer();
+		customer.setFirstName( "John" );
+
+		Set<ConstraintViolation<Customer>> constraintViolations = validator.validate( customer );
+		assertEquals( constraintViolations.size(), 1, "Wrong number of constraints" );
+		ConstraintViolation<Customer> constraintViolation = constraintViolations.iterator().next();
+		assertEquals( "may not be empty", constraintViolation.getMessage(), "Wrong message" );
+
+		// get a new factory using a custom configuration
+		configuration = Validation.byDefaultProvider().configure();
+		configuration.constraintValidatorFactory(
+				new ConstraintValidatorFactory() {
+
+					public <T extends ConstraintValidator<?, ?>> T getInstance(Class<T> key) {
+						if ( key == NotNullValidator.class ) {
+							return ( T ) new BadlyBehavedNotNullConstraintValidator();
+						}
+						return new ConstraintValidatorFactoryImpl().getInstance( key );
+					}
+				}
+		);
+		factory = configuration.buildValidatorFactory();
+		validator = factory.getValidator();
+		constraintViolations = validator.validate( customer );
+		assertEquals( constraintViolations.size(), 0, "Wrong number of constraints" );
+	}
+
+	/**
+	 * HV-328
+	 */
+	@Test(expectedExceptions = IllegalArgumentException.class)
+	public void testNullInputStream() {
+		Configuration<?> configuration = Validation.byDefaultProvider().configure();
+		configuration.addMapping( null );
+		configuration.buildValidatorFactory();
+	}
+
+	private void assertDefaultBuilderAndFactory(Configuration configuration) {
+		assertNotNull( configuration );
+		assertTrue( configuration instanceof ConfigurationImpl );
+
+		ValidatorFactory factory = configuration.buildValidatorFactory();
+		assertDefaultFactory( factory );
+	}
+
+	private void assertDefaultFactory(ValidatorFactory factory) {
+		assertNotNull( factory );
+		assertTrue( factory instanceof ValidatorFactoryImpl );
+	}
+
+	class BadlyBehavedNotNullConstraintValidator extends NotNullValidator {
+		@Override
+		public boolean isValid(Object object, ConstraintValidatorContext constraintValidatorContext) {
+			return true;
+		}
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/cfg/ConstraintMappingTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/cfg/ConstraintMappingTest.java
new file mode 100644
index 0000000..d8c64ea
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/cfg/ConstraintMappingTest.java
@@ -0,0 +1,302 @@
+// $Id: ConstraintMappingTest.java 19639 2010-06-01 11:52:20Z hardy.ferentschik $
+/*
+ * 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.test.cfg;
+
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.Set;
+import javax.validation.ConstraintViolation;
+import javax.validation.ValidationException;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+
+import org.slf4j.Logger;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.HibernateValidator;
+import org.hibernate.validator.HibernateValidatorConfiguration;
+import org.hibernate.validator.cfg.ConstraintMapping;
+import org.hibernate.validator.cfg.defs.AssertTrueDef;
+import org.hibernate.validator.cfg.defs.FutureDef;
+import org.hibernate.validator.cfg.defs.GenericConstraintDef;
+import org.hibernate.validator.cfg.defs.MinDef;
+import org.hibernate.validator.cfg.defs.NotEmptyDef;
+import org.hibernate.validator.cfg.defs.NotNullDef;
+import org.hibernate.validator.cfg.defs.SizeDef;
+import org.hibernate.validator.test.util.TestUtil;
+import org.hibernate.validator.util.LoggerFactory;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static org.hibernate.validator.test.util.TestUtil.assertConstraintViolation;
+import static org.hibernate.validator.test.util.TestUtil.assertCorrectConstraintViolationMessages;
+import static org.hibernate.validator.test.util.TestUtil.assertNumberOfViolations;
+import static org.testng.Assert.assertTrue;
+import static org.testng.FileAssert.fail;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class ConstraintMappingTest {
+	private static final Logger log = LoggerFactory.make();
+
+	@Test(expectedExceptions = IllegalArgumentException.class)
+	public void testNullConstraintMapping() {
+		HibernateValidatorConfiguration config = TestUtil.getConfiguration( HibernateValidator.class );
+		config.addMapping( ( ConstraintMapping ) null );
+		config.buildValidatorFactory();
+	}
+
+	@Test
+	public void testConstraintMapping() {
+		ConstraintMapping mapping = new ConstraintMapping();
+		mapping.type( Marathon.class )
+				.property( "name", METHOD )
+				.constraint( NotNullDef.class )
+				.property( "numberOfHelpers", FIELD )
+				.constraint( MinDef.class ).value( 1 );
+
+		assertTrue( mapping.getConstraintConfig().containsKey( Marathon.class ) );
+		assertTrue( mapping.getConstraintConfig().get( Marathon.class ).size() == 2 );
+	}
+
+	@Test
+	public void testNoConstraintViolationForUnmappedEntity() {
+		HibernateValidatorConfiguration config = TestUtil.getConfiguration( HibernateValidator.class );
+		ValidatorFactory factory = config.buildValidatorFactory();
+		Validator validator = factory.getValidator();
+
+		Set<ConstraintViolation<Marathon>> violations = validator.validate( new Marathon() );
+		assertNumberOfViolations( violations, 0 );
+	}
+
+	@Test
+	public void testSingleConstraint() {
+		HibernateValidatorConfiguration config = TestUtil.getConfiguration( HibernateValidator.class );
+
+		ConstraintMapping mapping = new ConstraintMapping();
+		mapping.type( Marathon.class )
+				.property( "name", METHOD )
+				.constraint( NotNullDef.class );
+
+		config.addMapping( mapping );
+
+		ValidatorFactory factory = config.buildValidatorFactory();
+		Validator validator = factory.getValidator();
+
+		Set<ConstraintViolation<Marathon>> violations = validator.validate( new Marathon() );
+		assertNumberOfViolations( violations, 1 );
+		assertConstraintViolation( violations.iterator().next(), "may not be null" );
+	}
+
+	@Test
+	public void testInheritedConstraint() {
+		HibernateValidatorConfiguration config = TestUtil.getConfiguration( HibernateValidator.class );
+
+		ConstraintMapping mapping = new ConstraintMapping();
+		mapping
+				.type( Marathon.class )
+				.property( "name", METHOD )
+				.constraint( NotNullDef.class )
+				.type( Tournament.class )
+				.property( "tournamentDate", METHOD )
+				.constraint( FutureDef.class );
+
+		config.addMapping( mapping );
+
+		ValidatorFactory factory = config.buildValidatorFactory();
+		Validator validator = factory.getValidator();
+
+		Marathon marathon = new Marathon();
+		marathon.setName( "New York Marathon" );
+		Calendar cal = GregorianCalendar.getInstance();
+		cal.set( Calendar.YEAR, -1 );
+		marathon.setTournamentDate( cal.getTime() );
+
+		Set<ConstraintViolation<Marathon>> violations = validator.validate( marathon );
+		assertNumberOfViolations( violations, 1 );
+		assertConstraintViolation( violations.iterator().next(), "must be in the future" );
+	}
+
+	@Test
+	public void testValid() {
+		HibernateValidatorConfiguration config = TestUtil.getConfiguration( HibernateValidator.class );
+
+		ConstraintMapping mapping = new ConstraintMapping();
+		mapping.type( Marathon.class )
+				.valid( "runners", METHOD )
+				.type( Runner.class )
+				.property( "paidEntryFee", FIELD )
+				.constraint( AssertTrueDef.class );
+
+		config.addMapping( mapping );
+
+		ValidatorFactory factory = config.buildValidatorFactory();
+		Validator validator = factory.getValidator();
+
+		Marathon marathon = new Marathon();
+		marathon.setName( "New York Marathon" );
+
+		Set<ConstraintViolation<Marathon>> violations = validator.validate( marathon );
+		assertNumberOfViolations( violations, 0 );
+
+		marathon.addRunner( new Runner() );
+		violations = validator.validate( marathon );
+		assertNumberOfViolations( violations, 1 );
+		assertConstraintViolation( violations.iterator().next(), "must be true" );
+	}
+
+	@Test
+	public void testSingleConstraintWrongAccessType() {
+		ConstraintMapping mapping = new ConstraintMapping();
+		try {
+			mapping
+					.type( Marathon.class )
+					.property( "numberOfHelpers", METHOD )
+					.constraint( NotNullDef.class );
+			fail();
+		}
+		catch ( ValidationException e ) {
+			log.debug( e.toString() );
+		}
+	}
+
+	@Test
+	public void testDefaultGroupSequence() {
+		HibernateValidatorConfiguration config = TestUtil.getConfiguration( HibernateValidator.class );
+
+		ConstraintMapping mapping = new ConstraintMapping();
+		mapping
+				.type( Marathon.class )
+				.defaultGroupSequence( Foo.class, Marathon.class )
+				.property( "name", METHOD )
+				.constraint( NotNullDef.class ).groups( Foo.class )
+				.property( "runners", METHOD )
+				.constraint( NotEmptyDef.class );
+
+		config.addMapping( mapping );
+
+		ValidatorFactory factory = config.buildValidatorFactory();
+		Validator validator = factory.getValidator();
+
+		Marathon marathon = new Marathon();
+
+		Set<ConstraintViolation<Marathon>> violations = validator.validate( marathon );
+		assertNumberOfViolations( violations, 1 );
+		assertConstraintViolation( violations.iterator().next(), "may not be null" );
+
+		marathon.setName( "Stockholm Marathon" );
+		violations = validator.validate( marathon );
+		assertNumberOfViolations( violations, 1 );
+		assertConstraintViolation( violations.iterator().next(), "may not be empty" );
+	}
+
+	@Test
+	public void testMultipleConstraintOfTheSameType() {
+		HibernateValidatorConfiguration config = TestUtil.getConfiguration( HibernateValidator.class );
+
+		ConstraintMapping mapping = new ConstraintMapping();
+		mapping.type( Marathon.class )
+				.property( "name", METHOD )
+				.constraint( SizeDef.class ).min( 5 )
+				.constraint( SizeDef.class ).min( 10 );
+
+		config.addMapping( mapping );
+
+		ValidatorFactory factory = config.buildValidatorFactory();
+		Validator validator = factory.getValidator();
+
+		Marathon marathon = new Marathon();
+		marathon.setName( "Foo" );
+
+		Set<ConstraintViolation<Marathon>> violations = validator.validate( marathon );
+		assertNumberOfViolations( violations, 2 );
+
+		marathon.setName( "Foobar" );
+		violations = validator.validate( marathon );
+		assertNumberOfViolations( violations, 1 );
+
+		marathon.setName( "Stockholm Marathon" );
+		violations = validator.validate( marathon );
+		assertNumberOfViolations( violations, 0 );
+	}
+
+	@Test
+	public void testCustomConstraintTypeMissingParameter() {
+		ConstraintMapping mapping = new ConstraintMapping();
+		mapping.type( Marathon.class )
+				.constraint( GenericConstraintDef.class )
+				.constraintType( MarathonConstraint.class );
+
+		HibernateValidatorConfiguration config = TestUtil.getConfiguration( HibernateValidator.class );
+		config.addMapping( mapping );
+		try {
+			config.buildValidatorFactory();
+			fail( "MarathonConstraints needs a parameter" );
+		}
+		catch ( ValidationException e ) {
+			assertTrue( e.getMessage().contains( "No value provided for minRunner" ) );
+		}
+	}
+
+	@Test
+	public void testCustomConstraintType() {
+		ConstraintMapping mapping = new ConstraintMapping();
+		mapping.type( Marathon.class )
+				.constraint( GenericConstraintDef.class )
+				.constraintType( MarathonConstraint.class )
+				.param( "minRunner", 100 )
+				.message( "Needs more runners" );
+
+		HibernateValidatorConfiguration config = TestUtil.getConfiguration( HibernateValidator.class );
+		config.addMapping( mapping );
+
+		ValidatorFactory factory = config.buildValidatorFactory();
+		Validator validator = factory.getValidator();
+
+		Marathon marathon = new Marathon();
+		marathon.setName( "Stockholm Marathon" );
+
+		Set<ConstraintViolation<Marathon>> violations = validator.validate( marathon );
+		assertNumberOfViolations( violations, 1 );
+		assertCorrectConstraintViolationMessages( violations, "Needs more runners" );
+
+		for ( int i = 0; i < 100; i++ ) {
+			marathon.addRunner( new Runner() );
+		}
+		violations = validator.validate( marathon );
+		assertNumberOfViolations( violations, 0 );
+	}
+
+	@Test(expectedExceptions = ValidationException.class)
+	public void testNullBean() {
+		ConstraintMapping mapping = new ConstraintMapping();
+		mapping.type( null )
+				.constraint( GenericConstraintDef.class )
+				.constraintType( MarathonConstraint.class );
+
+		HibernateValidatorConfiguration config = TestUtil.getConfiguration( HibernateValidator.class );
+		config.addMapping( mapping );
+		config.buildValidatorFactory();
+	}
+
+	public interface Foo {
+	}
+}
+
+
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/cfg/Marathon.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/cfg/Marathon.java
new file mode 100644
index 0000000..c01da91
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/cfg/Marathon.java
@@ -0,0 +1,66 @@
+// $Id: Marathon.java 19635 2010-05-31 14:03:26Z hardy.ferentschik $
+/*
+ * 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.test.cfg;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Marathon implements Tournament {
+
+	private String name;
+
+	private long numberOfHelpers;
+
+	private Date tournamentDate;
+
+	private List<Runner> runners;
+
+	public Marathon() {
+		runners = new ArrayList<Runner>();
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public Date getTournamentDate() {
+		return tournamentDate;
+	}
+
+	public void setTournamentDate(Date tournamentDate) {
+		this.tournamentDate = tournamentDate;
+	}
+
+	public List<Runner> getRunners() {
+		return runners;
+	}
+
+	public void addRunner(Runner runner) {
+		runners.add( runner );
+	}
+}
+
+
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/cfg/MarathonConstraint.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/cfg/MarathonConstraint.java
new file mode 100644
index 0000000..92ad5cf
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/cfg/MarathonConstraint.java
@@ -0,0 +1,44 @@
+// $Id: MarathonConstraint.java 19636 2010-05-31 14:31:14Z hardy.ferentschik $
+/*
+ * 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.test.cfg;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at Target({ TYPE })
+ at Retention(RUNTIME)
+ at Constraint(validatedBy = { MarathonConstraintValidator.class })
+public @interface MarathonConstraint {
+	public String message() default "invalid name";
+
+	public Class<?>[] groups() default { };
+
+	public Class<? extends Payload>[] payload() default { };
+
+	public int minRunner();
+}
+
+
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/cfg/MarathonConstraintValidator.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/cfg/MarathonConstraintValidator.java
new file mode 100644
index 0000000..c00f651
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/cfg/MarathonConstraintValidator.java
@@ -0,0 +1,39 @@
+// $Id: MarathonConstraintValidator.java 19636 2010-05-31 14:31:14Z hardy.ferentschik $
+/*
+ * 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.test.cfg;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class MarathonConstraintValidator implements ConstraintValidator<MarathonConstraint, Marathon> {
+	private int minRunners;
+
+	public void initialize(MarathonConstraint constraintAnnotation) {
+		minRunners = constraintAnnotation.minRunner();
+	}
+
+	public boolean isValid(Marathon m, ConstraintValidatorContext context) {
+		return m.getRunners().size() >= minRunners;
+	}
+}
+
+
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/cfg/Runner.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/cfg/Runner.java
new file mode 100644
index 0000000..cf4c5b9
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/cfg/Runner.java
@@ -0,0 +1,45 @@
+// $Id: Runner.java 19597 2010-05-24 19:18:21Z hardy.ferentschik $
+/*
+ * 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.test.cfg;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Runner {
+	private String name;
+
+	private boolean paidEntryFee;
+
+	public boolean isPaidEntryFee() {
+		return paidEntryFee;
+	}
+
+	public void setPaidEntryFee(boolean paidEntryFee) {
+		this.paidEntryFee = paidEntryFee;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+}
+
+
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/cfg/Tournament.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/cfg/Tournament.java
new file mode 100644
index 0000000..9aed72f
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/cfg/Tournament.java
@@ -0,0 +1,29 @@
+// $Id: Tournament.java 19596 2010-05-24 10:31:09Z hardy.ferentschik $
+/*
+ * 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.test.cfg;
+
+import java.util.Date;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public interface Tournament {
+	Date getTournamentDate();
+}
+
+
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/ClassValidatorWithTypeVariableTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/ClassValidatorWithTypeVariableTest.java
new file mode 100644
index 0000000..0d881c2
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/ClassValidatorWithTypeVariableTest.java
@@ -0,0 +1,127 @@
+// $Id: ClassValidatorWithTypeVariableTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, 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.test.constraints;
+
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+import javax.validation.ConstraintViolation;
+import javax.validation.Valid;
+import javax.validation.Validator;
+import javax.validation.constraints.NotNull;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.test.util.TestUtil;
+import static org.hibernate.validator.test.util.TestUtil.assertCorrectConstraintTypes;
+import static org.hibernate.validator.test.util.TestUtil.assertCorrectPropertyPaths;
+import static org.hibernate.validator.test.util.TestUtil.assertNumberOfViolations;
+
+/**
+ * HV-250
+ */
+public class ClassValidatorWithTypeVariableTest {
+
+	private Validator validator;
+
+	@BeforeClass
+	public void setUp() {
+		validator = TestUtil.getValidator();
+	}
+
+	@Test
+	public void offersNull() {
+		Batch batch = new Batch( null );
+
+		Set<ConstraintViolation<Batch>> violations = validator.validate( batch );
+		assertNumberOfViolations( violations, 1 );
+		assertCorrectPropertyPaths( violations, "offers" );
+		assertCorrectConstraintTypes( violations, NotNull.class );
+	}
+
+	@Test
+	public void offerItemNull() {
+		ItemAOffer offer = new ItemAOffer( null );
+		Set<ItemOffer<? extends Item>> offers = new HashSet<ItemOffer<? extends Item>>();
+		offers.add( offer );
+		Batch batch = new Batch( offers );
+
+		Set<ConstraintViolation<Batch>> violations = validator.validate( batch );
+		assertNumberOfViolations( violations, 1 );
+		assertCorrectPropertyPaths( violations, "offers[].item" );
+		assertCorrectConstraintTypes( violations, NotNull.class );
+	}
+
+	@Test
+	public void offerItemDateNull() {
+		ItemA item = new ItemA( null );
+		ItemOffer<? extends Item> offer = new ItemAOffer( item );
+		Set<ItemOffer<? extends Item>> offers = new HashSet<ItemOffer<? extends Item>>();
+		offers.add( offer );
+		Batch batch = new Batch( offers );
+
+		Set<ConstraintViolation<Batch>> violations = validator.validate( batch );
+		assertNumberOfViolations( violations, 1 );
+		assertCorrectPropertyPaths( violations, "offers[].item.date" );
+		assertCorrectConstraintTypes( violations, NotNull.class );
+	}
+
+	private class Batch {
+		@NotNull
+		@Valid
+		private Set<ItemOffer<? extends Item>> offers = new HashSet<ItemOffer<? extends Item>>();
+
+		public Batch(Set<ItemOffer<? extends Item>> offers) {
+			this.offers = offers;
+		}
+	}
+
+	private abstract class Item {
+		@NotNull
+		private Date date;
+
+		public Item(Date date) {
+			this.date = date;
+		}
+	}
+
+	private abstract class ItemOffer<T extends Item> {
+		@NotNull
+		@Valid
+		private T item;
+
+		public ItemOffer(T item) {
+			this.item = item;
+		}
+	}
+
+	private class ItemA extends Item {
+		public ItemA(Date date) {
+			super( date );
+		}
+	}
+
+	private class ItemAOffer extends ItemOffer<ItemA> {
+		public ItemAOffer(ItemA item) {
+			super( item );
+		}
+	}
+}
+
+
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/Cloneable.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/Cloneable.java
new file mode 100644
index 0000000..21b2f2c
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/Cloneable.java
@@ -0,0 +1,44 @@
+// $Id: Cloneable.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints;
+
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at Constraint(validatedBy = { CloneableConstraintValidator.class })
+ at Target({ METHOD, FIELD, ANNOTATION_TYPE })
+ at Retention(RUNTIME)
+ at Documented
+public @interface Cloneable {
+	public abstract String message() default "{org.hibernate.validator.constraints.Cloneable.message}";
+
+	public abstract Class<?>[] groups() default { };
+
+	public abstract Class<? extends Payload>[] payload() default { };
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/CloneableConstraintValidator.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/CloneableConstraintValidator.java
new file mode 100644
index 0000000..88c5a7b
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/CloneableConstraintValidator.java
@@ -0,0 +1,34 @@
+// $Id: CloneableConstraintValidator.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class CloneableConstraintValidator implements ConstraintValidator<org.hibernate.validator.test.constraints.Cloneable, java.lang.Cloneable> {
+
+	public void initialize(org.hibernate.validator.test.constraints.Cloneable annotation) {
+	}
+
+	public boolean isValid(java.lang.Cloneable value, ConstraintValidatorContext constraintValidatorContext) {
+		return true;
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/ConstraintTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/ConstraintTest.java
new file mode 100644
index 0000000..73b253e
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/ConstraintTest.java
@@ -0,0 +1,68 @@
+// $Id: ConstraintTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints;
+
+import java.util.Set;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.test.util.TestUtil;
+
+import static org.hibernate.validator.test.util.TestUtil.assertConstraintViolation;
+import static org.hibernate.validator.test.util.TestUtil.assertNumberOfViolations;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class ConstraintTest {
+
+	@Test
+	public void testRangeConstraint() {
+		Validator validator = TestUtil.getValidator();
+
+		Elevator elevator = new Elevator();
+		elevator.setCurrentFloor( -3 );
+		Set<ConstraintViolation<Elevator>> constraintViolations = validator.validate( elevator );
+
+		assertNumberOfViolations( constraintViolations, 1 );
+		assertConstraintViolation( constraintViolations.iterator().next(), "Invalid floor" );
+
+		elevator.setCurrentFloor( -2 );
+		constraintViolations = validator.validate( elevator );
+
+		assertNumberOfViolations( constraintViolations, 0 );
+
+		elevator.setCurrentFloor( 45 );
+		constraintViolations = validator.validate( elevator );
+
+		assertNumberOfViolations( constraintViolations, 0 );
+
+		elevator.setCurrentFloor( 50 );
+		constraintViolations = validator.validate( elevator );
+
+		assertNumberOfViolations( constraintViolations, 0 );
+
+		elevator.setCurrentFloor( 51 );
+		constraintViolations = validator.validate( elevator );
+
+		assertNumberOfViolations( constraintViolations, 1 );
+		assertConstraintViolation( constraintViolations.iterator().next(), "Invalid floor" );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/ConstraintValidatorContextTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/ConstraintValidatorContextTest.java
new file mode 100644
index 0000000..f4fc99d
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/ConstraintValidatorContextTest.java
@@ -0,0 +1,160 @@
+// $Id: ConstraintValidatorContextTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints;
+
+import java.util.List;
+import java.util.Set;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.engine.ConstraintValidatorContextImpl;
+import org.hibernate.validator.engine.MessageAndPath;
+import org.hibernate.validator.engine.PathImpl;
+import org.hibernate.validator.test.util.TestUtil;
+
+import static org.hibernate.validator.test.util.TestUtil.assertCorrectPropertyPaths;
+import static org.hibernate.validator.test.util.TestUtil.assertNumberOfViolations;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class ConstraintValidatorContextTest {
+
+	/**
+	 * HV-198
+	 */
+	@Test
+	public void testCorrectSubNodePath() {
+		Validator validator = TestUtil.getValidator();
+
+		Item item = new Item();
+		item.interval = new Interval();
+		item.interval.start = 10;
+		item.interval.end = 5;
+
+		Set<ConstraintViolation<Item>> constraintViolations = validator.validate( item );
+		assertNumberOfViolations( constraintViolations, 1 );
+		assertCorrectPropertyPaths( constraintViolations, "interval.start" );
+	}
+
+	/**
+	 * HV-208
+	 */
+	@Test
+	public void testCorrectPath() {
+		Validator validator = TestUtil.getValidator();
+
+		Item item = new Item();
+		Interval interval = new Interval();
+		item.interval = interval;
+		item.interval.start = 10;
+		item.interval.end = 5;
+
+		Set<ConstraintViolation<Interval>> constraintViolations = validator.validate( interval );
+		assertNumberOfViolations( constraintViolations, 1 );
+		assertCorrectPropertyPaths( constraintViolations, "start" );
+	}
+
+	@Test
+	public void testDifferentPaths() {
+		String message = "message";
+		ConstraintValidatorContextImpl context = createEmptyConstraintValidatorContextImpl();
+		context.buildConstraintViolationWithTemplate( message )
+				.addNode( "foo" )
+				.addNode( "bar" ).inIterable().atIndex( 3 )
+				.addConstraintViolation();
+
+		List<MessageAndPath> messageAndPathList = context.getMessageAndPathList();
+		assertMessageAndPath( messageAndPathList.get( 0 ), message, "foo[3].bar" );
+
+
+		context = createEmptyConstraintValidatorContextImpl();
+		context.buildConstraintViolationWithTemplate( message )
+				.addNode( "foo" )
+				.addNode( null ).inIterable().atKey( "test" )
+				.addConstraintViolation();
+
+		messageAndPathList = context.getMessageAndPathList();
+		assertMessageAndPath( messageAndPathList.get( 0 ), message, "foo[test]" );
+
+		context = createEmptyConstraintValidatorContextImpl();
+		context.buildConstraintViolationWithTemplate( message )
+				.addNode( "foo" )
+				.addNode( "bar" ).inIterable().atKey( "test" )
+				.addNode( "fubar" )
+				.addConstraintViolation();
+
+		messageAndPathList = context.getMessageAndPathList();
+		assertMessageAndPath( messageAndPathList.get( 0 ), message, "foo[test].bar.fubar" );
+
+		context = createEmptyConstraintValidatorContextImpl();
+		context.buildConstraintViolationWithTemplate( message )
+				.addNode( "foo" )
+				.addNode( "bar" ).inIterable().atKey( "test" )
+				.addNode( "fubar" ).inIterable().atIndex( 10 )
+				.addConstraintViolation();
+
+		messageAndPathList = context.getMessageAndPathList();
+		assertMessageAndPath( messageAndPathList.get( 0 ), message, "foo[test].bar[10].fubar" );
+
+		context = createEmptyConstraintValidatorContextImpl();
+		context.buildConstraintViolationWithTemplate( message )
+				.addNode( "foo" )
+				.addNode( "bar" ).inIterable().atKey( "test" )
+				.addNode( "fubar" ).inIterable()
+				.addConstraintViolation();
+
+		messageAndPathList = context.getMessageAndPathList();
+		assertMessageAndPath( messageAndPathList.get( 0 ), message, "foo[test].bar[].fubar" );
+	}
+
+	@Test
+	public void testMultipleMessages() {
+		String message1 = "message1";
+		String message2 = "message2";
+		ConstraintValidatorContextImpl context = createEmptyConstraintValidatorContextImpl();
+		context.buildConstraintViolationWithTemplate( message1 )
+				.addNode( "foo" )
+				.addNode( "bar" ).inIterable().atKey( "key" )
+				.addConstraintViolation();
+		context.buildConstraintViolationWithTemplate( message2 )
+				.addConstraintViolation();
+
+		List<MessageAndPath> messageAndPathList = context.getMessageAndPathList();
+		assertTrue( messageAndPathList.size() == 2 );
+		assertMessageAndPath( messageAndPathList.get( 0 ), message1, "foo[key].bar" );
+		assertMessageAndPath( messageAndPathList.get( 1 ), message2, "" );
+	}
+
+	private ConstraintValidatorContextImpl createEmptyConstraintValidatorContextImpl() {
+		ConstraintValidatorContextImpl context = new ConstraintValidatorContextImpl(
+				PathImpl.createNewPath( null ), null
+		);
+		context.disableDefaultConstraintViolation();
+		return context;
+	}
+
+	private void assertMessageAndPath(MessageAndPath messageAndPath, String expectedMessage, String expectedPath) {
+		assertEquals( messageAndPath.getPath(), PathImpl.createPathFromString( expectedPath ), "Wrong path" );
+		assertEquals( messageAndPath.getMessage(), expectedMessage, "Wrong message" );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/Coordinate.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/Coordinate.java
new file mode 100644
index 0000000..3b0ee40
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/Coordinate.java
@@ -0,0 +1,35 @@
+// $Id: Coordinate.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints;
+
+/**
+ * @author Hardy Ferentschik
+ */
+/**
+ * @author Hardy Ferentschik
+ */
+public class Coordinate {
+
+	long longitude;
+	long latitude;
+
+	public Coordinate(long longitude, long latitude) {
+		this.longitude = longitude;
+		this.latitude = latitude;
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/Elevator.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/Elevator.java
new file mode 100644
index 0000000..003c10c
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/Elevator.java
@@ -0,0 +1,37 @@
+// $Id: Elevator.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints;
+
+import org.hibernate.validator.constraints.Range;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Elevator {
+
+	@Range(min = -2, max = 50, message = "Invalid floor")
+	private int currentFloor;
+
+	public int getCurrentFloor() {
+		return currentFloor;
+	}
+
+	public void setCurrentFloor(int currentFloor) {
+		this.currentFloor = currentFloor;
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/Interval.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/Interval.java
new file mode 100644
index 0000000..6aa6195
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/Interval.java
@@ -0,0 +1,28 @@
+// $Id: Interval.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints;
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at StartLessThanEnd 
+class Interval
+{
+  int start;
+  int end;
+} 
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/Item.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/Item.java
new file mode 100644
index 0000000..b5554b7
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/Item.java
@@ -0,0 +1,28 @@
+// $Id: Item.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints;
+
+import javax.validation.Valid;
+
+/**
+ * @author Hardy Ferentschik
+ */
+class Item {
+	@Valid
+	Interval interval;
+} 
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/Object.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/Object.java
new file mode 100644
index 0000000..8cc3173
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/Object.java
@@ -0,0 +1,44 @@
+// $Id: Object.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints;
+
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at Constraint(validatedBy = { ObjectConstraintValidator.class })
+ at Target({ METHOD, FIELD, ANNOTATION_TYPE })
+ at Retention(RUNTIME)
+ at Documented
+public @interface Object {
+	String message() default "{org.hibernate.validator.constraints.Object.message}";
+
+	Class<?>[] groups() default { };
+
+	Class<? extends Payload>[] payload() default { };
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/ObjectConstraintValidator.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/ObjectConstraintValidator.java
new file mode 100644
index 0000000..7616139
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/ObjectConstraintValidator.java
@@ -0,0 +1,34 @@
+// $Id: ObjectConstraintValidator.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class ObjectConstraintValidator implements ConstraintValidator<org.hibernate.validator.test.constraints.Object, java.lang.Object> {
+
+	public void initialize(org.hibernate.validator.test.constraints.Object annotation) {
+	}
+
+	public boolean isValid(java.lang.Object value, ConstraintValidatorContext constraintValidatorContext) {
+		return true;
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/PostCodeList.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/PostCodeList.java
new file mode 100644
index 0000000..9b85814
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/PostCodeList.java
@@ -0,0 +1,72 @@
+// $Id: PostCodeList.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.TYPE;
+import java.util.Collection;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+/**
+ * A test constraint which can lead to a error when trying to reslove the validator.
+ *
+ * @author Hardy Ferentschik
+ */
+ at Constraint(validatedBy = {
+		PostCodeList.PostCodeListValidatorForString.class, PostCodeList.PostCodeListValidatorForNumber.class
+})
+ at Documented
+ at Target({ METHOD, FIELD, TYPE })
+ at Retention(RUNTIME)
+public @interface PostCodeList {
+	public abstract String message() default "foobar";
+
+	public abstract Class<?>[] groups() default { };
+
+	public abstract Class<? extends Payload>[] payload() default {};
+
+	public class PostCodeListValidatorForNumber
+			implements ConstraintValidator<PostCodeList, Collection<? extends Number>> {
+		public void initialize(PostCodeList constraintAnnotation) {
+		}
+
+		public boolean isValid(Collection<? extends Number> value, ConstraintValidatorContext constraintValidatorContext) {
+			return true;
+		}
+	}
+
+	public class PostCodeListValidatorForString implements ConstraintValidator<PostCodeList, Collection<String>> {
+		public void initialize(PostCodeList constraintAnnotation) {
+		}
+
+		public boolean isValid(Collection<String> value, ConstraintValidatorContext constraintValidatorContext) {
+			if ( value == null ) {
+				return true;
+			}
+			return false;
+		}
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/Serializable.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/Serializable.java
new file mode 100644
index 0000000..a2bd850
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/Serializable.java
@@ -0,0 +1,44 @@
+// $Id: Serializable.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints;
+
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at Constraint(validatedBy = { SerializableConstraintValidator.class })
+ at Target({ METHOD, FIELD, ANNOTATION_TYPE })
+ at Retention(RUNTIME)
+ at Documented
+public @interface Serializable {
+	public abstract String message() default "{org.hibernate.validator.constraints.Serializable.message}";
+
+	public abstract Class<?>[] groups() default { };
+
+	public abstract Class<? extends Payload>[] payload() default { };
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/SerializableConstraintValidator.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/SerializableConstraintValidator.java
new file mode 100644
index 0000000..29efd12
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/SerializableConstraintValidator.java
@@ -0,0 +1,34 @@
+// $Id: SerializableConstraintValidator.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class SerializableConstraintValidator implements ConstraintValidator<Serializable, java.io.Serializable > {
+
+	public void initialize(Serializable annotation) {
+	}
+
+	public boolean isValid( java.io.Serializable value, ConstraintValidatorContext constraintValidatorContext) {
+		return true;
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/StartLessThanEnd.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/StartLessThanEnd.java
new file mode 100644
index 0000000..d96acde
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/StartLessThanEnd.java
@@ -0,0 +1,41 @@
+// $Id: StartLessThanEnd.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at Target(ElementType.TYPE)
+ at Retention(RetentionPolicy.RUNTIME)
+ at Constraint(validatedBy = StartLessThanEndImpl.class)
+public @interface StartLessThanEnd {
+	String message() default "x";
+
+	Class<?>[] groups() default { };
+
+	Class<? extends Payload>[] payload() default { };
+}
+
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/StartLessThanEndImpl.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/StartLessThanEndImpl.java
new file mode 100644
index 0000000..ad1bcc2
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/StartLessThanEndImpl.java
@@ -0,0 +1,39 @@
+// $Id: StartLessThanEndImpl.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class StartLessThanEndImpl implements ConstraintValidator<StartLessThanEnd, Interval> {
+
+	public void initialize(StartLessThanEnd constraintAnnotation) {
+	}
+
+	public boolean isValid(Interval value, ConstraintValidatorContext c) {
+		if ( value.start > value.end ) {
+			c.disableDefaultConstraintViolation();
+			c.buildConstraintViolationWithTemplate( c.getDefaultConstraintMessageTemplate() ).addNode( "start" ).addConstraintViolation();
+			return false;
+		}
+		return true;
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/SubType.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/SubType.java
new file mode 100644
index 0000000..f6162aa
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/SubType.java
@@ -0,0 +1,24 @@
+// $Id: SubType.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class SubType extends SuperType {
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/Suburb.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/Suburb.java
new file mode 100644
index 0000000..bcf7e65
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/Suburb.java
@@ -0,0 +1,96 @@
+// $Id: Suburb.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import javax.validation.constraints.Size;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Suburb {
+	public enum Facility {
+		SHOPPING_MALL, BUS_TERMINAL
+	}
+
+	@Size(min = 5, max = 10, message = "size must be between {min} and {max}")
+	private String name;
+
+	@Size(min = 2, max = 2, message = "size must be between {min} and {max}")
+	private Map<Facility, Boolean> facilities;
+
+	@Size(min = 2, message = "size must be between {min} and {max}")
+	private Set<String> streetNames;
+
+	@Size(min = 4, max = 1000, message = "size must be between {min} and {max}")
+	private Coordinate[] boundingBox;
+
+	@PostCodeList
+	private Collection<? extends Number> includedPostCodes;
+
+	public void setIncludedPostCodes(Collection<? extends Number> includedPostCodes) {
+		this.includedPostCodes = includedPostCodes;
+	}
+
+	public Collection<? extends Number> getIncludedPostcodes() {
+		return includedPostCodes;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public Map<Facility, Boolean> getFacilities() {
+		return facilities;
+	}
+
+	public void addFacility(Facility f, Boolean exist) {
+		if ( facilities == null ) {
+			facilities = new HashMap<Facility, Boolean>();
+		}
+		facilities.put( f, exist );
+	}
+
+	public Set<String> getStreetNames() {
+		return streetNames;
+	}
+
+	public void addStreetName(String streetName) {
+		if ( streetNames == null ) {
+			streetNames = new HashSet<String>();
+		}
+		streetNames.add( streetName );
+	}
+
+	public Coordinate[] getBoundingBox() {
+		return boundingBox;
+	}
+
+	public void setBoundingBox(Coordinate[] boundingBox) {
+		this.boundingBox = boundingBox;
+	}
+}
+
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/SuperType.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/SuperType.java
new file mode 100644
index 0000000..2c4fa43
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/SuperType.java
@@ -0,0 +1,24 @@
+// $Id: SuperType.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class SuperType {
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/SuperTypeArray.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/SuperTypeArray.java
new file mode 100644
index 0000000..5b7e138
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/SuperTypeArray.java
@@ -0,0 +1,44 @@
+// $Id: SuperTypeArray.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints;
+
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at Constraint(validatedBy = { SuperTypeArrayValidator.class })
+ at Target({ METHOD, FIELD, ANNOTATION_TYPE })
+ at Retention(RUNTIME)
+ at Documented
+public @interface SuperTypeArray {
+	public abstract String message() default "{org.hibernate.validator.constraints.SuperTypeArray.message}";
+
+	public abstract Class<?>[] groups() default { };
+
+	public abstract Class<? extends Payload>[] payload() default { };
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/SuperTypeArrayValidator.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/SuperTypeArrayValidator.java
new file mode 100644
index 0000000..d24a1f6
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/SuperTypeArrayValidator.java
@@ -0,0 +1,34 @@
+// $Id: SuperTypeArrayValidator.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class SuperTypeArrayValidator implements ConstraintValidator<SuperTypeArray, SuperType[]> {
+
+	public void initialize(SuperTypeArray annotation) {
+	}
+
+	public boolean isValid(SuperType[] value, ConstraintValidatorContext constraintValidatorContext) {
+		return true;
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/ValidatorResolutionTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/ValidatorResolutionTest.java
new file mode 100644
index 0000000..2e94e45
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/ValidatorResolutionTest.java
@@ -0,0 +1,213 @@
+// $Id: ValidatorResolutionTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints;
+
+import java.lang.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.test.util.TestUtil;
+import static org.hibernate.validator.test.util.TestUtil.assertConstraintViolation;
+import static org.hibernate.validator.test.util.TestUtil.assertNumberOfViolations;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class ValidatorResolutionTest {
+
+	@Test
+	public void testResolutionOfMultipleSizeValidators() {
+		Validator validator = TestUtil.getValidator();
+
+		Suburb suburb = new Suburb();
+
+		List<Integer> postcodes = new ArrayList<Integer>();
+		postcodes.add( 12345 );
+		suburb.setIncludedPostCodes( postcodes );
+
+		// all values are null and should pass
+		Set<ConstraintViolation<Suburb>> constraintViolations = validator.validate( suburb );
+		assertNumberOfViolations( constraintViolations, 0 );
+
+		suburb.setName( "" );
+		constraintViolations = validator.validate( suburb );
+		assertNumberOfViolations( constraintViolations, 1 );
+		assertConstraintViolation(
+				constraintViolations.iterator().next(), "size must be between 5 and 10", Suburb.class, "", "name"
+		);
+
+		suburb.setName( "Hoegsbo" );
+		constraintViolations = validator.validate( suburb );
+		assertNumberOfViolations( constraintViolations, 0 );
+
+		suburb.addFacility( Suburb.Facility.SHOPPING_MALL, false );
+		constraintViolations = validator.validate( suburb );
+		assertNumberOfViolations( constraintViolations, 1 );
+		assertConstraintViolation(
+				constraintViolations.iterator().next(),
+				"size must be between 2 and 2",
+				Suburb.class,
+				suburb.getFacilities(),
+				"facilities"
+		);
+
+		suburb.addFacility( Suburb.Facility.BUS_TERMINAL, true );
+		constraintViolations = validator.validate( suburb );
+		assertNumberOfViolations( constraintViolations, 0 );
+
+		suburb.addStreetName( "Sikelsgatan" );
+		constraintViolations = validator.validate( suburb );
+		assertNumberOfViolations( constraintViolations, 1 );
+		assertConstraintViolation(
+				constraintViolations.iterator().next(),
+				"size must be between 2 and 2147483647",
+				Suburb.class,
+				suburb.getStreetNames(),
+				"streetNames"
+		);
+
+		suburb.addStreetName( "Marklandsgatan" );
+		constraintViolations = validator.validate( suburb );
+		assertNumberOfViolations( constraintViolations, 0 );
+
+		Coordinate[] boundingBox = new Coordinate[3];
+		boundingBox[0] = new Coordinate( 0l, 0l );
+		boundingBox[1] = new Coordinate( 0l, 1l );
+		boundingBox[2] = new Coordinate( 1l, 0l );
+		suburb.setBoundingBox( boundingBox );
+		constraintViolations = validator.validate( suburb );
+		assertNumberOfViolations( constraintViolations, 1 );
+		assertConstraintViolation(
+				constraintViolations.iterator().next(),
+				"size must be between 4 and 1000",
+				Suburb.class,
+				suburb.getBoundingBox(),
+				"boundingBox"
+		);
+
+		boundingBox = new Coordinate[4];
+		boundingBox[0] = new Coordinate( 0l, 0l );
+		boundingBox[1] = new Coordinate( 0l, 1l );
+		boundingBox[2] = new Coordinate( 1l, 0l );
+		boundingBox[3] = new Coordinate( 1l, 1l );
+		suburb.setBoundingBox( boundingBox );
+		constraintViolations = validator.validate( suburb );
+		assertNumberOfViolations( constraintViolations, 0 );
+	}
+
+	/**
+	 * HV-233
+	 */
+	@Test
+	public void testObjectArraysAndPrimitiveArraysAreSubtypesOfObject() {
+		Validator validator = TestUtil.getValidator();
+
+		Foo testEntity = new Foo( new org.hibernate.validator.test.constraints.Object[] { }, new int[] { } );
+		Set<ConstraintViolation<Foo>> constraintViolations = validator.validate( testEntity );
+		assertNumberOfViolations( constraintViolations, 0 );
+	}
+
+	/**
+	 * HV-233
+	 */
+	@Test
+	public void testObjectArraysAndPrimitiveArraysAreSubtypesOfClonable() {
+		Validator validator = TestUtil.getValidator();
+
+		Bar testEntity = new Bar( new org.hibernate.validator.test.constraints.Object[] { }, new int[] { } );
+		Set<ConstraintViolation<Bar>> constraintViolations = validator.validate( testEntity );
+		assertNumberOfViolations( constraintViolations, 0 );
+	}
+
+	/**
+	 * HV-233
+	 */
+	@Test
+	public void testObjectArraysAndPrimitiveArraysAreSubtypesOfSerializable() {
+		Validator validator = TestUtil.getValidator();
+
+		Fubar testEntity = new Fubar( new org.hibernate.validator.test.constraints.Object[] { }, new int[] { } );
+		Set<ConstraintViolation<Fubar>> constraintViolations = validator.validate( testEntity );
+		assertNumberOfViolations( constraintViolations, 0 );
+	}
+
+	/**
+	 * HV-233
+	 */
+	@Test
+	public void testSubTypeArrayIsSubtypeOfSuperTypeArray() {
+		Validator validator = TestUtil.getValidator();
+
+		SubTypeEntity testEntity = new SubTypeEntity( new SubType[] { } );
+		Set<ConstraintViolation<SubTypeEntity>> constraintViolations = validator.validate( testEntity );
+		assertNumberOfViolations( constraintViolations, 0 );
+	}
+
+	public class Foo {
+		@org.hibernate.validator.test.constraints.Object
+		private org.hibernate.validator.test.constraints.Object[] objectArray;
+
+		@org.hibernate.validator.test.constraints.Object
+		private int[] intArray;
+
+		public Foo(org.hibernate.validator.test.constraints.Object[] objectArray, int[] intArray) {
+			this.objectArray = objectArray;
+			this.intArray = intArray;
+		}
+	}
+
+	public class Bar {
+		@org.hibernate.validator.test.constraints.Cloneable
+		private org.hibernate.validator.test.constraints.Object[] objectArray;
+
+		@org.hibernate.validator.test.constraints.Cloneable
+		private int[] intArray;
+
+		public Bar(org.hibernate.validator.test.constraints.Object[] objectArray, int[] intArray) {
+			this.objectArray = objectArray;
+			this.intArray = intArray;
+		}
+	}
+
+	public class Fubar {
+		@Serializable
+		private org.hibernate.validator.test.constraints.Object[] objectArray;
+
+		@Serializable
+		private int[] intArray;
+
+		public Fubar(org.hibernate.validator.test.constraints.Object[] objectArray, int[] intArray) {
+			this.objectArray = objectArray;
+			this.intArray = intArray;
+		}
+	}
+
+	public class SubTypeEntity {
+		@SuperTypeArray
+		private SubType[] subTypeArray;
+
+		public SubTypeEntity(SubType[] subTypeArray) {
+			this.subTypeArray = subTypeArray;
+		}
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/composition/CompositeConstraintTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/composition/CompositeConstraintTest.java
new file mode 100644
index 0000000..9c3f418
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/composition/CompositeConstraintTest.java
@@ -0,0 +1,101 @@
+// $Id: CompositeConstraintTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints.composition;
+
+import java.util.Set;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+
+import static org.testng.Assert.assertEquals;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.test.util.TestUtil;
+
+import static org.hibernate.validator.test.util.TestUtil.assertCorrectConstraintTypes;
+import static org.hibernate.validator.test.util.TestUtil.assertCorrectConstraintViolationMessages;
+import static org.hibernate.validator.test.util.TestUtil.assertNumberOfViolations;
+
+/**
+ * @author Gerhard Petracek
+ * @author Hardy Ferentschik
+ */
+public class CompositeConstraintTest {
+
+	/**
+	 * HV-182
+	 */
+	@Test
+	public void testCorrectAnnotationTypeForWithReportAsSingleViolation() {
+
+		Validator currentValidator = TestUtil.getValidator();
+
+		for ( int i = 0; i < 100; i++ ) {
+			Set<ConstraintViolation<Person>> constraintViolations = currentValidator.validate(
+					new Person(
+							null, "Gerhard"
+					)
+			);
+
+			assertNumberOfViolations( constraintViolations, 1 );
+			assertCorrectConstraintTypes( constraintViolations, ValidNameSingleViolation.class );
+			assertCorrectConstraintViolationMessages( constraintViolations, "invalid name" );
+
+			constraintViolations = currentValidator.validate(
+					new Person(
+							"G", "Gerhard"
+					)
+			);
+			assertNumberOfViolations( constraintViolations, 1 );
+			assertCorrectConstraintTypes( constraintViolations, ValidNameSingleViolation.class );
+			assertCorrectConstraintViolationMessages( constraintViolations, "invalid name" );
+		}
+	}
+
+	/**
+	 * HV-182
+	 */
+	@Test
+	public void testCorrectAnnotationTypeReportMultipleViolations() {
+
+		Validator currentValidator = TestUtil.getValidator();
+
+		for ( int i = 0; i < 100; i++ ) {
+			Set<ConstraintViolation<Person>> constraintViolations = currentValidator.validate(
+					new Person(
+							"Gerd", null
+					)
+			);
+
+			assertNumberOfViolations( constraintViolations, 1 );
+			assertCorrectConstraintTypes( constraintViolations, NotNull.class );
+			assertCorrectConstraintViolationMessages( constraintViolations, "may not be null" );
+
+			constraintViolations = currentValidator.validate(
+					new Person(
+							"Gerd", "G"
+					)
+			);
+			assertNumberOfViolations( constraintViolations, 1 );
+			assertCorrectConstraintTypes( constraintViolations, Size.class );
+			assertCorrectConstraintViolationMessages( constraintViolations, "size must be between 2 and 10" );
+		}
+	}
+}
+
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/composition/Person.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/composition/Person.java
new file mode 100644
index 0000000..4167c50
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/composition/Person.java
@@ -0,0 +1,54 @@
+// $Id: Person.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints.composition;
+
+/**
+ * Test mode for HV-182.
+ *
+ * @author Gerhard Petracek
+ * @author Hardy Ferentschik
+ */
+
+public class Person {
+	@ValidNameSingleViolation
+	private String nickName;
+
+	@ValidName
+	private String name;
+
+	public Person(String nickName, String name) {
+		this.nickName = nickName;
+		this.name = name;
+	}
+
+	public String getNickName() {
+		return nickName;
+	}
+
+	public void setNickName(String nickName) {
+		this.nickName = nickName;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/composition/ValidName.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/composition/ValidName.java
new file mode 100644
index 0000000..1f1ce59
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/composition/ValidName.java
@@ -0,0 +1,47 @@
+// $Id: ValidName.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints.composition;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+
+/**
+ * Test constraint for HV-182.
+ *
+ * @author Gerhard Petracek
+ * @author Hardy Ferentschik
+ */
+ at NotNull
+ at Size(min = 2, max = 10)
+ at Target({ METHOD, FIELD })
+ at Retention(RUNTIME)
+ at Constraint(validatedBy = { })
+public @interface ValidName {
+	public abstract String message() default "invalid name";
+
+	public abstract Class<?>[] groups() default { };
+
+	public abstract Class<? extends Payload>[] payload() default { };
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/composition/ValidNameSingleViolation.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/composition/ValidNameSingleViolation.java
new file mode 100644
index 0000000..1e8a8a0
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/composition/ValidNameSingleViolation.java
@@ -0,0 +1,49 @@
+// $Id: ValidNameSingleViolation.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints.composition;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import javax.validation.ReportAsSingleViolation;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+
+/**
+ * Test constraint for HV-182.
+ *
+ * @author Gerhard Petracek
+ * @author Hardy Ferentschik
+ */
+ at NotNull
+ at Size(min = 2, max = 10)
+ at ReportAsSingleViolation
+ at Target({ METHOD, FIELD })
+ at Retention(RUNTIME)
+ at Constraint(validatedBy = { })
+public @interface ValidNameSingleViolation {
+	String message() default "invalid name";
+
+	Class<?>[] groups() default { };
+
+	Class<? extends Payload>[] payload() default { };
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/AssertFalseValidatorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/AssertFalseValidatorTest.java
new file mode 100644
index 0000000..09329a8
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/AssertFalseValidatorTest.java
@@ -0,0 +1,47 @@
+// $Id: AssertFalseValidatorTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints.impl;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.constraints.impl.AssertFalseValidator;
+
+/**
+ * @author Alaa Nassef
+ */
+public class AssertFalseValidatorTest {
+
+	private static AssertFalseValidator constraint;
+
+	@BeforeClass
+	public static void init() {
+		constraint = new AssertFalseValidator();
+	}
+
+	@Test
+	public void testIsValid() {
+		assertTrue( constraint.isValid( null, null ) );
+		assertTrue( constraint.isValid( false, null ) );
+		assertTrue( constraint.isValid( Boolean.FALSE, null ) );
+		assertFalse( constraint.isValid( true, null ) );
+		assertFalse( constraint.isValid( Boolean.TRUE, null ) );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/AssertTrueValidatorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/AssertTrueValidatorTest.java
new file mode 100644
index 0000000..d86fca5
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/AssertTrueValidatorTest.java
@@ -0,0 +1,48 @@
+// $Id: AssertTrueValidatorTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints.impl;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.constraints.impl.AssertTrueValidator;
+
+/**
+ * @author Alaa Nassef
+ */
+public class AssertTrueValidatorTest {
+
+	private static AssertTrueValidator constraint;
+
+	@BeforeClass
+	public static void init() {
+		constraint = new AssertTrueValidator();
+	}
+
+	@Test
+	public void testIsValid() {
+		assertTrue( constraint.isValid( null, null ) );
+		assertTrue( constraint.isValid( true, null ) );
+		assertTrue( constraint.isValid( Boolean.TRUE, null ) );
+		assertFalse( constraint.isValid( false, null ) );
+		assertFalse( constraint.isValid( Boolean.FALSE, null ) );
+	}
+}
+
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/BlankValidatorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/BlankValidatorTest.java
new file mode 100644
index 0000000..a3a4fa3
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/BlankValidatorTest.java
@@ -0,0 +1,84 @@
+/*
+ * $Id: BlankValidatorTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+ *
+ * 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.test.constraints.impl;
+
+import java.util.Set;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.constraints.NotBlank;
+import org.hibernate.validator.constraints.impl.NotBlankValidator;
+
+import static org.hibernate.validator.test.util.TestUtil.assertNumberOfViolations;
+import static org.hibernate.validator.test.util.TestUtil.getValidator;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class BlankValidatorTest {
+	@Test
+	public void testConstraintValidator() {
+		NotBlankValidator constraintValidator = new NotBlankValidator();
+
+		assertTrue( constraintValidator.isValid( "a", null ) );
+		assertTrue( constraintValidator.isValid( null, null ) );
+		assertFalse( constraintValidator.isValid( "", null ) );
+		assertFalse( constraintValidator.isValid( " ", null ) );
+		assertFalse( constraintValidator.isValid( "\t", null ) );
+		assertFalse( constraintValidator.isValid( "\n", null ) );
+	}
+
+	@Test
+	public void testNotBlank() {
+		Validator validator = getValidator();
+		Foo foo = new Foo();
+
+		Set<ConstraintViolation<Foo>> constraintViolations = validator.validate( foo );
+		assertNumberOfViolations( constraintViolations, 1 );
+
+		foo.name = "";
+		constraintViolations = validator.validate( foo );
+		assertNumberOfViolations( constraintViolations, 1 );
+
+		foo.name = " ";
+		constraintViolations = validator.validate( foo );
+		assertNumberOfViolations( constraintViolations, 1 );
+
+		foo.name = "\t";
+		constraintViolations = validator.validate( foo );
+		assertNumberOfViolations( constraintViolations, 1 );
+
+		foo.name = "\n";
+		constraintViolations = validator.validate( foo );
+		assertNumberOfViolations( constraintViolations, 1 );
+
+		foo.name = "john doe";
+		constraintViolations = validator.validate( foo );
+		assertNumberOfViolations( constraintViolations, 0 );
+	}
+
+	class Foo {
+		@NotBlank
+		String name;
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/CreditCardNumberValidatorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/CreditCardNumberValidatorTest.java
new file mode 100644
index 0000000..c096ece
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/CreditCardNumberValidatorTest.java
@@ -0,0 +1,54 @@
+// $Id: CreditCardNumberValidatorTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints.impl;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.constraints.impl.CreditCardNumberValidator;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class CreditCardNumberValidatorTest {
+
+	private static CreditCardNumberValidator validator;
+
+	@BeforeClass
+	public static void init() {
+		validator = new CreditCardNumberValidator();
+	}
+
+	@Test
+	public void testInvalidCreditCardNumber() throws Exception {
+		assertFalse( validator.isValid( "1234567890123456", null ) );
+	}
+
+	@Test
+	public void testValidCreditCardNumber() throws Exception {
+		assertTrue( validator.isValid( "541234567890125", null ) );
+	}
+
+	@Test
+	public void testNullValue() throws Exception {
+		assertTrue( validator.isValid( null, null ) );
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/DateHolder.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/DateHolder.java
new file mode 100644
index 0000000..6422117
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/DateHolder.java
@@ -0,0 +1,67 @@
+// $Id: DateHolder.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints.impl;
+
+import java.util.Calendar;
+import java.util.Date;
+import javax.validation.constraints.Future;
+import javax.validation.constraints.Past;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class DateHolder {
+
+	@Past
+	private Calendar calendarWithPastDate;
+
+	@Future
+	private Calendar calendarWithFutureDate;
+
+	@Past
+	private Date past;
+
+	@Past
+	private Date future;
+
+	public DateHolder() {
+		calendarWithPastDate = Calendar.getInstance();
+		calendarWithPastDate.add( Calendar.YEAR, -1 );
+		past = calendarWithPastDate.getTime();
+
+		calendarWithFutureDate = Calendar.getInstance();
+		calendarWithFutureDate.add( Calendar.YEAR, 1 );
+		future = calendarWithFutureDate.getTime();
+	}
+
+	public Calendar getCalendarWithPastDate() {
+		return calendarWithPastDate;
+	}
+
+	public Calendar getCalendarWithFutureDate() {
+		return calendarWithFutureDate;
+	}
+
+	public Date getPast() {
+		return past;
+	}
+
+	public Date getFuture() {
+		return future;
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/DecimalMinMaxValidatorBoundaryTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/DecimalMinMaxValidatorBoundaryTest.java
new file mode 100644
index 0000000..c57133d
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/DecimalMinMaxValidatorBoundaryTest.java
@@ -0,0 +1,89 @@
+// $Id: DecimalMinMaxValidatorBoundaryTest.java 19776 2010-06-21 13:30:26Z hardy.ferentschik $
+/*
+ * 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.test.constraints.impl;
+
+import java.util.Set;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+import javax.validation.constraints.DecimalMin;
+
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.HibernateValidator;
+import org.hibernate.validator.HibernateValidatorConfiguration;
+import org.hibernate.validator.cfg.ConstraintMapping;
+import org.hibernate.validator.cfg.defs.DecimalMaxDef;
+import org.hibernate.validator.cfg.defs.DecimalMinDef;
+import org.hibernate.validator.test.util.TestUtil;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static org.hibernate.validator.test.util.TestUtil.assertCorrectConstraintTypes;
+import static org.hibernate.validator.test.util.TestUtil.assertNumberOfViolations;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class DecimalMinMaxValidatorBoundaryTest {
+	public double d;
+
+	@Test
+	public void testDecimalMinValue() {
+
+		// use programmatic mapping api to configure constraint
+		ConstraintMapping mapping = new ConstraintMapping();
+		mapping.type( DecimalMinMaxValidatorBoundaryTest.class )
+				.property( "d", FIELD )
+				.constraint( DecimalMinDef.class )
+				.value( "0.100000000000000005" );
+
+		HibernateValidatorConfiguration config = TestUtil.getConfiguration( HibernateValidator.class );
+		config.addMapping( mapping );
+
+		ValidatorFactory factory = config.buildValidatorFactory();
+		Validator validator = factory.getValidator();
+
+		this.d = 0.1;
+
+		Set<ConstraintViolation<DecimalMinMaxValidatorBoundaryTest>> constraintViolations = validator.validate( this );
+		assertNumberOfViolations( constraintViolations, 1 );
+		assertCorrectConstraintTypes( constraintViolations, DecimalMin.class );
+	}
+
+	@Test
+	public void testDecimalMaxValue() {
+
+		// use programmatic mapping api to configure constraint
+		ConstraintMapping mapping = new ConstraintMapping();
+		mapping.type( DecimalMinMaxValidatorBoundaryTest.class )
+				.property( "d", FIELD )
+				.constraint( DecimalMaxDef.class )
+				.value( "0.1" );
+
+		HibernateValidatorConfiguration config = TestUtil.getConfiguration( HibernateValidator.class );
+		config.addMapping( mapping );
+
+		ValidatorFactory factory = config.buildValidatorFactory();
+		Validator validator = factory.getValidator();
+
+		this.d = 0.1;
+
+		Set<ConstraintViolation<DecimalMinMaxValidatorBoundaryTest>> constraintViolations = validator.validate( this );
+		assertNumberOfViolations( constraintViolations, 0 );
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/DigitsValidatorForNumberTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/DigitsValidatorForNumberTest.java
new file mode 100644
index 0000000..fb9748d
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/DigitsValidatorForNumberTest.java
@@ -0,0 +1,125 @@
+// $Id: DigitsValidatorForNumberTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints.impl;
+
+import java.math.BigDecimal;
+import javax.validation.constraints.Digits;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.constraints.impl.DigitsValidatorForNumber;
+import org.hibernate.validator.util.annotationfactory.AnnotationDescriptor;
+import org.hibernate.validator.util.annotationfactory.AnnotationFactory;
+
+/**
+ * @author Alaa Nassef
+ * @author Hardy Ferentschik
+ */
+public class DigitsValidatorForNumberTest {
+
+	@Test
+	public void testIsValid() {
+
+		AnnotationDescriptor<Digits> descriptor = new AnnotationDescriptor<Digits>( Digits.class );
+		descriptor.setValue( "integer", 5 );
+		descriptor.setValue( "fraction", 2 );
+		descriptor.setValue( "message", "{validator.digits}" );
+		Digits p = AnnotationFactory.create( descriptor );
+
+		DigitsValidatorForNumber constraint = new DigitsValidatorForNumber();
+		constraint.initialize( p );
+
+
+		assertTrue( constraint.isValid( null, null ) );
+		assertTrue( constraint.isValid( Byte.valueOf( "0" ), null ) );
+		assertTrue( constraint.isValid( Double.valueOf( "500.2" ), null ) );
+
+		assertTrue( constraint.isValid( new BigDecimal( "-12345.12" ), null ) );
+		assertFalse( constraint.isValid( new BigDecimal( "-123456.12" ), null ) );
+		assertFalse( constraint.isValid( new BigDecimal( "-123456.123" ), null ) );
+		assertFalse( constraint.isValid( new BigDecimal( "-12345.123" ), null ) );
+		assertFalse( constraint.isValid( new BigDecimal( "12345.123" ), null ) );
+
+		assertTrue( constraint.isValid( Float.valueOf( "-000000000.22" ), null ) );
+		assertFalse( constraint.isValid( Integer.valueOf( "256874" ), null ) );
+		assertFalse( constraint.isValid( Double.valueOf( "12.0001" ), null ) );
+	}
+
+	@Test
+	public void testIsValidZeroLength() {
+
+		AnnotationDescriptor<Digits> descriptor = new AnnotationDescriptor<Digits>( Digits.class );
+		descriptor.setValue( "integer", 0 );
+		descriptor.setValue( "fraction", 0 );
+		descriptor.setValue( "message", "{validator.digits}" );
+		Digits p = AnnotationFactory.create( descriptor );
+
+		DigitsValidatorForNumber constraint = new DigitsValidatorForNumber();
+		constraint.initialize( p );
+
+
+		assertTrue( constraint.isValid( null, null ) );
+		assertFalse( constraint.isValid( Byte.valueOf( "0" ), null ) );
+		assertFalse( constraint.isValid( Double.valueOf( "500.2" ), null ) );
+	}
+
+	@Test(expectedExceptions = IllegalArgumentException.class)
+	public void testNegativeIntegerLength() {
+
+		AnnotationDescriptor<Digits> descriptor = new AnnotationDescriptor<Digits>( Digits.class );
+		descriptor.setValue( "integer", -1 );
+		descriptor.setValue( "fraction", 1 );
+		descriptor.setValue( "message", "{validator.digits}" );
+		Digits p = AnnotationFactory.create( descriptor );
+
+		DigitsValidatorForNumber constraint = new DigitsValidatorForNumber();
+		constraint.initialize( p );
+	}
+
+	@Test(expectedExceptions = IllegalArgumentException.class)
+	public void testNegativeFractionLength() {
+
+		AnnotationDescriptor<Digits> descriptor = new AnnotationDescriptor<Digits>( Digits.class );
+		descriptor.setValue( "integer", 1 );
+		descriptor.setValue( "fraction", -1 );
+		descriptor.setValue( "message", "{validator.digits}" );
+		Digits p = AnnotationFactory.create( descriptor );
+
+		DigitsValidatorForNumber constraint = new DigitsValidatorForNumber();
+		constraint.initialize( p );
+	}
+
+	@Test
+	public void testTrailingZerosAreTrimmed() {
+		AnnotationDescriptor<Digits> descriptor = new AnnotationDescriptor<Digits>( Digits.class );
+		descriptor.setValue( "integer", 12 );
+		descriptor.setValue( "fraction", 3 );
+		descriptor.setValue( "message", "{validator.digits}" );
+		Digits p = AnnotationFactory.create( descriptor );
+
+		DigitsValidatorForNumber constraint = new DigitsValidatorForNumber();
+		constraint.initialize( p );
+
+		assertTrue( constraint.isValid( 0.001d, null ) );
+		assertTrue( constraint.isValid( 0.00100d, null ) );
+		assertFalse( constraint.isValid( 0.0001d, null ) );
+	}
+
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/DigitsValidatorForStringTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/DigitsValidatorForStringTest.java
new file mode 100644
index 0000000..10fb228
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/DigitsValidatorForStringTest.java
@@ -0,0 +1,90 @@
+// $Id: DigitsValidatorForStringTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints.impl;
+
+import javax.validation.constraints.Digits;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.constraints.impl.DigitsValidatorForString;
+import org.hibernate.validator.util.annotationfactory.AnnotationDescriptor;
+import org.hibernate.validator.util.annotationfactory.AnnotationFactory;
+
+/**
+ * @author Alaa Nassef
+ */
+public class DigitsValidatorForStringTest {
+
+	private static DigitsValidatorForString constraint;
+
+	@BeforeClass
+	public static void init() {
+
+		AnnotationDescriptor<Digits> descriptor = new AnnotationDescriptor<Digits>( Digits.class );
+		descriptor.setValue( "integer", 5 );
+		descriptor.setValue( "fraction", 2 );
+		descriptor.setValue( "message", "{validator.digits}" );
+		Digits p = AnnotationFactory.create( descriptor );
+
+		constraint = new DigitsValidatorForString();
+		constraint.initialize( p );
+	}
+
+	@Test
+	public void testIsValid() {
+
+		assertTrue( constraint.isValid( null, null ) );
+		assertTrue( constraint.isValid( "0", null ) );
+		assertTrue( constraint.isValid( "500.2", null ) );
+		assertTrue( constraint.isValid( "-12456.22", null ) );
+		assertTrue( constraint.isValid( "-000000000.22", null ) );
+		//should throw number format exception
+		assertFalse( constraint.isValid( "", null ) );
+		assertFalse( constraint.isValid( "256874.0", null ) );
+		assertFalse( constraint.isValid( "12.0001", null ) );
+	}
+
+	@Test(expectedExceptions = IllegalArgumentException.class)
+	public void testNegativeIntegerLength() {
+
+		AnnotationDescriptor<Digits> descriptor = new AnnotationDescriptor<Digits>( Digits.class );
+		descriptor.setValue( "integer", -1 );
+		descriptor.setValue( "fraction", 1 );
+		descriptor.setValue( "message", "{validator.digits}" );
+		Digits p = AnnotationFactory.create( descriptor );
+
+		DigitsValidatorForString constraint = new DigitsValidatorForString();
+		constraint.initialize( p );
+	}
+
+	@Test(expectedExceptions = IllegalArgumentException.class)
+	public void testNegativeFractionLength() {
+
+		AnnotationDescriptor<Digits> descriptor = new AnnotationDescriptor<Digits>( Digits.class );
+		descriptor.setValue( "integer", 1 );
+		descriptor.setValue( "fraction", -1 );
+		descriptor.setValue( "message", "{validator.digits}" );
+		Digits p = AnnotationFactory.create( descriptor );
+
+		DigitsValidatorForString constraint = new DigitsValidatorForString();
+		constraint.initialize( p );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/EmailValidatorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/EmailValidatorTest.java
new file mode 100644
index 0000000..f093fa9
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/EmailValidatorTest.java
@@ -0,0 +1,94 @@
+// $Id: EmailValidatorTest.java 19796 2010-06-23 11:23:07Z hardy.ferentschik $
+/*
+* 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.test.constraints.impl;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.constraints.impl.EmailValidator;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class EmailValidatorTest {
+
+	private static EmailValidator validator;
+
+	@BeforeClass
+	public static void init() {
+		validator = new EmailValidator();
+	}
+
+	@Test
+	public void testNullAndEmptyString() throws Exception {
+		isRightEmail( "" );
+		isRightEmail( null );
+	}
+
+	@Test
+	public void testValidEmail() throws Exception {
+		isRightEmail( "emmanuel at hibernate.org" );
+		isRightEmail( "emmanuel at hibernate" );
+		isRightEmail( "emma-n_uel at hibernate" );
+		isRightEmail( "emma+nuel at hibernate.org" );
+		isRightEmail( "emma=nuel at hibernate.org" );
+		isRightEmail( "emmanuel@[123.12.2.11]" );
+		isRightEmail( "*@example.net" );
+		isRightEmail( "fred&barny at example.com" );
+		isRightEmail( "--- at example.com" );
+		isRightEmail( "foo-bar at example.net" );
+		isRightEmail( "mailbox.sub1.sub2 at this-domain" );
+	}
+
+	@Test
+	public void testInValidEmail() throws Exception {
+		isWrongEmail( "emmanuel.hibernate.org" );
+		isWrongEmail( "emma nuel at hibernate.org" );
+		isWrongEmail( "emma(nuel at hibernate.org" );
+		isWrongEmail( "emmanuel@" );
+		isWrongEmail( "emma\nnuel at hibernate.org" );
+		isWrongEmail( "emma at nuel@hibernate.org" );
+		isWrongEmail( "Just a string" );
+		isWrongEmail( "string" );
+		isWrongEmail( "me@");
+		isWrongEmail( "@example.com");
+		isWrongEmail( "me. at example.com");
+		isWrongEmail( ".me at example.com");
+		isWrongEmail( "me at example..com");
+		isWrongEmail( "me\\@example.com");
+	}
+
+	/**
+	 * HV-339
+	 */
+	@Test
+	public void testAccent() {
+		isRightEmail( "Test^Email at example.com" );
+	}
+
+	private void isRightEmail(String email) {
+		assertTrue( validator.isValid( email, null ), "Expected a valid email." );
+	}
+
+	private void isWrongEmail(String email) {
+		assertFalse( validator.isValid( email, null ), "Expected a invalid email." );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/FutureValidatorForCalendarTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/FutureValidatorForCalendarTest.java
new file mode 100644
index 0000000..f405fbd
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/FutureValidatorForCalendarTest.java
@@ -0,0 +1,65 @@
+// $Id: FutureValidatorForCalendarTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints.impl;
+
+import java.util.Calendar;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.constraints.impl.FutureValidatorForCalendar;
+
+/**
+ * @author Alaa Nassef
+ * @author Hardy Ferentschik
+ */
+public class FutureValidatorForCalendarTest {
+
+	private static FutureValidatorForCalendar constraint;
+
+	@BeforeClass
+	public static void init() {
+		constraint = new FutureValidatorForCalendar();
+	}
+
+	@Test
+	public void testIsValid() {
+		Calendar futureDate = getFutureDate();
+		Calendar pastDate = getPastDate();
+		assertTrue( constraint.isValid( null, null ) );
+		assertTrue( constraint.isValid( futureDate, null ) );
+		assertFalse( constraint.isValid( pastDate, null ) );
+	}
+
+	private Calendar getFutureDate() {
+		Calendar cal = Calendar.getInstance();
+		int year = cal.get( Calendar.YEAR );
+		cal.set( Calendar.YEAR, year + 1 );
+		return cal;
+	}
+
+	private Calendar getPastDate() {
+		Calendar cal = Calendar.getInstance();
+		int year = cal.get( Calendar.YEAR );
+		cal.set( Calendar.YEAR, year - 1 );
+		return cal;
+	}
+
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/FutureValidatorForDateTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/FutureValidatorForDateTest.java
new file mode 100644
index 0000000..f4268da
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/FutureValidatorForDateTest.java
@@ -0,0 +1,62 @@
+// $Id: FutureValidatorForDateTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints.impl;
+
+import java.util.Date;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.constraints.impl.FutureValidatorForDate;
+
+public class FutureValidatorForDateTest {
+
+	private static FutureValidatorForDate constraint;
+
+	@BeforeClass
+	public static void init() {
+		constraint = new FutureValidatorForDate();
+	}
+
+	@Test
+	public void testIsValid() {
+		Date futureDate = getFutureDate();
+		Date pastDate = getPastDate();
+		assertTrue( constraint.isValid( null, null ) );
+		assertTrue( constraint.isValid( futureDate, null ) );
+		assertFalse( constraint.isValid( new Date(), null ) );
+		assertFalse( constraint.isValid( pastDate, null ) );
+	}
+
+	private Date getFutureDate() {
+		Date date = new Date();
+		long timeStamp = date.getTime();
+		date.setTime( timeStamp + 31557600000l );
+		return date;
+	}
+
+	private Date getPastDate() {
+		Date date = new Date();
+		long timeStamp = date.getTime();
+		date.setTime( timeStamp - 31557600000l );
+		return date;
+	}
+
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/FutureValidatorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/FutureValidatorTest.java
new file mode 100644
index 0000000..408d8f6
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/FutureValidatorTest.java
@@ -0,0 +1,44 @@
+// $Id: FutureValidatorTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints.impl;
+
+import java.util.Set;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import static org.testng.Assert.assertEquals;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.test.util.TestUtil;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class FutureValidatorTest {
+
+	/**
+	 * HV-158
+	 */
+	@Test
+	public void testFutureAndPast() {
+		Validator validator = TestUtil.getValidator();
+		DateHolder dateHolder = new DateHolder();
+		Set<ConstraintViolation<DateHolder>> constraintViolations = validator.validate( dateHolder );
+		assertEquals( constraintViolations.size(), 1, "Wrong number of constraints" );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/LengthValidatorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/LengthValidatorTest.java
new file mode 100644
index 0000000..a815cbe
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/LengthValidatorTest.java
@@ -0,0 +1,88 @@
+// $Id: LengthValidatorTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints.impl;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.constraints.Length;
+import org.hibernate.validator.constraints.impl.LengthValidator;
+import org.hibernate.validator.util.annotationfactory.AnnotationDescriptor;
+import org.hibernate.validator.util.annotationfactory.AnnotationFactory;
+
+/**
+ * Tests the <code>LengthConstraint</code>.
+ *
+ * @author Hardy Ferentschik
+ */
+public class LengthValidatorTest {
+
+	@Test
+	public void testIsValid() {
+		AnnotationDescriptor<Length> descriptor = new AnnotationDescriptor<Length>( Length.class );
+		descriptor.setValue( "min", 1 );
+		descriptor.setValue( "max", 3 );
+		descriptor.setValue( "message", "{validator.length}" );
+		Length l = AnnotationFactory.create( descriptor );
+		LengthValidator constraint = new LengthValidator();
+		constraint.initialize( l );
+		assertTrue( constraint.isValid( null, null ) );
+		assertFalse( constraint.isValid( "", null ) );
+		assertTrue( constraint.isValid( "f", null ) );
+		assertTrue( constraint.isValid( "fo", null ) );
+		assertTrue( constraint.isValid( "foo", null ) );
+		assertFalse( constraint.isValid( "foobar", null ) );
+	}
+
+	@Test(expectedExceptions = IllegalArgumentException.class)
+	public void testNegativeMinValue() {
+		AnnotationDescriptor<Length> descriptor = new AnnotationDescriptor<Length>( Length.class );
+		descriptor.setValue( "min", -1 );
+		descriptor.setValue( "max", 1 );
+		descriptor.setValue( "message", "{validator.length}" );
+		Length p = AnnotationFactory.create( descriptor );
+
+		LengthValidator constraint = new LengthValidator();
+		constraint.initialize( p );
+	}
+
+	@Test(expectedExceptions = IllegalArgumentException.class)
+	public void testNegativeMaxValue() {
+		AnnotationDescriptor<Length> descriptor = new AnnotationDescriptor<Length>( Length.class );
+		descriptor.setValue( "min", 1 );
+		descriptor.setValue( "max", -1 );
+		descriptor.setValue( "message", "{validator.length}" );
+		Length p = AnnotationFactory.create( descriptor );
+
+		LengthValidator constraint = new LengthValidator();
+		constraint.initialize( p );
+	}
+
+	@Test(expectedExceptions = IllegalArgumentException.class)
+	public void testNegativeLength() {
+		AnnotationDescriptor<Length> descriptor = new AnnotationDescriptor<Length>( Length.class );
+		descriptor.setValue( "min", 5 );
+		descriptor.setValue( "max", 4 );
+		descriptor.setValue( "message", "{validator.length}" );
+		Length p = AnnotationFactory.create( descriptor );
+
+		LengthValidator constraint = new LengthValidator();
+		constraint.initialize( p );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/MaxValidatorForNumberTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/MaxValidatorForNumberTest.java
new file mode 100644
index 0000000..837999f
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/MaxValidatorForNumberTest.java
@@ -0,0 +1,104 @@
+// $Id: MaxValidatorForNumberTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints.impl;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import javax.validation.ConstraintValidator;
+import javax.validation.constraints.DecimalMax;
+import javax.validation.constraints.Max;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.constraints.impl.DecimalMaxValidatorForNumber;
+import org.hibernate.validator.constraints.impl.MaxValidatorForNumber;
+import org.hibernate.validator.util.annotationfactory.AnnotationDescriptor;
+import org.hibernate.validator.util.annotationfactory.AnnotationFactory;
+
+/**
+ * @author Alaa Nassef
+ * @author Hardy Ferentschik
+ */
+public class MaxValidatorForNumberTest {
+
+	@Test
+	public void testIsValidMax() {
+
+		AnnotationDescriptor<Max> descriptor = new AnnotationDescriptor<Max>( Max.class );
+		descriptor.setValue( "value", 15l );
+		descriptor.setValue( "message", "{validator.max}" );
+		Max m = AnnotationFactory.create( descriptor );
+
+		MaxValidatorForNumber constraint = new MaxValidatorForNumber();
+		constraint.initialize( m );
+		testMaxValidator( constraint );
+	}
+
+	@Test
+	public void testIsValidDecimalMax() {
+
+		AnnotationDescriptor<DecimalMax> descriptor = new AnnotationDescriptor<DecimalMax>( DecimalMax.class );
+		descriptor.setValue( "value", "15.0E0" );
+		descriptor.setValue( "message", "{validator.max}" );
+		DecimalMax m = AnnotationFactory.create( descriptor );
+
+		DecimalMaxValidatorForNumber constraint = new DecimalMaxValidatorForNumber();
+		constraint.initialize( m );
+		testMaxValidator( constraint );
+	}
+
+	@Test
+	public void testInitializeDecimalMaxWithInvalidValue() {
+
+		AnnotationDescriptor<DecimalMax> descriptor = new AnnotationDescriptor<DecimalMax>( DecimalMax.class );
+		descriptor.setValue( "value", "foobar" );
+		descriptor.setValue( "message", "{validator.max}" );
+		DecimalMax m = AnnotationFactory.create( descriptor );
+
+		DecimalMaxValidatorForNumber constraint = new DecimalMaxValidatorForNumber();
+		try {
+			constraint.initialize( m );
+			fail();
+		}
+		catch ( IllegalArgumentException e ) {
+			// success
+		}
+	}
+
+	private void testMaxValidator(ConstraintValidator<?, Number> constraint) {
+		byte b = 1;
+		Byte bWrapper = 127;
+		assertTrue( constraint.isValid( null, null ) );
+		assertTrue( constraint.isValid( b, null ) );
+		assertTrue( constraint.isValid( 15l, null ) );
+		assertTrue( constraint.isValid( 15, null ) );
+		assertTrue( constraint.isValid( 15.0, null ) );
+		assertTrue( constraint.isValid( BigDecimal.valueOf( -156000000000.0 ), null ) );
+		assertTrue( constraint.isValid( BigInteger.valueOf( -10000000l ), null ) );
+		assertTrue( constraint.isValid( 10, null ) );
+		assertTrue( constraint.isValid( 14.99, null ) );
+		assertTrue( constraint.isValid( -14.99, null ) );
+		assertFalse( constraint.isValid( 20, null ) );
+		assertFalse( constraint.isValid( bWrapper, null ) );
+		assertFalse( constraint.isValid( BigDecimal.valueOf( 156000000000.0 ), null ) );
+		assertFalse( constraint.isValid( BigInteger.valueOf( 10000000l ), null ) );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/MaxValidatorForStringTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/MaxValidatorForStringTest.java
new file mode 100644
index 0000000..47064e1
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/MaxValidatorForStringTest.java
@@ -0,0 +1,95 @@
+// $Id: MaxValidatorForStringTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints.impl;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.constraints.DecimalMax;
+import javax.validation.constraints.Max;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.constraints.impl.DecimalMaxValidatorForNumber;
+import org.hibernate.validator.constraints.impl.DecimalMaxValidatorForString;
+import org.hibernate.validator.constraints.impl.MaxValidatorForString;
+import org.hibernate.validator.util.annotationfactory.AnnotationDescriptor;
+import org.hibernate.validator.util.annotationfactory.AnnotationFactory;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class MaxValidatorForStringTest {
+
+	@Test
+	public void testIsValidMax() {
+
+		AnnotationDescriptor<Max> descriptor = new AnnotationDescriptor<Max>( Max.class );
+		descriptor.setValue( "value", 15l );
+		descriptor.setValue( "message", "{validator.max}" );
+		Max m = AnnotationFactory.create( descriptor );
+
+		MaxValidatorForString constraint = new MaxValidatorForString();
+		constraint.initialize( m );
+		testMaxValidator( constraint );
+	}
+
+	@Test
+	public void testIsValidDecimalMax() {
+
+		AnnotationDescriptor<DecimalMax> descriptor = new AnnotationDescriptor<DecimalMax>( DecimalMax.class );
+		descriptor.setValue( "value", "15.0E0" );
+		descriptor.setValue( "message", "{validator.max}" );
+		DecimalMax m = AnnotationFactory.create( descriptor );
+
+		DecimalMaxValidatorForString constraint = new DecimalMaxValidatorForString();
+		constraint.initialize( m );
+		testMaxValidator( constraint );
+	}
+
+	@Test
+	public void testInitializeDecimalMaxWithInvalidValue() {
+
+		AnnotationDescriptor<DecimalMax> descriptor = new AnnotationDescriptor<DecimalMax>( DecimalMax.class );
+		descriptor.setValue( "value", "foobar" );
+		descriptor.setValue( "message", "{validator.max}" );
+		DecimalMax m = AnnotationFactory.create( descriptor );
+
+		DecimalMaxValidatorForNumber constraint = new DecimalMaxValidatorForNumber();
+		try {
+			constraint.initialize( m );
+			fail();
+		}
+		catch ( IllegalArgumentException e ) {
+			// success
+		}
+	}
+
+	private void testMaxValidator(ConstraintValidator<?, String> constraint) {
+		assertTrue( constraint.isValid( null, null ) );
+		assertTrue( constraint.isValid( "15", null ) );
+		assertTrue( constraint.isValid( "15.0", null ) );
+		assertTrue( constraint.isValid( "10", null ) );
+		assertTrue( constraint.isValid( "14.99", null ) );
+		assertTrue( constraint.isValid( "-14.99", null ) );
+		assertFalse( constraint.isValid( "20", null ) );
+		//number format exception
+		assertFalse( constraint.isValid( "15l", null ) );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/MinMaxValidatorBoundaryTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/MinMaxValidatorBoundaryTest.java
new file mode 100644
index 0000000..62dbe7b
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/MinMaxValidatorBoundaryTest.java
@@ -0,0 +1,78 @@
+// $Id: MinMaxValidatorBoundaryTest.java 19776 2010-06-21 13:30:26Z hardy.ferentschik $
+/*
+ * 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.test.constraints.impl;
+
+import java.util.Set;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.test.util.TestUtil;
+
+import static junit.framework.Assert.assertFalse;
+import static org.hibernate.validator.test.util.TestUtil.assertCorrectConstraintTypes;
+import static org.hibernate.validator.test.util.TestUtil.assertNumberOfViolations;
+
+/**
+ * Check correct behaviour of {@link org.hibernate.validator.constraints.impl.MinValidatorForNumber} and
+ * {@link org.hibernate.validator.constraints.impl.MaxValidatorForNumber} on boundary values.
+ * <p/>
+ * The chosen numbers: 9223372036854775806l and 9223372036854775807l cast to
+ * the same double value.
+ *
+ * @author Carlos Vara
+ * @author Hardy Ferentschik
+ */
+public class MinMaxValidatorBoundaryTest {
+	@Min(value = 9223372036854775807l)
+	public long min;
+
+	@Max(value = 9223372036854775806l)
+	public long max;
+
+	@Test
+	public void testMinBoundaryValue() {
+		Validator validator = TestUtil.getValidator();
+
+		this.min = 9223372036854775806l;
+		this.max = 0l;
+
+		// Current min value is smaller, should fail, but it doesn't
+		Set<ConstraintViolation<MinMaxValidatorBoundaryTest>> constraintViolations = validator.validate( this );
+		assertNumberOfViolations( constraintViolations, 1 );
+		assertCorrectConstraintTypes( constraintViolations, Min.class );
+	}
+
+	@Test
+	public void testMaxBoundaryValue() {
+		Validator validator = TestUtil.getValidator();
+
+		this.min = Long.MAX_VALUE;
+		this.max = 9223372036854775807l;
+
+		// Current max value is bigger, should fail, but it doesn't
+		Set<ConstraintViolation<MinMaxValidatorBoundaryTest>> constraintViolations = validator.validate( this );
+		assertNumberOfViolations( constraintViolations, 1 );
+		assertCorrectConstraintTypes( constraintViolations, Max.class );
+	}
+}
+
+
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/MinValidatorForNumberTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/MinValidatorForNumberTest.java
new file mode 100644
index 0000000..d5017bc
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/MinValidatorForNumberTest.java
@@ -0,0 +1,102 @@
+// $Id: MinValidatorForNumberTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints.impl;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import javax.validation.ConstraintValidator;
+import javax.validation.constraints.DecimalMin;
+import javax.validation.constraints.Min;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.constraints.impl.DecimalMinValidatorForNumber;
+import org.hibernate.validator.constraints.impl.MinValidatorForNumber;
+import org.hibernate.validator.util.annotationfactory.AnnotationDescriptor;
+import org.hibernate.validator.util.annotationfactory.AnnotationFactory;
+
+/**
+ * @author Alaa Nassef
+ * @author Hardy Ferentschik
+ */
+public class MinValidatorForNumberTest {
+
+	@Test
+	public void testIsValidMinValidator() {
+		AnnotationDescriptor<Min> descriptor = new AnnotationDescriptor<Min>( Min.class );
+		descriptor.setValue( "value", 15l );
+		descriptor.setValue( "message", "{validator.min}" );
+		Min m = AnnotationFactory.create( descriptor );
+
+		MinValidatorForNumber constraint = new MinValidatorForNumber();
+		constraint.initialize( m );
+		testMinValidator( constraint );
+	}
+
+	@Test
+	public void testIsValidDecimalMinValidator() {
+		AnnotationDescriptor<DecimalMin> descriptor = new AnnotationDescriptor<DecimalMin>( DecimalMin.class );
+		descriptor.setValue( "value", "1500E-2" );
+		descriptor.setValue( "message", "{validator.min}" );
+		DecimalMin m = AnnotationFactory.create( descriptor );
+
+		DecimalMinValidatorForNumber constraint = new DecimalMinValidatorForNumber();
+		constraint.initialize( m );
+		testMinValidator( constraint );
+	}
+
+	@Test
+	public void testInitializeDecimalMaxWithInvalidValue() {
+
+		AnnotationDescriptor<DecimalMin> descriptor = new AnnotationDescriptor<DecimalMin>( DecimalMin.class );
+		descriptor.setValue( "value", "foobar" );
+		descriptor.setValue( "message", "{validator.min}" );
+		DecimalMin m = AnnotationFactory.create( descriptor );
+
+		DecimalMinValidatorForNumber constraint = new DecimalMinValidatorForNumber();
+		try {
+			constraint.initialize( m );
+			fail();
+		}
+		catch ( IllegalArgumentException e ) {
+			// success
+		}
+	}
+
+	private void testMinValidator(ConstraintValidator<?, Number> constraint) {
+		byte b = 1;
+		Byte bWrapper = 127;
+		assertTrue( constraint.isValid( null, null ) );
+		assertTrue( constraint.isValid( bWrapper, null ) );
+		assertTrue( constraint.isValid( 20, null ) );
+		assertTrue( constraint.isValid( 15l, null ) );
+		assertTrue( constraint.isValid( 15, null ) );
+		assertTrue( constraint.isValid( 15.0, null ) );
+		assertTrue( constraint.isValid( BigDecimal.valueOf( 156000000000.0 ), null ) );
+		assertTrue( constraint.isValid( BigInteger.valueOf( 10000000l ), null ) );
+		assertFalse( constraint.isValid( b, null ) );
+		assertFalse( constraint.isValid( BigDecimal.valueOf( -156000000000.0 ), null ) );
+		assertFalse( constraint.isValid( BigInteger.valueOf( -10000000l ), null ) );
+		assertFalse( constraint.isValid( 10, null ) );
+		assertFalse( constraint.isValid( 14.99, null ) );
+		assertFalse( constraint.isValid( -14.99, null ) );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/MinValidatorForStringTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/MinValidatorForStringTest.java
new file mode 100644
index 0000000..89397c3
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/MinValidatorForStringTest.java
@@ -0,0 +1,94 @@
+// $Id: MinValidatorForStringTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints.impl;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.constraints.DecimalMin;
+import javax.validation.constraints.Min;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.constraints.impl.DecimalMinValidatorForNumber;
+import org.hibernate.validator.constraints.impl.DecimalMinValidatorForString;
+import org.hibernate.validator.constraints.impl.MinValidatorForString;
+import org.hibernate.validator.util.annotationfactory.AnnotationDescriptor;
+import org.hibernate.validator.util.annotationfactory.AnnotationFactory;
+
+/**
+ * @author Alaa Nassef
+ * @author Hardy Ferentschik
+ */
+public class MinValidatorForStringTest {
+
+	@Test
+	public void testIsValidMinValidator() {
+		AnnotationDescriptor<Min> descriptor = new AnnotationDescriptor<Min>( Min.class );
+		descriptor.setValue( "value", 15l );
+		descriptor.setValue( "message", "{validator.min}" );
+		Min m = AnnotationFactory.create( descriptor );
+
+		MinValidatorForString constraint = new MinValidatorForString();
+		constraint.initialize( m );
+		testMinValidator( constraint );
+	}
+
+	@Test
+	public void testIsValidDecimalMinValidator() {
+		AnnotationDescriptor<DecimalMin> descriptor = new AnnotationDescriptor<DecimalMin>( DecimalMin.class );
+		descriptor.setValue( "value", "1500E-2" );
+		descriptor.setValue( "message", "{validator.min}" );
+		DecimalMin m = AnnotationFactory.create( descriptor );
+
+		DecimalMinValidatorForString constraint = new DecimalMinValidatorForString();
+		constraint.initialize( m );
+		testMinValidator( constraint );
+	}
+
+	@Test
+	public void testInitializeDecimalMaxWithInvalidValue() {
+
+		AnnotationDescriptor<DecimalMin> descriptor = new AnnotationDescriptor<DecimalMin>( DecimalMin.class );
+		descriptor.setValue( "value", "foobar" );
+		descriptor.setValue( "message", "{validator.min}" );
+		DecimalMin m = AnnotationFactory.create( descriptor );
+
+		DecimalMinValidatorForNumber constraint = new DecimalMinValidatorForNumber();
+		try {
+			constraint.initialize( m );
+			fail();
+		}
+		catch ( IllegalArgumentException e ) {
+			// success
+		}
+	}
+
+	private void testMinValidator(ConstraintValidator<?, String> constraint) {
+		assertTrue( constraint.isValid( null, null ) );
+		assertTrue( constraint.isValid( "20", null ) );
+		assertTrue( constraint.isValid( "15", null ) );
+		assertTrue( constraint.isValid( "15.0", null ) );
+		assertFalse( constraint.isValid( "10", null ) );
+		assertFalse( constraint.isValid( "14.99", null ) );
+		assertFalse( constraint.isValid( "-14.99", null ) );
+		//number format exception
+		assertFalse( constraint.isValid( "15l", null ) );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/NotNullValidatorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/NotNullValidatorTest.java
new file mode 100644
index 0000000..f7dabea
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/NotNullValidatorTest.java
@@ -0,0 +1,38 @@
+// $Id: NotNullValidatorTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints.impl;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.constraints.impl.NotNullValidator;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class NotNullValidatorTest {
+
+	@Test
+	public void testIsValid() {
+		NotNullValidator constraint = new NotNullValidator();
+
+		assertFalse( constraint.isValid( null, null ) );
+		assertTrue( constraint.isValid( new Object(), null ) );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/NullValidatorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/NullValidatorTest.java
new file mode 100644
index 0000000..9726822
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/NullValidatorTest.java
@@ -0,0 +1,44 @@
+// $Id: NullValidatorTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints.impl;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.constraints.impl.NullValidator;
+
+/**
+ * @author Alaa Nassef
+ */
+public class NullValidatorTest {
+
+	private static NullValidator constraint;
+
+	@BeforeClass
+	public static void init() {
+		constraint = new NullValidator();
+	}
+
+	@Test
+	public void testIsValid() {
+		assertTrue( constraint.isValid( null, null ) );
+		assertFalse( constraint.isValid( new Object(), null ) );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/PastValidatorForCalendarTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/PastValidatorForCalendarTest.java
new file mode 100644
index 0000000..9533136
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/PastValidatorForCalendarTest.java
@@ -0,0 +1,64 @@
+// $Id: PastValidatorForCalendarTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints.impl;
+
+import java.util.Calendar;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.constraints.impl.PastValidatorForCalendar;
+
+/**
+ * @author Alaa Nassef
+ * @author Hardy Ferentschik
+ */
+public class PastValidatorForCalendarTest {
+
+	private static PastValidatorForCalendar constraint;
+
+	@BeforeClass
+	public static void init() {
+		constraint = new PastValidatorForCalendar();
+	}
+
+	@Test
+	public void testIsValid() {
+		Calendar futureDate = getFutureDate();
+		Calendar pastDate = getPastDate();
+		assertTrue( constraint.isValid( null, null ) );
+		assertTrue( constraint.isValid( pastDate, null ) );
+		assertFalse( constraint.isValid( futureDate, null ) );
+	}
+
+	private Calendar getFutureDate() {
+		Calendar cal = Calendar.getInstance();
+		int year = cal.get( Calendar.YEAR );
+		cal.set( Calendar.YEAR, year + 1 );
+		return cal;
+	}
+
+	private Calendar getPastDate() {
+		Calendar cal = Calendar.getInstance();
+		int year = cal.get( Calendar.YEAR );
+		cal.set( Calendar.YEAR, year - 1 );
+		return cal;
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/PastValidatorForDateTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/PastValidatorForDateTest.java
new file mode 100644
index 0000000..0020500
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/PastValidatorForDateTest.java
@@ -0,0 +1,62 @@
+// $Id: PastValidatorForDateTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints.impl;
+
+import java.util.Date;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.constraints.impl.PastValidatorForDate;
+
+public class PastValidatorForDateTest {
+
+	private static PastValidatorForDate constraint;
+
+	@BeforeClass
+	public static void init() {
+		constraint = new PastValidatorForDate();
+	}
+
+	@Test
+	public void testIsValid() {
+		Date futureDate = getFutureDate();
+		Date pastDate = getPastDate();
+		assertTrue( constraint.isValid( null, null ) );
+		assertTrue( constraint.isValid( pastDate, null ) );
+		assertFalse( constraint.isValid( new Date(), null ) );
+		assertFalse( constraint.isValid( futureDate, null ) );
+	}
+
+	private Date getFutureDate() {
+		Date date = new Date();
+		long timeStamp = date.getTime();
+		date.setTime( timeStamp + 31557600000l );
+		return date;
+	}
+
+	private Date getPastDate() {
+		Date date = new Date();
+		long timeStamp = date.getTime();
+		date.setTime( timeStamp - 31557600000l );
+		return date;
+	}
+
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/PatternValidatorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/PatternValidatorTest.java
new file mode 100644
index 0000000..73bdd5e
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/PatternValidatorTest.java
@@ -0,0 +1,78 @@
+// $Id: PatternValidatorTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints.impl;
+
+import javax.validation.constraints.Pattern;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.constraints.impl.PatternValidator;
+import org.hibernate.validator.util.annotationfactory.AnnotationDescriptor;
+import org.hibernate.validator.util.annotationfactory.AnnotationFactory;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class PatternValidatorTest {
+
+	@Test
+	public void testIsValid() {
+		AnnotationDescriptor<Pattern> descriptor = new AnnotationDescriptor<Pattern>( Pattern.class );
+		descriptor.setValue( "regexp", "foobar" );
+		descriptor.setValue( "message", "pattern does not match" );
+		Pattern p = AnnotationFactory.create( descriptor );
+
+		PatternValidator constraint = new PatternValidator();
+		constraint.initialize( p );
+
+		assertTrue( constraint.isValid( null, null ) );
+		assertFalse( constraint.isValid( "", null ) );
+		assertFalse( constraint.isValid( "bla bla", null ) );
+		assertFalse( constraint.isValid( "This test is not foobar", null ) );
+	}
+
+	@Test
+	public void testIsValidForEmptyStringRegexp() {
+		AnnotationDescriptor<Pattern> descriptor = new AnnotationDescriptor<Pattern>( Pattern.class );
+		descriptor.setValue( "regexp", "|^.*foo$" );
+		descriptor.setValue( "message", "pattern does not match" );
+		Pattern p = AnnotationFactory.create( descriptor );
+
+		PatternValidator constraint = new PatternValidator();
+		constraint.initialize( p );
+
+		assertTrue( constraint.isValid( null, null ) );
+		assertTrue( constraint.isValid( "", null ) );
+		assertFalse( constraint.isValid( "bla bla", null ) );
+		assertTrue( constraint.isValid( "foo", null ) );
+		assertTrue( constraint.isValid( "a b c foo", null ) );
+	}
+
+	@Test(expectedExceptions = IllegalArgumentException.class)
+	public void testInvalidRegularExpression() {
+		AnnotationDescriptor<Pattern> descriptor = new AnnotationDescriptor<Pattern>( Pattern.class );
+		descriptor.setValue( "regexp", "(unbalanced parentheses" );
+		descriptor.setValue( "message", "pattern does not match" );
+		Pattern p = AnnotationFactory.create( descriptor );
+
+		PatternValidator constraint = new PatternValidator();
+		constraint.initialize( p );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/ScriptAssertValidatorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/ScriptAssertValidatorTest.java
new file mode 100644
index 0000000..2a48961
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/ScriptAssertValidatorTest.java
@@ -0,0 +1,203 @@
+// $Id: ScriptAssertValidatorTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints.impl;
+
+import java.util.Date;
+import java.util.GregorianCalendar;
+import javax.validation.ConstraintDeclarationException;
+import javax.validation.ConstraintValidator;
+
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.constraints.ScriptAssert;
+import org.hibernate.validator.constraints.impl.ScriptAssertValidator;
+import org.hibernate.validator.util.annotationfactory.AnnotationDescriptor;
+import org.hibernate.validator.util.annotationfactory.AnnotationFactory;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+/**
+ * Unit test for {@link org.hibernate.validator.constraints.impl.ScriptAssertValidator}.
+ *
+ * @author Gunnar Morling
+ */
+public class ScriptAssertValidatorTest {
+
+	@Test
+	public void scriptEvaluatesToTrue() throws Exception {
+
+		ConstraintValidator<ScriptAssert, Object> validator = getInitializedValidator( "javascript", "true" );
+
+		assertTrue( validator.isValid( new Object(), null ) );
+	}
+
+	@Test
+	public void scriptEvaluatesToFalse() throws Exception {
+
+		ConstraintValidator<ScriptAssert, Object> validator = getInitializedValidator( "javascript", "false" );
+
+		assertFalse( validator.isValid( new Object(), null ) );
+	}
+
+	@Test
+	public void scriptExpressionReferencingAnnotatedObject() throws Exception {
+
+		ConstraintValidator<ScriptAssert, Object> validator = getInitializedValidator(
+				"javascript", "_this.startDate.before(_this.endDate)"
+		);
+
+		Date startDate = new GregorianCalendar( 2009, 8, 20 ).getTime();
+		Date endDate = new GregorianCalendar( 2009, 8, 21 ).getTime();
+
+		assertTrue( validator.isValid( new CalendarEvent( startDate, endDate ), null ) );
+		assertFalse( validator.isValid( new CalendarEvent( endDate, startDate ), null ) );
+	}
+
+	@Test
+	public void scriptExpressionUsingCustomizedAlias() throws Exception {
+
+		ConstraintValidator<ScriptAssert, Object> validator = getInitializedValidator(
+				"javascript", "_.startDate.before(_.endDate)", "_"
+		);
+
+		Date startDate = new GregorianCalendar( 2009, 8, 20 ).getTime();
+		Date endDate = new GregorianCalendar( 2009, 8, 21 ).getTime();
+
+		assertFalse( validator.isValid( new CalendarEvent( endDate, startDate ), null ) );
+	}
+
+	@Test(expectedExceptions = IllegalArgumentException.class)
+	public void emptyLanguageNameRaisesException() throws Exception {
+
+		getInitializedValidator( "", "script" );
+	}
+
+	@Test(expectedExceptions = IllegalArgumentException.class)
+	public void emptyScriptRaisesException() throws Exception {
+
+		getInitializedValidator( "lang", "" );
+	}
+
+	@Test(expectedExceptions = IllegalArgumentException.class)
+	public void emptyAliasRaisesException() throws Exception {
+
+		getInitializedValidator( "lang", "script", "" );
+	}
+
+	@Test(expectedExceptions = ConstraintDeclarationException.class)
+	public void unknownLanguageNameRaisesException() throws Exception {
+
+		ConstraintValidator<ScriptAssert, Object> validator = getInitializedValidator( "foo", "script" );
+
+		validator.isValid( new Object(), null );
+	}
+
+	@Test(expectedExceptions = ConstraintDeclarationException.class)
+	public void illegalScriptExpressionRaisesException() throws Exception {
+
+		ConstraintValidator<ScriptAssert, Object> validator = getInitializedValidator( "javascript", "foo" );
+
+		validator.isValid( new Object(), null );
+	}
+
+	@Test(expectedExceptions = ConstraintDeclarationException.class)
+	public void scriptExpressionReturningNullRaisesException() throws Exception {
+
+		ConstraintValidator<ScriptAssert, Object> validator = getInitializedValidator( "javascript", "null" );
+
+		validator.isValid( new Object(), null );
+	}
+
+	@Test(expectedExceptions = ConstraintDeclarationException.class)
+	public void scriptExpressionReturningNoBooleanRaisesException() throws Exception {
+
+		ConstraintValidator<ScriptAssert, Object> validator = getInitializedValidator(
+				"javascript", "new java.util.Date()"
+		);
+
+		validator.isValid( new Object(), null );
+	}
+
+	/**
+	 * Returns a {@link org.hibernate.validator.constraints.impl.ScriptAssertValidator} initialized with a {@link ScriptAssert} with the given values.
+	 */
+	private ConstraintValidator<ScriptAssert, Object> getInitializedValidator(String lang, String script, String name) {
+
+		ConstraintValidator<ScriptAssert, Object> validator = new ScriptAssertValidator();
+		validator.initialize( getScriptAssert( lang, script, name ) );
+
+		return validator;
+	}
+
+	/**
+	 * Returns a {@link ScriptAssertValidator} initialized with a {@link ScriptAssert} with the given values.
+	 */
+	private ConstraintValidator<ScriptAssert, Object> getInitializedValidator(String lang, String script) {
+
+		ConstraintValidator<ScriptAssert, Object> validator = new ScriptAssertValidator();
+		validator.initialize( getScriptAssert( lang, script, null ) );
+
+		return validator;
+	}
+
+	/**
+	 * Returns a {@link ScriptAssert} initialized with the given values.
+	 */
+	private ScriptAssert getScriptAssert(String lang, String script, String name) {
+
+		AnnotationDescriptor<ScriptAssert> descriptor = AnnotationDescriptor.getInstance( ScriptAssert.class );
+
+		descriptor.setValue( "lang", lang );
+		descriptor.setValue( "script", script );
+		if ( name != null ) {
+			descriptor.setValue( "alias", name );
+		}
+
+		return AnnotationFactory.create( descriptor );
+	}
+
+	/**
+	 * An exemplary model class used in tests.
+	 *
+	 * @author Gunnar Morling
+	 */
+	private static class CalendarEvent {
+
+		private Date startDate;
+
+		private Date endDate;
+
+		public CalendarEvent(Date startDate, Date endDate) {
+
+			this.startDate = startDate;
+			this.endDate = endDate;
+		}
+
+		@SuppressWarnings("unused")
+		public Date getStartDate() {
+			return startDate;
+		}
+
+		@SuppressWarnings("unused")
+		public Date getEndDate() {
+			return endDate;
+		}
+
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/SizeValidatorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/SizeValidatorTest.java
new file mode 100644
index 0000000..d790a4f
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/SizeValidatorTest.java
@@ -0,0 +1,184 @@
+// $Id: SizeValidatorTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.constraints.impl;
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import javax.validation.ConstraintValidator;
+import javax.validation.constraints.Size;
+
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.assertFalse;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.constraints.impl.SizeValidatorForArray;
+import org.hibernate.validator.constraints.impl.SizeValidatorForArraysOfBoolean;
+import org.hibernate.validator.constraints.impl.SizeValidatorForArraysOfByte;
+import org.hibernate.validator.constraints.impl.SizeValidatorForArraysOfChar;
+import org.hibernate.validator.constraints.impl.SizeValidatorForArraysOfDouble;
+import org.hibernate.validator.constraints.impl.SizeValidatorForArraysOfFloat;
+import org.hibernate.validator.constraints.impl.SizeValidatorForArraysOfInt;
+import org.hibernate.validator.constraints.impl.SizeValidatorForArraysOfLong;
+import org.hibernate.validator.constraints.impl.SizeValidatorForArraysOfShort;
+import org.hibernate.validator.constraints.impl.SizeValidatorForCollection;
+import org.hibernate.validator.constraints.impl.SizeValidatorForMap;
+import org.hibernate.validator.constraints.impl.SizeValidatorForString;
+import org.hibernate.validator.util.annotationfactory.AnnotationDescriptor;
+import org.hibernate.validator.util.annotationfactory.AnnotationFactory;
+
+/**
+ * @author Alaa Nassef
+ */
+public class SizeValidatorTest {
+
+
+	@Test
+	public void testIsValidObjectArray() throws Exception {
+		ConstraintValidator<Size, Object[]> validator = getValidator( SizeValidatorForArray.class );
+		assertSizes( validator, Object[].class );
+	}
+
+	@Test
+	public void testIsValidBooleanArray() throws Exception {
+		ConstraintValidator<Size, boolean[]> validator = getValidator( SizeValidatorForArraysOfBoolean.class );
+		assertSizes( validator, boolean[].class );
+	}
+
+	@Test
+	public void testIsValidByteArray() throws Exception {
+		ConstraintValidator<Size, byte[]> validator = getValidator( SizeValidatorForArraysOfByte.class );
+		assertSizes( validator, byte[].class );
+	}
+
+	@Test
+	public void testIsValidCharArray() throws Exception {
+		ConstraintValidator<Size, char[]> validator = getValidator( SizeValidatorForArraysOfChar.class );
+		assertSizes( validator, char[].class );
+	}
+
+	@Test
+	public void testIsValidDoubleArray() throws Exception {
+		ConstraintValidator<Size, double[]> validator = getValidator( SizeValidatorForArraysOfDouble.class );
+		assertSizes( validator, double[].class );
+	}
+
+	@Test
+	public void testIsValidFloatArray() throws Exception {
+		ConstraintValidator<Size, float[]> validator = getValidator( SizeValidatorForArraysOfFloat.class );
+		assertSizes( validator, float[].class );
+	}
+
+	@Test
+	public void testIsValidIntArray() throws Exception {
+		ConstraintValidator<Size, int[]> validator = getValidator( SizeValidatorForArraysOfInt.class );
+		assertSizes( validator, int[].class );
+	}
+
+	@Test
+	public void testIsValidLongArray() throws Exception {
+		ConstraintValidator<Size, long[]> validator = getValidator( SizeValidatorForArraysOfLong.class );
+		assertSizes( validator, long[].class );
+	}
+
+	@Test
+	public void testIsValidShortArray() throws Exception {
+		ConstraintValidator<Size, short[]> validator = getValidator( SizeValidatorForArraysOfShort.class );
+		assertSizes( validator, short[].class );
+	}
+
+	@Test
+	public void testIsValidCollection() throws Exception {
+		ConstraintValidator<Size, Collection> validator = getValidator( SizeValidatorForCollection.class );
+
+		assertTrue( validator.isValid( null, null ) );
+
+		Collection<String> collection = new ArrayList<String>();
+		assertFalse( validator.isValid( collection, null ) );
+
+		collection.add( "firstItem" );
+		assertTrue( validator.isValid( collection, null ) );
+
+		collection.add( "secondItem" );
+		assertTrue( validator.isValid( collection, null ) );
+
+		collection.add( "thirdItem" );
+		assertFalse( validator.isValid( collection, null ) );
+	}
+
+	@Test
+	public void testIsValidMap() throws Exception {
+		ConstraintValidator<Size, Map> validator = getValidator( SizeValidatorForMap.class );
+
+		assertTrue( validator.isValid( null, null ) );
+
+		Map<String, String> map = new HashMap<String, String>();
+		assertFalse( validator.isValid( map, null ) );
+
+		map.put( "key1", "firstItem" );
+		assertTrue( validator.isValid( map, null ) );
+
+		map.put( "key3", "secondItem" );
+		assertTrue( validator.isValid( map, null ) );
+
+		map.put( "key2", "thirdItem" );
+		assertFalse( validator.isValid( map, null ) );
+	}
+
+	@Test
+	public void testIsValiString() throws Exception {
+		ConstraintValidator<Size, String> validator = getValidator( SizeValidatorForString.class );
+
+		assertTrue( validator.isValid( null, null ) );
+		assertFalse( validator.isValid( "", null ) );
+		assertTrue( validator.isValid( "a", null ) );
+		assertTrue( validator.isValid( "ab", null ) );
+		assertFalse( validator.isValid( "abc", null ) );
+	}
+
+	private <T> ConstraintValidator<Size, T> getValidator(Class<?> validatorClass) throws Exception {
+		AnnotationDescriptor<Size> descriptor = new AnnotationDescriptor<Size>( Size.class );
+		descriptor.setValue( "min", 1 );
+		descriptor.setValue( "max", 2 );
+		descriptor.setValue( "message", "{validator.max}" );
+		Size m = AnnotationFactory.create( descriptor );
+		@SuppressWarnings("unchecked")
+		ConstraintValidator<Size, T> validator = ( ConstraintValidator<Size, T> ) validatorClass.newInstance();
+		validator.initialize( m );
+		return validator;
+	}
+
+	@SuppressWarnings("unchecked")
+	private <T> void assertSizes(ConstraintValidator<Size, T> validator, Class<T> arrayType) {
+		assertTrue( validator.isValid( null, null ) );
+
+		T array = ( T ) Array.newInstance( arrayType.getComponentType(), 0 );
+		assertFalse( validator.isValid( array, null ) );
+
+		array = ( T ) Array.newInstance( arrayType.getComponentType(), 1 );
+		assertTrue( validator.isValid( array, null ) );
+
+		array = ( T ) Array.newInstance( arrayType.getComponentType(), 2 );
+		assertTrue( validator.isValid( array, null ) );
+
+		array = ( T ) Array.newInstance( arrayType.getComponentType(), 3 );
+		assertFalse( validator.isValid( array, null ) );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/URLValidatorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/URLValidatorTest.java
new file mode 100644
index 0000000..a5bd932
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/constraints/impl/URLValidatorTest.java
@@ -0,0 +1,122 @@
+// $Id: URLValidatorTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, 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.test.constraints.impl;
+
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.constraints.URL;
+import org.hibernate.validator.constraints.impl.URLValidator;
+import org.hibernate.validator.util.annotationfactory.AnnotationDescriptor;
+import org.hibernate.validator.util.annotationfactory.AnnotationFactory;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+/**
+ * Tests the {@code URL} constraint. See HV-229
+ *
+ * @author Hardy Ferentschik
+ */
+public class URLValidatorTest {
+
+	@Test
+	public void testIsValidUrl() {
+		AnnotationDescriptor<URL> descriptor = new AnnotationDescriptor<URL>( URL.class );
+		URL url = AnnotationFactory.create( descriptor );
+		URLValidator validator = new URLValidator();
+		validator.initialize( url );
+
+		assertTrue( validator.isValid( null, null ) );
+		assertFalse( validator.isValid( "http", null ) );
+		assertFalse( validator.isValid( "ftp//abc.de", null ) );
+		assertTrue( validator.isValid( "ftp://abc.de", null ) );
+	}
+
+
+	@Test
+	public void testIsValidUrlWithProtocolSpecified() {
+		AnnotationDescriptor<URL> descriptor = new AnnotationDescriptor<URL>( URL.class );
+		descriptor.setValue( "protocol", "http" );
+		URL url = AnnotationFactory.create( descriptor );
+		URLValidator validator = new URLValidator();
+		validator.initialize( url );
+
+		assertFalse( validator.isValid( "ftp://abc.de", null ) );
+		assertTrue( validator.isValid( "http://abc.de", null ) );
+
+		descriptor = new AnnotationDescriptor<URL>( URL.class );
+		descriptor.setValue( "protocol", "file" );
+		url = AnnotationFactory.create( descriptor );
+		validator = new URLValidator();
+		validator.initialize( url );
+		assertFalse( validator.isValid( "http://abc.de", null ) );
+		assertTrue( validator.isValid( "file://Users/foobar/tmp", null ) );
+	}
+
+	@Test
+	public void testIsValidUrlWithPortSpecified() {
+		AnnotationDescriptor<URL> descriptor = new AnnotationDescriptor<URL>( URL.class );
+		descriptor.setValue( "port", 21 );
+		URL url = AnnotationFactory.create( descriptor );
+		URLValidator validator = new URLValidator();
+		validator.initialize( url );
+
+		assertFalse( validator.isValid( "ftp://abc.de", null ) );
+		assertTrue( validator.isValid( "ftp://abc.de:21", null ) );
+	}
+
+	@Test
+	public void testIsValidUrlWithHostSpecified() {
+		AnnotationDescriptor<URL> descriptor = new AnnotationDescriptor<URL>( URL.class );
+		descriptor.setValue( "host", "foobar.com" );
+		URL url = AnnotationFactory.create( descriptor );
+		URLValidator validator = new URLValidator();
+		validator.initialize( url );
+
+		assertFalse( validator.isValid( "http://fubar.com/this/is/foobar.html", null ) );
+		assertTrue( validator.isValid( "http://foobar.com/this/is/foobar.html", null ) );
+	}
+
+	@Test
+	public void testIsValidUrlWithProtocolHostAndPort() {
+		AnnotationDescriptor<URL> descriptor = new AnnotationDescriptor<URL>( URL.class );
+		descriptor.setValue( "protocol", "http" );
+		descriptor.setValue( "host", "www.hibernate.org" );
+		descriptor.setValue( "port", 80 );
+		URL url = AnnotationFactory.create( descriptor );
+		URLValidator validator = new URLValidator();
+		validator.initialize( url );
+
+		assertFalse( validator.isValid( "ftp://www#hibernate#org:80", null ) );
+		assertTrue( validator.isValid( "http://www.hibernate.org:80", null ) );
+	}
+
+	@Test
+	public void testIsValidEmptyString() {
+		// HV-323
+		AnnotationDescriptor<URL> descriptor = new AnnotationDescriptor<URL>( URL.class );
+		descriptor.setValue( "protocol", "http" );
+		descriptor.setValue( "host", "www.hibernate.org" );
+		descriptor.setValue( "port", 80 );
+		URL url = AnnotationFactory.create( descriptor );
+		URLValidator validator = new URLValidator();
+		validator.initialize( url );
+
+		assertTrue( validator.isValid( "", null ) );
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/PathImplTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/PathImplTest.java
new file mode 100644
index 0000000..2c19587
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/PathImplTest.java
@@ -0,0 +1,113 @@
+// $Id: PathImplTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.engine;
+
+import java.util.Iterator;
+import javax.validation.Path;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.engine.PathImpl;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class PathImplTest {
+
+	@Test
+	public void testParsing() {
+		String property = "order[3].deliveryAddress.addressline[1]";
+		Path path = PathImpl.createPathFromString( property );
+		Iterator<Path.Node> propIter = path.iterator();
+
+		assertTrue( propIter.hasNext() );
+		Path.Node elem = propIter.next();
+		assertEquals( "order", elem.getName() );
+		assertTrue( elem.isInIterable() );
+		assertEquals( new Integer( 3 ), elem.getIndex() );
+
+		assertTrue( propIter.hasNext() );
+		elem = propIter.next();
+		assertEquals( "deliveryAddress", elem.getName() );
+		assertFalse( elem.isInIterable() );
+		assertEquals( null, elem.getIndex() );
+
+		assertTrue( propIter.hasNext() );
+		elem = propIter.next();
+		assertEquals( "addressline", elem.getName() );
+		assertTrue( elem.isInIterable() );
+		assertEquals( new Integer( 1 ), elem.getIndex() );
+
+		assertFalse( propIter.hasNext() );
+	}
+
+	@Test
+	public void testParseMapBasedProperty() {
+		String property = "order[foo].deliveryAddress";
+		Path path = PathImpl.createPathFromString( property );
+		Iterator<Path.Node> propIter = path.iterator();
+
+		assertTrue( propIter.hasNext() );
+		Path.Node elem = propIter.next();
+		assertEquals( "order", elem.getName() );
+		assertTrue( elem.isInIterable() );
+		assertEquals( "foo", elem.getKey() );
+
+		assertTrue( propIter.hasNext() );
+		elem = propIter.next();
+		assertEquals( "deliveryAddress", elem.getName() );
+		assertFalse( elem.isInIterable() );
+		assertEquals( null, elem.getIndex() );
+
+		assertFalse( propIter.hasNext() );
+	}
+
+	@Test(expectedExceptions = IllegalArgumentException.class)
+	public void testNull() {
+		PathImpl.createPathFromString( null );
+	}
+
+	@Test(expectedExceptions = IllegalArgumentException.class)
+	public void testUnbalancedBraces() {
+		PathImpl.createPathFromString( "foo[.bar" );
+	}
+
+	@Test(expectedExceptions = IllegalArgumentException.class)
+	public void testIndexInMiddleOfProperty() {
+		PathImpl.createPathFromString( "f[1]oo.bar" );
+	}
+
+	@Test(expectedExceptions = IllegalArgumentException.class)
+	public void testTrailingPathSeperator() {
+		PathImpl.createPathFromString( "foo.bar." );
+	}
+
+	@Test(expectedExceptions = IllegalArgumentException.class)
+	public void testLeadingPathSeperator() {
+		PathImpl.createPathFromString( ".foo.bar" );
+	}
+
+	@Test
+	public void testEmptyString() {
+		Path path = PathImpl.createPathFromString( "" );
+		assertTrue( path.iterator().hasNext() );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/ValidatorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/ValidatorTest.java
new file mode 100644
index 0000000..329b492
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/ValidatorTest.java
@@ -0,0 +1,74 @@
+// $Id: ValidatorTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.engine;
+
+import java.util.Set;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+import javax.validation.constraints.AssertTrue;
+import javax.validation.constraints.NotNull;
+import javax.validation.metadata.BeanDescriptor;
+
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.test.util.TestUtil;
+import static org.hibernate.validator.test.util.TestUtil.assertCorrectPropertyPaths;
+import static org.hibernate.validator.test.util.TestUtil.assertNumberOfViolations;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class ValidatorTest {
+
+	/**
+	 * HV-208
+	 */
+	@Test
+	public void testPropertyPathDoesNotStartWithLeadingDot() {
+		Validator validator = TestUtil.getValidator();
+		A testInstance = new A();
+		Set<ConstraintViolation<A>> constraintViolations = validator.validate( testInstance );
+		assertNumberOfViolations( constraintViolations, 1 );
+		assertCorrectPropertyPaths( constraintViolations, "b" );
+	}
+
+	/**
+	 * HV-132 - supper hasBoolean format
+	 */
+	@Test
+	public void testHasBoolean() {
+		Validator validator = TestUtil.getValidator();
+		BeanDescriptor beanDescr = validator.getConstraintsForClass( B.class );
+		assertTrue( beanDescr.isBeanConstrained() );
+	}
+
+	class A {
+		@NotNull
+		String b;
+	}
+
+	class B {
+		private boolean b;
+
+		@AssertTrue
+		public boolean hasB() {
+			return b;
+		}
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/customerror/CustomErrorMessageTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/customerror/CustomErrorMessageTest.java
new file mode 100644
index 0000000..65316c0
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/customerror/CustomErrorMessageTest.java
@@ -0,0 +1,47 @@
+/*
+ * $Id: CustomErrorMessageTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+ *
+ * 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.test.engine.customerror;
+
+import java.util.Set;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import org.testng.annotations.Test;
+
+import static org.hibernate.validator.test.util.TestUtil.assertCorrectConstraintViolationMessages;
+import static org.hibernate.validator.test.util.TestUtil.getValidator;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class CustomErrorMessageTest {
+	/**
+	 * HV-297
+	 *
+	 * @throws Exception in case the test fails.
+	 */
+	@Test
+	public void testReportAsSingleViolationDoesNotInfluenceCustomError() throws Exception {
+		Validator validator = getValidator();
+		DummyTestClass dummyTestClass = new DummyTestClass();
+
+		Set<ConstraintViolation<DummyTestClass>> constraintViolations = validator.validate( dummyTestClass );
+		assertCorrectConstraintViolationMessages( constraintViolations, IsValidValidator.message );
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/customerror/DummyTestClass.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/customerror/DummyTestClass.java
new file mode 100644
index 0000000..941ab43
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/customerror/DummyTestClass.java
@@ -0,0 +1,27 @@
+/*
+ * $Id: DummyTestClass.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+ *
+ * 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.test.engine.customerror;
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at IsValid
+public class DummyTestClass {
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/customerror/IsValid.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/customerror/IsValid.java
new file mode 100644
index 0000000..bb63f60
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/customerror/IsValid.java
@@ -0,0 +1,45 @@
+/*
+ * $Id: IsValid.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+ *
+ * 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.test.engine.customerror;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import javax.validation.ReportAsSingleViolation;
+import javax.validation.constraints.NotNull;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at NotNull
+ at Target(TYPE)
+ at Retention(RUNTIME)
+ at Constraint(validatedBy = IsValidValidator.class)
+ at ReportAsSingleViolation
+public @interface IsValid {
+	Class<?>[] groups() default { };
+
+	String message() default "Default error message";
+
+	Class<? extends Payload>[] payload() default { };
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/customerror/IsValidValidator.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/customerror/IsValidValidator.java
new file mode 100644
index 0000000..eca7a8a
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/customerror/IsValidValidator.java
@@ -0,0 +1,41 @@
+/*
+ * $Id: IsValidValidator.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+ *
+ * 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.test.engine.customerror;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class IsValidValidator implements ConstraintValidator<IsValid, DummyTestClass> {
+
+	public static final String message = "Custom error message";
+
+
+	public void initialize(IsValid isValid) {
+	}
+
+	public boolean isValid(DummyTestClass dummyTestClass, ConstraintValidatorContext constraintValidatorContext) {
+		constraintValidatorContext.disableDefaultConstraintViolation();
+		constraintValidatorContext.buildConstraintViolationWithTemplate( message )
+				.addConstraintViolation();
+		return false;
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/Address.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/Address.java
new file mode 100644
index 0000000..d71aec5
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/Address.java
@@ -0,0 +1,81 @@
+// $Id: Address.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.engine.groups;
+
+import javax.validation.GroupSequence;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import javax.validation.groups.Default;
+
+/**
+ * @author Emmanuel Bernard
+ */
+ at GroupSequence({ Address.class, Address.HighLevelCoherence.class })
+ at ZipCodeCoherenceChecker(groups = Address.HighLevelCoherence.class)
+public class Address {
+	@NotNull
+	@Size(max = 50)
+	private String street;
+
+	@NotNull
+	@Size(max = 5)
+	private String zipcode;
+
+	@NotNull
+	@Size(max = 30)
+	private String city;
+
+	public String getStreet() {
+		return street;
+	}
+
+	public void setStreet(String street) {
+		this.street = street;
+	}
+
+	public String getZipcode() {
+		return zipcode;
+	}
+
+	public void setZipcode(String zipcode) {
+		this.zipcode = zipcode;
+	}
+
+	public String getCity() {
+		return city;
+	}
+
+	public void setCity(String city) {
+		this.city = city;
+	}
+
+	/**
+	 * Check conherence on the overall object
+	 * Needs basic checking to be green first
+	 */
+	public interface HighLevelCoherence {
+	}
+
+	/**
+	 * Check both basic constraints and high level ones.
+	 * High level constraints are not checked if basic constraints fail.
+	 */
+	@GroupSequence(value = { Default.class, HighLevelCoherence.class })
+	public interface Complete {
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/CyclicGroupSequence.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/CyclicGroupSequence.java
new file mode 100644
index 0000000..7ceedbf
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/CyclicGroupSequence.java
@@ -0,0 +1,27 @@
+// $Id: CyclicGroupSequence.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.engine.groups;
+
+import javax.validation.GroupSequence;
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at GroupSequence(value = CyclicGroupSequence.class)
+public interface CyclicGroupSequence {
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/CyclicGroupSequence1.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/CyclicGroupSequence1.java
new file mode 100644
index 0000000..f0dded0
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/CyclicGroupSequence1.java
@@ -0,0 +1,27 @@
+// $Id: CyclicGroupSequence1.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.engine.groups;
+
+import javax.validation.GroupSequence;
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at GroupSequence(value = CyclicGroupSequence2.class)
+public interface CyclicGroupSequence1 {
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/CyclicGroupSequence2.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/CyclicGroupSequence2.java
new file mode 100644
index 0000000..5b0d727
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/CyclicGroupSequence2.java
@@ -0,0 +1,27 @@
+// $Id: CyclicGroupSequence2.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.engine.groups;
+
+import javax.validation.GroupSequence;
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at GroupSequence(value = CyclicGroupSequence1.class)
+public interface CyclicGroupSequence2 {
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/First.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/First.java
new file mode 100644
index 0000000..89f90f0
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/First.java
@@ -0,0 +1,26 @@
+// $Id: First.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.engine.groups;
+
+/**
+ * Group executed first in the validation
+ *
+ * @author Emmanuel Bernard
+ */
+public interface First {
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/GroupA.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/GroupA.java
new file mode 100644
index 0000000..97251f0
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/GroupA.java
@@ -0,0 +1,10 @@
+// $Id: GroupA.java 19559 2010-05-19 16:20:53Z hardy.ferentschik $
+package org.hibernate.validator.test.engine.groups;
+
+/**
+ * @author Hardy Ferentschik
+ */
+interface GroupA {
+}
+
+
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/GroupB.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/GroupB.java
new file mode 100644
index 0000000..293c1a8
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/GroupB.java
@@ -0,0 +1,10 @@
+// $Id: GroupB.java 19559 2010-05-19 16:20:53Z hardy.ferentschik $
+package org.hibernate.validator.test.engine.groups;
+
+/**
+ * @author Hardy Ferentschik
+ */
+interface GroupB {
+}
+
+
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/GroupChainGeneratorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/GroupChainGeneratorTest.java
new file mode 100644
index 0000000..e02a847
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/GroupChainGeneratorTest.java
@@ -0,0 +1,175 @@
+// $Id: GroupChainGeneratorTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.engine.groups;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import javax.validation.GroupDefinitionException;
+import javax.validation.GroupSequence;
+import javax.validation.ValidationException;
+import javax.validation.groups.Default;
+
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.engine.groups.Group;
+import org.hibernate.validator.engine.groups.GroupChain;
+import org.hibernate.validator.engine.groups.GroupChainGenerator;
+
+import static org.testng.Assert.assertEquals;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class GroupChainGeneratorTest {
+
+	GroupChainGenerator generator;
+
+	@BeforeTest
+	public void init() {
+		generator = new GroupChainGenerator();
+	}
+
+	@Test(expectedExceptions = ValidationException.class)
+	public void testGroupChainForNonInterface() {
+		Set<Class<?>> groups = new HashSet<Class<?>>();
+		groups.add( String.class );
+		generator.getGroupChainFor( groups );
+	}
+
+	@Test(expectedExceptions = IllegalArgumentException.class)
+	public void testGroupChainForNull() {
+		generator.getGroupChainFor( null );
+	}
+
+	@Test(expectedExceptions = IllegalArgumentException.class)
+	public void testGroupChainForEmptySet() {
+		generator.getGroupChainFor( new HashSet<Class<?>>() );
+	}
+
+	@Test(expectedExceptions = ValidationException.class)
+	public void testCyclicGroupSequences() {
+		Set<Class<?>> groups = new HashSet<Class<?>>();
+		groups.add( CyclicGroupSequence1.class );
+		generator.getGroupChainFor( groups );
+	}
+
+	@Test(expectedExceptions = ValidationException.class)
+	public void testCyclicGroupSequence() {
+		Set<Class<?>> groups = new HashSet<Class<?>>();
+		groups.add( CyclicGroupSequence.class );
+		generator.getGroupChainFor( groups );
+	}
+
+	@Test
+	public void testGroupDuplicates() {
+		Set<Class<?>> groups = new HashSet<Class<?>>();
+		groups.add( First.class );
+		groups.add( Second.class );
+		groups.add( Last.class );
+		GroupChain chain = generator.getGroupChainFor( groups );
+		int count = countGroups( chain );
+		assertEquals( count, 3, "Wrong number of groups" );
+
+		groups.clear();
+		groups.add( First.class );
+		groups.add( First.class );
+		chain = generator.getGroupChainFor( groups );
+		count = countGroups( chain );
+		assertEquals( count, 1, "Wrong number of groups" );
+
+		groups.clear();
+		groups.add( First.class );
+		groups.add( Last.class );
+		groups.add( First.class );
+		chain = generator.getGroupChainFor( groups );
+		count = countGroups( chain );
+		assertEquals( count, 2, "Wrong number of groups" );
+	}
+
+	@Test(expectedExceptions = GroupDefinitionException.class)
+	public void testGroupDefiningSequencePartOfGroupComposingSequence() {
+		Set<Class<?>> groups = new HashSet<Class<?>>();
+		groups.add( Sequence1.class );
+		generator.getGroupChainFor( groups );
+	}
+
+	@Test(expectedExceptions = GroupDefinitionException.class)
+	public void testUnexpandableSequence() {
+		Set<Class<?>> groups = new HashSet<Class<?>>();
+		groups.add( Sequence3.class );
+		generator.getGroupChainFor( groups );
+	}
+
+	@Test
+	public void testExpandableSequenceWithInheritance() {
+		Set<Class<?>> groups = new HashSet<Class<?>>();
+		groups.add( Sequence4.class );
+		generator.getGroupChainFor( groups );
+	}
+
+	@Test
+	public void testSequenceResolution() {
+		Set<Class<?>> groups = new HashSet<Class<?>>();
+		groups.add( Address.Complete.class );
+		GroupChain chain = generator.getGroupChainFor( groups );
+		Iterator<List<Group>> sequences = chain.getSequenceIterator();
+		List<Group> sequence = sequences.next();
+
+		assertEquals( sequence.get( 0 ).getGroup(), Default.class, "Wrong group" );
+		assertEquals( sequence.get( 1 ).getGroup(), Address.HighLevelCoherence.class, "Wrong group" );
+	}
+
+	private int countGroups(GroupChain chain) {
+		Iterator<Group> groupIterator = chain.getGroupIterator();
+		int count = 0;
+		while ( groupIterator.hasNext() ) {
+			groupIterator.next();
+			count++;
+		}
+		return count;
+	}
+
+
+	interface GroupA extends Default {
+	}
+
+	interface GroupB {
+	}
+
+	interface GroupC extends Sequence2 {
+	}
+
+	@GroupSequence({ GroupA.class, GroupC.class })
+	interface Sequence1 {
+	}
+
+	@GroupSequence({ GroupB.class, GroupA.class })
+	interface Sequence2 {
+	}
+
+	@GroupSequence({ Sequence2.class, GroupB.class })
+	interface Sequence3 {
+	}
+
+	@GroupSequence({ Sequence2.class, GroupA.class })
+	interface Sequence4 {
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/GroupChainTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/GroupChainTest.java
new file mode 100644
index 0000000..492f010
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/GroupChainTest.java
@@ -0,0 +1,157 @@
+/*
+ * 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.
+ */
+
+// $Id: GroupChainTest.java 19559 2010-05-19 16:20:53Z hardy.ferentschik $
+package org.hibernate.validator.test.engine.groups;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.validation.GroupDefinitionException;
+import javax.validation.groups.Default;
+
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.engine.groups.Group;
+import org.hibernate.validator.engine.groups.GroupChain;
+
+import static org.testng.FileAssert.fail;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class GroupChainTest {
+	@Test
+	public void testAssertDefaultGroupSequenceIsExpandableWithDefaultAtEndOfSequence() {
+		// create a dummy sequence
+		Group a = new Group( GroupA.class, TestSequence.class );
+		Group b = new Group( GroupB.class, TestSequence.class );
+		Group c = new Group( GroupC.class, TestSequence.class );
+		Group defaultGroup = new Group(
+				Default.class, TestSequence.class
+		);
+		List<Group> sequence = new ArrayList<Group>();
+		sequence.add( a );
+		sequence.add( b );
+		sequence.add( c );
+		sequence.add( defaultGroup );
+
+		GroupChain chain = new GroupChain();
+		chain.insertSequence( sequence );
+
+		// create test default sequence
+		List<Class<?>> defaultSequence = new ArrayList<Class<?>>();
+		defaultSequence.add( Default.class );
+		defaultSequence.add( GroupA.class );
+		try {
+			chain.assertDefaultGroupSequenceIsExpandable( defaultSequence );
+			fail();
+		}
+		catch ( GroupDefinitionException e ) {
+			// success
+		}
+
+		defaultSequence.clear();
+		defaultSequence.add( GroupA.class );
+		defaultSequence.add( Default.class );
+		try {
+			chain.assertDefaultGroupSequenceIsExpandable( defaultSequence );
+			fail();
+		}
+		catch ( GroupDefinitionException e ) {
+			// success
+		}
+
+		defaultSequence.clear();
+		defaultSequence.add( Default.class );
+		defaultSequence.add( GroupC.class );
+		try {
+			chain.assertDefaultGroupSequenceIsExpandable( defaultSequence );
+			fail();
+		}
+		catch ( GroupDefinitionException e ) {
+			// success
+		}
+
+		defaultSequence.clear();
+		defaultSequence.add( GroupC.class );
+		defaultSequence.add( Default.class );
+		chain.assertDefaultGroupSequenceIsExpandable( defaultSequence );
+	}
+
+
+	@Test
+	public void testAssertDefaultGroupSequenceIsExpandableWithDefaultAtBeginningOfSequence() {
+		// create a dummy sequence
+		Group a = new Group( GroupA.class, TestSequence.class );
+		Group b = new Group( GroupB.class, TestSequence.class );
+		Group c = new Group( GroupC.class, TestSequence.class );
+		Group defaultGroup = new Group(
+				Default.class, TestSequence.class
+		);
+		List<Group> sequence = new ArrayList<Group>();
+		sequence.add( defaultGroup );
+		sequence.add( a );
+		sequence.add( b );
+		sequence.add( c );
+
+		GroupChain chain = new GroupChain();
+		chain.insertSequence( sequence );
+
+		// create test default sequence
+		List<Class<?>> defaultSequence = new ArrayList<Class<?>>();
+		defaultSequence.add( Default.class );
+		defaultSequence.add( GroupA.class );
+		chain.assertDefaultGroupSequenceIsExpandable( defaultSequence );
+
+
+		defaultSequence.clear();
+		defaultSequence.add( GroupA.class );
+		defaultSequence.add( Default.class );
+		try {
+			chain.assertDefaultGroupSequenceIsExpandable( defaultSequence );
+			fail();
+		}
+		catch ( GroupDefinitionException e ) {
+			// success
+		}
+
+		defaultSequence.clear();
+		defaultSequence.add( Default.class );
+		defaultSequence.add( GroupC.class );
+		try {
+			chain.assertDefaultGroupSequenceIsExpandable( defaultSequence );
+			fail();
+		}
+		catch ( GroupDefinitionException e ) {
+			// success
+		}
+
+		defaultSequence.clear();
+		defaultSequence.add( GroupC.class );
+		defaultSequence.add( Default.class );
+		try {
+			chain.assertDefaultGroupSequenceIsExpandable( defaultSequence );
+			fail();
+		}
+		catch ( GroupDefinitionException e ) {
+			// success
+		}
+	}
+}
+
+interface GroupC {
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/GroupsTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/GroupsTest.java
new file mode 100644
index 0000000..bdf9b8a
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/GroupsTest.java
@@ -0,0 +1,48 @@
+// $Id: GroupsTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.engine.groups;
+
+import java.util.Set;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.test.util.TestUtil;
+
+import static org.hibernate.validator.test.util.TestUtil.assertCorrectConstraintViolationMessages;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class GroupsTest {
+
+	/**
+	 * HV-288
+	 */
+	@Test
+	public void testGroupInheritance() {
+		Validator validator = TestUtil.getValidator();
+		Try tryMe = new Try();
+		tryMe.field2 = "foo";
+		tryMe.field3 = "bar";
+
+		Set<ConstraintViolation<Try>> violations = validator.validate( tryMe, Try.GlobalCheck.class );
+		assertCorrectConstraintViolationMessages(violations, "field1");
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/Last.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/Last.java
new file mode 100644
index 0000000..5dcc7eb
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/Last.java
@@ -0,0 +1,26 @@
+// $Id: Last.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.engine.groups;
+
+/**
+ * Group executed Last in the validation
+ *
+ * @author Emmanuel Bernard
+ */
+public interface Last {
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/Second.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/Second.java
new file mode 100644
index 0000000..dc670cd
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/Second.java
@@ -0,0 +1,26 @@
+// $Id: Second.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.engine.groups;
+
+/**
+ * Group executed second during the validation
+ *
+ * @author Emmanuel Bernard
+ */
+public interface Second {
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/TestSequence.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/TestSequence.java
new file mode 100644
index 0000000..18a529f
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/TestSequence.java
@@ -0,0 +1,10 @@
+// $Id: TestSequence.java 19559 2010-05-19 16:20:53Z hardy.ferentschik $
+package org.hibernate.validator.test.engine.groups;
+
+/**
+ * @author Hardy Ferentschik
+ */
+interface TestSequence {
+}
+
+
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/Try.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/Try.java
new file mode 100644
index 0000000..7074575
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/Try.java
@@ -0,0 +1,50 @@
+// $Id: Try.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.engine.groups;
+
+import javax.validation.GroupSequence;
+import javax.validation.constraints.NotNull;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Try {
+	@NotNull(message = "field1", groups = BaseComponent.class)
+	public String field1;
+
+	@NotNull(message = "field2", groups = Component.class)
+	public String field2;
+
+	@NotNull(message = "field3", groups = OtherComponent.class)
+	public String field3;
+
+	public interface BaseComponent {
+	}
+
+	public interface Component extends BaseComponent {
+	}
+
+	public interface OtherComponent {
+	}
+
+	@GroupSequence({ Component.class, OtherComponent.class })
+	public interface GlobalCheck {
+	}
+}
+
+
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/ZipCodeCoherenceChecker.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/ZipCodeCoherenceChecker.java
new file mode 100644
index 0000000..1170ba2
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/ZipCodeCoherenceChecker.java
@@ -0,0 +1,39 @@
+// $Id: ZipCodeCoherenceChecker.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.engine.groups;
+
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+
+/**
+ * @author Emmanuel Bernard
+ */
+ at Target({ TYPE, ANNOTATION_TYPE })
+ at Retention(RUNTIME)
+ at Documented
+ at Constraint(validatedBy = ZipCodeCoherenceValidator.class)
+public @interface ZipCodeCoherenceChecker {
+	public abstract String message() default "{validator.zipCodeCoherenceChecker}";
+
+	public abstract Class<?>[] groups() default { };
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/ZipCodeCoherenceValidator.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/ZipCodeCoherenceValidator.java
new file mode 100644
index 0000000..d7cdb29
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/groups/ZipCodeCoherenceValidator.java
@@ -0,0 +1,34 @@
+// $Id: ZipCodeCoherenceValidator.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.engine.groups;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class ZipCodeCoherenceValidator implements ConstraintValidator<ZipCodeCoherenceChecker, Address> {
+
+	public void initialize(ZipCodeCoherenceChecker parameters) {
+	}
+
+	public boolean isValid(Address value, ConstraintValidatorContext constraintValidatorContext) {
+		return false;
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/messageinterpolation/MessageInterpolationTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/messageinterpolation/MessageInterpolationTest.java
new file mode 100644
index 0000000..b3dd248
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/messageinterpolation/MessageInterpolationTest.java
@@ -0,0 +1,121 @@
+// $Id: MessageInterpolationTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.engine.messageinterpolation;
+
+import java.io.ByteArrayInputStream;
+import java.util.Locale;
+import java.util.PropertyResourceBundle;
+import java.util.ResourceBundle;
+import javax.validation.Configuration;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validation;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator;
+import org.hibernate.validator.resourceloading.ResourceBundleLocator;
+
+import static org.testng.Assert.assertEquals;
+
+/**
+ * Tests for HV-184
+ *
+ * @author Hardy Ferentschik
+ */
+public class MessageInterpolationTest {
+	private Validator validator;
+
+	@BeforeClass
+	public void createValidator() throws Exception {
+		final StringBuilder lines = new StringBuilder();
+		lines.append( "bar=Message is \\\\{escaped\\\\}" ).append( "\r\n" );
+		lines.append( "baz=Message is US$ {value}" ).append( "\r\n" );
+		lines.append( "qux=Message is {missing}" ).append( "\r\n" );
+		lines.append( "escaped=wrong" ).append( "\r\n" );
+		final ResourceBundle bundle = new PropertyResourceBundle(
+				new ByteArrayInputStream( lines.toString().getBytes() )
+		);
+		Configuration<?> config = Validation.byDefaultProvider()
+				.configure()
+				.messageInterpolator(
+						new ResourceBundleMessageInterpolator(
+								new ResourceBundleLocator() {
+
+									public ResourceBundle getResourceBundle(
+											Locale locale) {
+										return bundle;
+									}
+
+								}
+						)
+				);
+
+		ValidatorFactory factory = config.buildValidatorFactory();
+		validator = factory.getValidator();
+	}
+
+	@Test
+	public void testCurlyBracesEscapingShouldBeRespected() {
+		final ConstraintViolation<Foo> violation = validator.validate( new Foo(), Bar.class ).iterator().next();
+		assertEquals( violation.getMessage(), "Message is {escaped}" );
+	}
+
+	@Test
+	public void testAppendReplacementNeedsToEscapeBackslashAndDollarSign() {
+		final ConstraintViolation<Foo> violation = validator.validate( new Foo(), Baz.class ).iterator().next();
+		assertEquals( violation.getMessage(), "Message is US$ 5" );
+	}
+
+	@Test
+	public void testUnknownParametersShouldBePreserved() {
+		final ConstraintViolation<Foo> violation = validator.validate( new Foo(), Qux.class ).iterator().next();
+		assertEquals( violation.getMessage(), "Message is {missing}" );
+	}
+
+	public static interface Bar {
+	}
+
+	public static interface Baz {
+	}
+
+	public static interface Qux {
+	}
+
+	public static class Foo {
+		@NotNull(message = "{bar}", groups = { Bar.class })
+		public String getBar() {
+			return null;
+		}
+
+		@Min(value = 5, message = "{baz}", groups = { Baz.class })
+		public int getBaz() {
+			return 0;
+		}
+
+
+		@NotNull(message = "{qux}", groups = { Qux.class })
+		public String getQux() {
+			return null;
+		}
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/messageinterpolation/MessageInterpolationWithDefaultBundleTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/messageinterpolation/MessageInterpolationWithDefaultBundleTest.java
new file mode 100644
index 0000000..038ae8e
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/messageinterpolation/MessageInterpolationWithDefaultBundleTest.java
@@ -0,0 +1,147 @@
+// $Id: MessageInterpolationWithDefaultBundleTest.java 19582 2010-05-21 15:48:20Z hardy.ferentschik $
+/*
+* 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.test.engine.messageinterpolation;
+
+import java.util.Locale;
+import java.util.Set;
+import javax.validation.Configuration;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator;
+import org.hibernate.validator.test.util.TestUtil;
+
+import static org.hibernate.validator.test.util.TestUtil.assertCorrectConstraintViolationMessages;
+import static org.hibernate.validator.test.util.TestUtil.assertNumberOfViolations;
+
+/**
+ * Tests for correct message interpolation for messages from the default bundle.
+ *
+ * @author Hardy Ferentschik
+ * @author Gunnar Morling
+ */
+public class MessageInterpolationWithDefaultBundleTest {
+	private Locale defaultLocale;
+
+	@BeforeClass
+	public void storeDefaultLocale() {
+		defaultLocale = Locale.getDefault();
+	}
+
+	@AfterClass
+	public void restoreDefaultLocale() {
+		Locale.setDefault( defaultLocale );
+	}
+
+	/**
+	 * HV-268
+	 */
+	@Test
+	public void testEmailAndRangeMessageEnglishLocale() {
+		Configuration<?> config = TestUtil.getConfiguration( Locale.ENGLISH );
+		config.messageInterpolator( new ResourceBundleMessageInterpolator() );
+		Validator validator = config.buildValidatorFactory().getValidator();
+		User user = new User();
+		user.setEmail( "foo" );
+		user.setAge( 16 );
+		Set<ConstraintViolation<User>> constraintViolations = validator.validate( user );
+		assertNumberOfViolations( constraintViolations, 2 );
+		assertCorrectConstraintViolationMessages(
+				constraintViolations, "not a well-formed email address", "must be between 18 and 21"
+		);
+	}
+
+	/**
+	 * HV-268
+	 */
+	@Test
+	public void testEmailAndRangeMessageGermanLocale() {
+		Configuration<?> config = TestUtil.getConfiguration( Locale.GERMAN );
+		config.messageInterpolator( new ResourceBundleMessageInterpolator() );
+		Validator validator = config.buildValidatorFactory().getValidator();
+		User user = new User();
+		user.setEmail( "foo" );
+		user.setAge( 16 );
+		Set<ConstraintViolation<User>> constraintViolations = validator.validate( user );
+		assertNumberOfViolations( constraintViolations, 2 );
+		assertCorrectConstraintViolationMessages(
+				constraintViolations, "keine g\u00FCltige E-Mail-Adresse", "muss zwischen 18 und 21 liegen"
+		);
+	}
+
+	/**
+	 * HV-268
+	 */
+	@Test
+	public void testEmailAndRangeMessageFrenchLocale() {
+		Configuration<?> config = TestUtil.getConfiguration( Locale.FRENCH );
+		config.messageInterpolator( new ResourceBundleMessageInterpolator() );
+		Validator validator = config.buildValidatorFactory().getValidator();
+		User user = new User();
+		user.setEmail( "foo" );
+		user.setAge( 16 );
+		Set<ConstraintViolation<User>> constraintViolations = validator.validate( user );
+		assertNumberOfViolations( constraintViolations, 2 );
+		assertCorrectConstraintViolationMessages(
+				constraintViolations, "Addresse email mal form\u00E9e", "doit \u00EAtre entre 18 et 21"
+		);
+	}
+
+	/**
+	 * HV-306. If English is explicitly set as locale for message interpolation, it
+	 * must take precedence over the system's default locale.
+	 */
+	@Test
+	public void testThatExplicitlySetEnglishLocaleHasPrecedenceOverDefaultLocale() {
+		Configuration<?> config = TestUtil.getConfiguration( Locale.FRENCH );
+		config.messageInterpolator( new LocalizedMessageInterpolator( Locale.ENGLISH ) );
+		Validator validator = config.buildValidatorFactory().getValidator();
+		User user = new User();
+		user.setEmail( "foo" );
+		user.setAge( 16 );
+		Set<ConstraintViolation<User>> constraintViolations = validator.validate( user );
+		assertNumberOfViolations( constraintViolations, 2 );
+		assertCorrectConstraintViolationMessages(
+				constraintViolations, "not a well-formed email address", "must be between 18 and 21"
+		);
+	}
+
+	/**
+	 * A message interpolator that enforces one given locale to be used for message
+	 * interpolation.
+	 *
+	 * @author Gunnar Morling
+	 */
+	private static class LocalizedMessageInterpolator extends ResourceBundleMessageInterpolator {
+
+		private Locale locale;
+
+		public LocalizedMessageInterpolator(Locale locale) {
+			this.locale = locale;
+		}
+
+		@Override
+		public String interpolate(String messageTemplate, Context context) {
+			return interpolate( messageTemplate, context, this.locale );
+		}
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/messageinterpolation/MessageInterpolatorContextTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/messageinterpolation/MessageInterpolatorContextTest.java
new file mode 100644
index 0000000..363c2a3
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/messageinterpolation/MessageInterpolatorContextTest.java
@@ -0,0 +1,113 @@
+/*
+ * 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.
+ */
+
+// $Id: MessageInterpolatorContextTest.java 19735 2010-06-15 09:40:40Z hardy.ferentschik $
+
+package org.hibernate.validator.test.engine.messageinterpolation;
+
+import java.util.Set;
+import javax.validation.ConstraintViolation;
+import javax.validation.MessageInterpolator;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+import javax.validation.metadata.BeanDescriptor;
+import javax.validation.metadata.ConstraintDescriptor;
+import javax.validation.metadata.PropertyDescriptor;
+
+import org.hibernate.validator.HibernateValidator;
+import org.hibernate.validator.HibernateValidatorConfiguration;
+import org.hibernate.validator.cfg.ConstraintMapping;
+import org.hibernate.validator.cfg.defs.MinDef;
+import org.hibernate.validator.engine.MessageInterpolatorContext;
+import org.hibernate.validator.test.util.TestUtil;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+import static org.hibernate.validator.test.util.TestUtil.assertNumberOfViolations;
+import static org.testng.Assert.assertTrue;
+
+
+/**
+ * Tests for HV-333
+ *
+ * @author Hardy Ferentschik
+ */
+public class MessageInterpolatorContextTest {
+
+	@org.testng.annotations.Test
+	public void testInterpolatorContext() throws Exception {
+
+		// use programmatic mapping api to configure constraint
+		ConstraintMapping mapping = new ConstraintMapping();
+		mapping.type( Test.class )
+				.property( "test", FIELD )
+				.constraint( MinDef.class )
+				.value( 10 )
+				.message( "{foo}" );
+
+		// use a easy mock message interpolator to verify the right for verifying that the right MessageInterpolatorContext
+		// will be passed
+		MessageInterpolator mock = createMock( MessageInterpolator.class );
+		HibernateValidatorConfiguration config = TestUtil.getConfiguration( HibernateValidator.class );
+		config.messageInterpolator( mock );
+		config.addMapping( mapping );
+
+		ValidatorFactory factory = config.buildValidatorFactory();
+		Validator validator = factory.getValidator();
+
+		BeanDescriptor beanDescriptor = validator.getConstraintsForClass( Test.class );
+		PropertyDescriptor propertyDescriptor = beanDescriptor.getConstraintsForProperty( "test" );
+		Set<ConstraintDescriptor<?>> constraintDescriptors = propertyDescriptor.getConstraintDescriptors();
+		assertTrue( constraintDescriptors.size() == 1 );
+
+		// prepare the mock interpolator to expect the right interpolate call
+		String validatedValue = "value";
+		expect(
+				mock.interpolate(
+						"{foo}",
+						new MessageInterpolatorContext( constraintDescriptors.iterator().next(), validatedValue )
+				)
+		).andReturn( "{foo}" );
+		replay( mock );
+
+		Set<ConstraintViolation<Test>> violations = validator.validate( new Test( validatedValue ) );
+		assertNumberOfViolations( violations, 1 );
+
+		// verify that the right validatedValue was passed
+		verify( mock );
+	}
+
+
+	public static class Test {
+		private String test;
+
+		public Test(String test) {
+			this.test = test;
+		}
+
+		public String getTest() {
+			return test;
+		}
+
+		public void setTest(String test) {
+			this.test = test;
+		}
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/messageinterpolation/ResourceBundleMessageInterpolatorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/messageinterpolation/ResourceBundleMessageInterpolatorTest.java
new file mode 100644
index 0000000..df91996
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/messageinterpolation/ResourceBundleMessageInterpolatorTest.java
@@ -0,0 +1,379 @@
+// $Id: ResourceBundleMessageInterpolatorTest.java 19650 2010-06-02 09:30:55Z hardy.ferentschik $
+/*
+* 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.test.engine.messageinterpolation;
+
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.ResourceBundle;
+import javax.validation.MessageInterpolator;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.engine.MessageInterpolatorContext;
+import org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator;
+import org.hibernate.validator.metadata.ConstraintDescriptorImpl;
+import org.hibernate.validator.metadata.ConstraintHelper;
+import org.hibernate.validator.metadata.ConstraintOrigin;
+import org.hibernate.validator.resourceloading.ResourceBundleLocator;
+import org.hibernate.validator.util.annotationfactory.AnnotationDescriptor;
+import org.hibernate.validator.util.annotationfactory.AnnotationFactory;
+
+import static org.testng.Assert.assertEquals;
+
+/**
+ * Tests for message interpolation.
+ *
+ * @author Hardy Ferentschik
+ */
+public class ResourceBundleMessageInterpolatorTest {
+
+	private ResourceBundleMessageInterpolator interpolator;
+	private NotNull notNull;
+	private ConstraintDescriptorImpl<NotNull> notNullDescriptor;
+	private Size size;
+	private ConstraintDescriptorImpl<Size> sizeDescriptor;
+
+	@BeforeTest
+	public void setUp() {
+		// Create some annotations for testing using AnnotationProxies
+		AnnotationDescriptor<NotNull> descriptor = new AnnotationDescriptor<NotNull>( NotNull.class );
+		notNull = AnnotationFactory.create( descriptor );
+		notNullDescriptor = new ConstraintDescriptorImpl<NotNull>(
+				notNull,
+				new ConstraintHelper(),
+				java.lang.annotation.ElementType.FIELD,
+				ConstraintOrigin.DEFINED_LOCALLY
+		);
+
+		AnnotationDescriptor<Size> sizeAnnotationDescriptor = new AnnotationDescriptor<Size>( Size.class );
+		size = AnnotationFactory.create( sizeAnnotationDescriptor );
+		sizeDescriptor = new ConstraintDescriptorImpl<Size>(
+				size, new ConstraintHelper(), java.lang.annotation.ElementType.FIELD, ConstraintOrigin.DEFINED_LOCALLY
+		);
+	}
+
+	@Test
+	public void testSuccessfulInterpolation() {
+		interpolator = new ResourceBundleMessageInterpolator(
+				new TestResourceBundleLocator()
+		);
+		MessageInterpolator.Context context = new MessageInterpolatorContext( notNullDescriptor, null );
+		String expected = "message interpolation successful";
+		String actual = interpolator.interpolate( "{simple.key}", context );
+		assertEquals( actual, expected, "Wrong substitution" );
+
+		expected = "message interpolation successful message interpolation successful";
+		actual = interpolator.interpolate( "{simple.key} {simple.key}", context );
+		assertEquals( actual, expected, "Wrong substitution" );
+
+		expected = "The message interpolation successful completed";
+		actual = interpolator.interpolate( "The {simple.key} completed", context );
+		assertEquals( actual, expected, "Wrong substitution" );
+
+		expected = "{{simple.key}}";
+		actual = interpolator.interpolate( "{{simple.key}}", context );
+		assertEquals( actual, expected, "Wrong substitution" );
+	}
+
+	@Test
+	public void testMessageLiterals() {
+
+		interpolator = new ResourceBundleMessageInterpolator(
+				new TestResourceBundleLocator()
+		);
+		MessageInterpolator.Context context = new MessageInterpolatorContext( notNullDescriptor, null );
+
+		String expected = "{";
+		String actual = interpolator.interpolate( "\\{", context );
+		assertEquals( actual, expected, "Wrong substitution" );
+
+		expected = "}";
+		actual = interpolator.interpolate( "\\}", context );
+		assertEquals( actual, expected, "Wrong substitution" );
+
+		expected = "\\";
+		actual = interpolator.interpolate( "\\", context );
+		assertEquals( actual, expected, "Wrong substitution" );
+	}
+
+	@Test
+	public void testUnSuccessfulInterpolation() {
+		interpolator = new ResourceBundleMessageInterpolator(
+				new TestResourceBundleLocator()
+		);
+		MessageInterpolator.Context context = new MessageInterpolatorContext( notNullDescriptor, null );
+
+		String expected = "foo";  // missing {}
+		String actual = interpolator.interpolate( "foo", context );
+		assertEquals( actual, expected, "Wrong substitution" );
+
+		expected = "#{foo  {}";
+		actual = interpolator.interpolate( "#{foo  {}", context );
+		assertEquals( actual, expected, "Wrong substitution" );
+	}
+
+	@Test
+	public void testUnknownTokenInterpolation() {
+		interpolator = new ResourceBundleMessageInterpolator(
+				new TestResourceBundleLocator()
+		);
+		MessageInterpolator.Context context = new MessageInterpolatorContext( notNullDescriptor, null );
+
+		String expected = "{bar}";  // unknown token {}
+		String actual = interpolator.interpolate( "{bar}", context );
+		assertEquals( actual, expected, "Wrong substitution" );
+	}
+
+	@Test
+	public void testKeyWithDashes() {
+		interpolator = new ResourceBundleMessageInterpolator(
+				new TestResourceBundleLocator()
+		);
+		MessageInterpolator.Context context = new MessageInterpolatorContext( notNullDescriptor, null );
+
+		String expected = "message interpolation successful";  // unknown token {}
+		String actual = interpolator.interpolate( "{key-with-dashes}", context );
+		assertEquals( actual, expected, "Wrong substitution" );
+	}
+
+	@Test
+	public void testKeyWithSpaces() {
+		interpolator = new ResourceBundleMessageInterpolator(
+				new TestResourceBundleLocator()
+		);
+		MessageInterpolator.Context context = new MessageInterpolatorContext( notNullDescriptor, null );
+
+		String expected = "message interpolation successful";  // unknown token {}
+		String actual = interpolator.interpolate( "{key with spaces}", context );
+		assertEquals( actual, expected, "Wrong substitution" );
+	}
+
+	@Test
+	public void testDefaultInterpolation() {
+		interpolator = new ResourceBundleMessageInterpolator(
+				new TestResourceBundleLocator()
+		);
+		MessageInterpolator.Context context = new MessageInterpolatorContext( notNullDescriptor, null );
+
+		String expected = "may not be null";
+		String actual = interpolator.interpolate( notNull.message(), context );
+		assertEquals( actual, expected, "Wrong substitution" );
+
+		expected = "size must be between 0 and 2147483647";  // unknown token {}
+		context = new MessageInterpolatorContext( sizeDescriptor, null );
+		actual = interpolator.interpolate( size.message(), context );
+		assertEquals( actual, expected, "Wrong substitution" );
+	}
+
+	@Test
+	public void testMessageInterpolationWithLocale() {
+		interpolator = new ResourceBundleMessageInterpolator();
+
+		String expected = "kann nicht null sein";
+		MessageInterpolator.Context context = new MessageInterpolatorContext( notNullDescriptor, null );
+		String actual = interpolator.interpolate( notNull.message(), context, Locale.GERMAN );
+		assertEquals( actual, expected, "Wrong substitution" );
+	}
+
+	@Test
+	public void testUserResourceBundle() {
+		interpolator = new ResourceBundleMessageInterpolator();
+		MessageInterpolator.Context context = new MessageInterpolatorContext( notNullDescriptor, null );
+
+		String expected = "no puede ser null";
+		String actual = interpolator.interpolate( notNull.message(), context, new Locale( "es", "ES" ) );
+		assertEquals( actual, expected, "Wrong substitution" );
+	}
+
+	/**
+	 * HV-102
+	 */
+	@Test
+	public void testRecursiveMessageInterpolation() {
+		AnnotationDescriptor<Max> descriptor = new AnnotationDescriptor<Max>( Max.class );
+		descriptor.setValue( "message", "{replace.in.user.bundle1}" );
+		descriptor.setValue( "value", 10l );
+		Max max = AnnotationFactory.create( descriptor );
+
+
+		ConstraintDescriptorImpl<Max> constraintDescriptor = new ConstraintDescriptorImpl<Max>(
+				max, new ConstraintHelper(), java.lang.annotation.ElementType.FIELD, ConstraintOrigin.DEFINED_LOCALLY
+		);
+
+		interpolator = new ResourceBundleMessageInterpolator(
+				new TestResourceBundleLocator()
+		);
+		MessageInterpolator.Context context = new MessageInterpolatorContext( constraintDescriptor, null );
+
+		String expected = "{replace.in.default.bundle2}";
+		String actual = interpolator.interpolate( max.message(), context );
+		assertEquals(
+				actual, expected, "Within default bundle replacement parameter evaluation should not be recursive!"
+		);
+	}
+
+	/**
+	 * HV-182
+	 */
+	@Test
+	public void testCorrectMessageInterpolationIfParameterCannotBeReplaced() {
+		AnnotationDescriptor<Max> descriptor = new AnnotationDescriptor<Max>( Max.class );
+		String message = "Message should stay unchanged since {fubar} is not replaceable";
+		descriptor.setValue( "message", message );
+		descriptor.setValue( "value", 10l );
+		Max max = AnnotationFactory.create( descriptor );
+
+
+		ConstraintDescriptorImpl<Max> constraintDescriptor = new ConstraintDescriptorImpl<Max>(
+				max, new ConstraintHelper(), java.lang.annotation.ElementType.FIELD, ConstraintOrigin.DEFINED_LOCALLY
+		);
+
+		interpolator = new ResourceBundleMessageInterpolator(
+				new TestResourceBundleLocator()
+		);
+
+		MessageInterpolator.Context context = new MessageInterpolatorContext( constraintDescriptor, null );
+
+		String actual = interpolator.interpolate( max.message(), context );
+		assertEquals(
+				actual, message, "The message should not have changed."
+		);
+	}
+
+	/**
+	 * HV-330
+	 */
+	@Test
+	public void testMessageCaching() {
+
+		// do the whole tests first with caching enabled
+		TestResourceBundle testBundle = new TestResourceBundle();
+		interpolator = new ResourceBundleMessageInterpolator(
+				new TestResourceBundleLocator( testBundle )
+		);
+		MessageInterpolator.Context context = new MessageInterpolatorContext( notNullDescriptor, null );
+
+		String expected = "{hv-330}";
+		String actual = interpolator.interpolate( "{hv-330}", context );
+		assertEquals( actual, expected, "The key should not not exist in the bundle." );
+
+		testBundle.addOrUpdateMessage( "hv-330", "success" );
+		expected = "{hv-330}";
+		actual = interpolator.interpolate( "{hv-330}", context );
+		assertEquals(
+				actual,
+				expected,
+				"The message has not changed since per default the ResourceBundleMessageInterpolator caches the messages"
+		);
+
+		// now without caching
+		testBundle = new TestResourceBundle();
+		interpolator = new ResourceBundleMessageInterpolator(
+				new TestResourceBundleLocator( testBundle ), false
+		);
+		context = new MessageInterpolatorContext( notNullDescriptor, null );
+
+		expected = "{hv-330}";
+		actual = interpolator.interpolate( "{hv-330}", context );
+		assertEquals( actual, expected, "The key should not not exist in the bundle." );
+
+		testBundle.addOrUpdateMessage( "hv-330", "success" );
+		expected = "success";
+		actual = interpolator.interpolate( "{hv-330}", context );
+		assertEquals(
+				actual,
+				expected,
+				"The message should change since ResourceBundleMessageInterpolator does not cache"
+		);
+	}
+
+	/**
+	 * A dummy locator always returning a {@link TestResourceBundle}.
+	 */
+	private static class TestResourceBundleLocator implements ResourceBundleLocator {
+
+		private final ResourceBundle resourceBundle;
+
+		public TestResourceBundleLocator() {
+			this( new TestResourceBundle() );
+		}
+
+		public TestResourceBundleLocator(ResourceBundle bundle) {
+			resourceBundle = bundle;
+		}
+
+		public ResourceBundle getResourceBundle(Locale locale) {
+			return resourceBundle;
+		}
+	}
+
+	/**
+	 * A dummy resource bundle which can be passed to the constructor of ResourceBundleMessageInterpolator to replace
+	 * the user specified resource bundle.
+	 */
+	private static class TestResourceBundle extends ResourceBundle implements Enumeration<String> {
+		private Map<String, String> testResources;
+		Iterator<String> iter;
+
+		public TestResourceBundle() {
+			testResources = new HashMap<String, String>();
+			// add some test messages
+			testResources.put( "simple.key", "message interpolation successful" );
+			testResources.put( "key-with-dashes", "message interpolation successful" );
+			testResources.put( "key with spaces", "message interpolation successful" );
+			testResources.put( "replace.in.user.bundle1", "{replace.in.user.bundle2}" );
+			testResources.put( "replace.in.user.bundle2", "{replace.in.default.bundle1}" );
+
+			iter = testResources.keySet().iterator();
+		}
+
+		public Object handleGetObject(String key) {
+			return testResources.get( key );
+		}
+
+		public Enumeration<String> getKeys() {
+			return this;
+		}
+
+		public boolean hasMoreElements() {
+			return iter.hasNext();
+		}
+
+		public String nextElement() {
+			if ( hasMoreElements() ) {
+				return iter.next();
+			}
+			else {
+				throw new NoSuchElementException();
+			}
+		}
+
+		public void addOrUpdateMessage(String key, String message) {
+			testResources.put( key, message );
+			iter = testResources.keySet().iterator();
+		}
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/messageinterpolation/User.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/messageinterpolation/User.java
new file mode 100644
index 0000000..b14e268
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/messageinterpolation/User.java
@@ -0,0 +1,50 @@
+// $Id: User.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.engine.messageinterpolation;
+
+import org.hibernate.validator.constraints.Email;
+import org.hibernate.validator.constraints.Range;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class User {
+	@Email
+	private String email;
+
+	@Range(min = 18, max = 21)
+	private int age;
+
+	public int getAge() {
+		return age;
+	}
+
+	public void setAge(int age) {
+		this.age = age;
+	}
+
+	public String getEmail() {
+		return email;
+	}
+
+	public void setEmail(String email) {
+		this.email = email;
+	}
+}
+
+
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/proxy/A.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/proxy/A.java
new file mode 100644
index 0000000..b303a31
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/proxy/A.java
@@ -0,0 +1,29 @@
+// $Id: A.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.engine.proxy;
+
+import javax.validation.constraints.Min;
+import javax.validation.constraints.Size;
+
+interface A {
+	@Min(5)
+	public Integer getInteger();
+
+	@Size(min = 2)
+	public String getString();
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/proxy/B.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/proxy/B.java
new file mode 100644
index 0000000..58f6ee4
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/proxy/B.java
@@ -0,0 +1,21 @@
+// $Id: B.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.engine.proxy;
+
+public interface B extends A {
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/proxy/ProxyTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/proxy/ProxyTest.java
new file mode 100644
index 0000000..c1a98db
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/proxy/ProxyTest.java
@@ -0,0 +1,83 @@
+// $Id: ProxyTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.engine.proxy;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Set;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import static org.testng.Assert.assertEquals;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.test.util.TestUtil;
+import static org.hibernate.validator.test.util.TestUtil.assertNumberOfViolations;
+
+/**
+ * See HV-257
+ *
+ * @author Hardy Ferentschik
+ */
+public class ProxyTest {
+	@Test
+	public void testValidateA() {
+		InvocationHandler handler = new CustomInvocationHandler( "some object" );
+
+		A a = ( A ) Proxy.newProxyInstance( getClass().getClassLoader(), new Class<?>[] { A.class }, handler );
+		assertEquals( Integer.valueOf( 0 ), a.getInteger() );
+
+		Validator validator = TestUtil.getValidator();
+		Set<ConstraintViolation<A>> violations = validator.validate( a );
+		assertNumberOfViolations( violations, 2 );
+	}
+
+	@Test
+	public void testValidateB() {
+		InvocationHandler handler = new CustomInvocationHandler( "some object" );
+
+		B b = ( B ) Proxy.newProxyInstance( getClass().getClassLoader(), new Class<?>[] { B.class }, handler );
+		assertEquals( Integer.valueOf( 0 ), b.getInteger() );
+
+		Validator validator = TestUtil.getValidator();
+		Set<ConstraintViolation<B>> violations = validator.validate( b );
+		assertNumberOfViolations( violations, 2 );
+	}
+
+	private class CustomInvocationHandler implements InvocationHandler {
+		private Object o;
+
+		public CustomInvocationHandler(Object o) {
+			this.o = o;
+		}
+
+		public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+			if ( method.getName().equals( "getInteger" ) ) {
+				method.setAccessible( true );
+				return 0;
+			}
+			if ( method.getName().equals( "getString" ) ) {
+				return "a";
+			}
+			return method.invoke( o, args );
+		}
+	}
+}
+
+
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/serialization/ConstraintViolationSerializationTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/serialization/ConstraintViolationSerializationTest.java
new file mode 100644
index 0000000..af06c72
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/serialization/ConstraintViolationSerializationTest.java
@@ -0,0 +1,86 @@
+// $Id: ConstraintViolationSerializationTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.engine.serialization;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
+import java.io.NotSerializableException;
+import java.util.Set;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.test.util.TestUtil;
+
+import static org.hibernate.validator.test.util.TestUtil.assertNumberOfViolations;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class ConstraintViolationSerializationTest {
+
+	/**
+	 * HV-245
+	 */
+	@Test
+	public void testSuccessfulSerialization() throws Exception {
+		Validator validator = TestUtil.getValidator();
+		SerializableClass testInstance = new SerializableClass();
+		Set<ConstraintViolation<SerializableClass>> constraintViolations = validator.validate( testInstance );
+
+		byte[] bytes = serialize( constraintViolations );
+		Set<ConstraintViolation<?>> deserializedViolations = deserialize( bytes );
+		assertNumberOfViolations( deserializedViolations, 1 );
+	}
+
+	/**
+	 * HV-245
+	 */
+	@Test(expectedExceptions = NotSerializableException.class)
+	public void testUnSuccessfulSerialization() throws Exception {
+		Validator validator = TestUtil.getValidator();
+		UnSerializableClass testInstance = new UnSerializableClass();
+		Set<ConstraintViolation<UnSerializableClass>> constraintViolations = validator.validate( testInstance );
+
+		serialize( constraintViolations );
+	}
+
+	private byte[] serialize(Object o) throws Exception {
+		ByteArrayOutputStream stream = new ByteArrayOutputStream();
+		ObjectOutput out = new ObjectOutputStream( stream );
+		out.writeObject( o );
+		out.close();
+		byte[] serialized = stream.toByteArray();
+		stream.close();
+		return serialized;
+
+	}
+
+	private Set<ConstraintViolation<?>> deserialize(byte[] byteData) throws Exception {
+		ByteArrayInputStream byteIn = new ByteArrayInputStream( byteData );
+		ObjectInputStream in = new ObjectInputStream( byteIn );
+		Set<ConstraintViolation<?>> deserializedViolations = ( Set<ConstraintViolation<?>> ) in.readObject();
+		in.close();
+		byteIn.close();
+		return deserializedViolations;
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/serialization/CustomConstraintSerializableTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/serialization/CustomConstraintSerializableTest.java
new file mode 100644
index 0000000..732dc4f
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/serialization/CustomConstraintSerializableTest.java
@@ -0,0 +1,99 @@
+// $Id: CustomConstraintSerializableTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.engine.serialization;
+
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Set;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.test.util.TestUtil;
+
+
+/**
+ * A <b>sscce</b> (Short, Self Contained, Correct Example) showing that the
+ * simple custom Email validation constraint taken from <a href="http://blog.jteam.nl/2009/08/04/bean-validation-integrating-jsr-303-with-spring/"
+ * >this blog</a> gives a validation result that is not Serializable with
+ * Hibernate Validator 4.0.2.GA with underlying cause that
+ * <p/>
+ * <code>org.hibernate.validator.util.annotationfactory.AnnotationProxy</code>
+ * <p/>
+ * <p/>
+ * Note that Hibernate Validator does not guarantee at all that a
+ * {@link ConstraintViolation} is Serializable because an entity need not be
+ * Serializable, but otherwise there should not be much of a problem (right?).
+ *
+ * @author Henno Vermeulen
+ * @author Hardy Ferentschik
+ */
+public class CustomConstraintSerializableTest {
+
+	@Test
+	public void testSerializeHibernateEmail() throws Exception {
+		Validator validator = TestUtil.getValidator();
+
+		HibernateEmail invalidHibernateEmail = new HibernateEmail();
+		invalidHibernateEmail.email = "test@";
+
+		Set<ConstraintViolation<HibernateEmail>> constraintViolations = validator.validate( invalidHibernateEmail );
+		doSerialize( constraintViolations.iterator().next() );
+	}
+
+	/**
+	 * HV-291
+	 *
+	 * @throws Exception in case the test fails
+	 */
+	@Test
+	public void testSerializeCustomEmail() throws Exception {
+		Validator validator = TestUtil.getValidator();
+
+		CustomEmail invalidCustomEmail = new CustomEmail();
+		invalidCustomEmail.email = "test@";
+		Set<ConstraintViolation<CustomEmail>> constraintViolations = validator.validate( invalidCustomEmail );
+		doSerialize( constraintViolations.iterator().next() );
+	}
+
+	public static byte[] doSerialize(Object obj) throws Exception {
+		ByteArrayOutputStream baos = new ByteArrayOutputStream( 512 );
+		ObjectOutputStream out = new ObjectOutputStream( baos );
+		out.writeObject( obj );
+		out.close();
+		return baos.toByteArray();
+	}
+
+	static class CustomEmail implements Serializable {
+		private static final long serialVersionUID = -9095271389455131159L;
+
+		@Email
+		String email;
+
+	}
+
+	static class HibernateEmail implements Serializable {
+		private static final long serialVersionUID = 7206154160792549270L;
+
+		@org.hibernate.validator.constraints.Email
+		String email;
+	}
+}
+
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/serialization/DummyEmailValidator.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/serialization/DummyEmailValidator.java
new file mode 100644
index 0000000..9ce8a2f
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/serialization/DummyEmailValidator.java
@@ -0,0 +1,35 @@
+// $Id: DummyEmailValidator.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.engine.serialization;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class DummyEmailValidator implements ConstraintValidator<Email, String> {
+	public void initialize(Email annotation) {
+	}
+
+	public boolean isValid(String value, ConstraintValidatorContext context) {
+		return false;
+	}
+}
+
+
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/serialization/Email.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/serialization/Email.java
new file mode 100644
index 0000000..e50944e
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/serialization/Email.java
@@ -0,0 +1,52 @@
+// $Id: Email.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.engine.serialization;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import javax.validation.ReportAsSingleViolation;
+import javax.validation.constraints.Pattern;
+
+/**
+ * Denotes that a field should contain a valid email address.
+ * <p/>
+ * <p/>
+ * Taken from <a href="http://blog.jteam.nl/2009/08/04/bean-validation-integrating-jsr-303-with-spring/"
+ * >this blog</a>.
+ *
+ * @author Hardy Ferentschik
+ */
+ at Documented
+ at Constraint(validatedBy = { DummyEmailValidator.class })
+ at Target({ ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE })
+ at Retention(RetentionPolicy.RUNTIME)
+ at Pattern(regexp = ".+ at .+\\.[a-z]+")
+ at ReportAsSingleViolation
+public @interface Email {
+
+	public abstract String message() default "{org.hibernate.validator.engine.serialization.Email.message}";
+
+	public abstract Class<?>[] groups() default { };
+
+	public abstract Class<? extends Payload>[] payload() default { };
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/serialization/SerializableClass.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/serialization/SerializableClass.java
new file mode 100644
index 0000000..51054a9
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/serialization/SerializableClass.java
@@ -0,0 +1,29 @@
+// $Id: SerializableClass.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.test.engine.serialization;
+
+import java.io.Serializable;
+import javax.validation.constraints.NotNull;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class SerializableClass implements Serializable {
+	@NotNull
+	private String foo;
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/serialization/UnSerializableClass.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/serialization/UnSerializableClass.java
new file mode 100644
index 0000000..1f303cb
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/serialization/UnSerializableClass.java
@@ -0,0 +1,28 @@
+// $Id: UnSerializableClass.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, 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.test.engine.serialization;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class UnSerializableClass {
+	@NotNull
+	private String foo;
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/Author.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/Author.java
new file mode 100644
index 0000000..895b2da
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/Author.java
@@ -0,0 +1,42 @@
+// $Id: Author.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+ * 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.test.engine.traversableresolver;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import javax.validation.Valid;
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at Entity
+ at AuthorBusinessRules
+public class Author {
+	@Id
+	public Long id;
+
+	@Valid
+	@OneToMany(mappedBy = "author")
+	public List<Book> books = new ArrayList<Book>();
+}
+
+
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/AuthorBusinessRules.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/AuthorBusinessRules.java
new file mode 100644
index 0000000..dfe9034
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/AuthorBusinessRules.java
@@ -0,0 +1,38 @@
+// $Id: AuthorBusinessRules.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+ * 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.test.engine.traversableresolver;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+
+ at Constraint(validatedBy = {})
+ at Documented
+ at Target(ElementType.TYPE)
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface AuthorBusinessRules {
+	String message() default "";
+
+	Class<?>[] groups() default {};
+
+	Class<? extends Payload>[] payload() default {};
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/Book.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/Book.java
new file mode 100644
index 0000000..3a53039
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/Book.java
@@ -0,0 +1,37 @@
+// $Id: Book.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+ * 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.test.engine.traversableresolver;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at BookBusinessRules
+ at Entity
+public class Book {
+	@Id
+	public Long id;
+
+	@ManyToOne
+	public Author author;
+}
+
+
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/BookBusinessRules.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/BookBusinessRules.java
new file mode 100644
index 0000000..afd08eb
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/BookBusinessRules.java
@@ -0,0 +1,39 @@
+// $Id: BookBusinessRules.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+ * 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.test.engine.traversableresolver;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+
+ at Constraint(validatedBy = {})
+ at Documented
+ at Target(ElementType.TYPE)
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface BookBusinessRules {
+	String message() default "";
+
+	Class<?>[] groups() default {};
+
+	Class<? extends Payload>[] payload() default {};
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/CachedTraversableResolverTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/CachedTraversableResolverTest.java
new file mode 100644
index 0000000..7ce96e7
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/CachedTraversableResolverTest.java
@@ -0,0 +1,138 @@
+// $Id: CachedTraversableResolverTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.engine.traversableresolver;
+
+import java.lang.annotation.ElementType;
+import java.util.HashSet;
+import java.util.Set;
+import javax.validation.Configuration;
+import javax.validation.TraversableResolver;
+import javax.validation.Validation;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+import javax.validation.Path;
+import javax.validation.groups.Default;
+
+import static org.testng.Assert.fail;
+import org.testng.annotations.Test;
+
+/**
+ * @author Emmanuel Bernard
+ */
+//this test is specific to Hibernate Validator
+public class CachedTraversableResolverTest {
+	@Test
+	public void testCache() {
+		TraversableResolver resolver = new AskOnceTR();
+		Configuration<?> config = (Configuration<?>) Validation.byDefaultProvider()
+				.configure()
+				.traversableResolver( resolver );
+		ValidatorFactory factory = config.buildValidatorFactory();
+		Suit suit = new Suit();
+		suit.setTrousers( new Trousers() );
+		suit.setJacket( new Jacket() );
+		suit.setSize( 3333 );
+		suit.getTrousers().setLength( 32321 );
+		suit.getJacket().setWidth( 432432 );
+		Validator v = factory.getValidator();
+		try {
+			v.validate( suit, Default.class, Cloth.class );
+		}
+		catch ( IllegalStateException e ) {
+			fail( "Traversable Called several times for a given object" );
+		}
+
+		v = factory.usingContext().traversableResolver( new AskOnceTR() ).getValidator();
+		try {
+			v.validateProperty( suit, "size", Default.class, Cloth.class );
+		}
+		catch ( IllegalStateException e ) {
+			fail( "Traversable Called several times for a given object" );
+		}
+
+		v = factory.usingContext().traversableResolver( new AskOnceTR() ).getValidator();
+		try {
+			v.validateValue( Suit.class, "size", 2, Default.class, Cloth.class );
+		}
+		catch ( IllegalStateException e ) {
+			fail( "Traversable Called several times for a given object" );
+		}
+	}
+
+	private static class AskOnceTR implements TraversableResolver {
+		private Set<Holder> askedReach = new HashSet<Holder>();
+		private Set<Holder> askedCascade = new HashSet<Holder>();
+
+		private boolean isTraversable(Set<Holder> asked, Object traversableObject, Path.Node traversableProperty, Class<?> rootBeanType, Path pathToTraversableObject, ElementType elementType) {
+			Holder h = new Holder( traversableObject, traversableProperty );
+			if ( asked.contains( h ) ) {
+				throw new IllegalStateException( "Called twice" );
+			}
+			asked.add( h );
+			return true;
+		}
+
+		public boolean isReachable(Object traversableObject, Path.Node traversableProperty, Class<?> rootBeanType, Path pathToTraversableObject, ElementType elementType) {
+			return isTraversable(
+					askedReach,
+					traversableObject,
+					traversableProperty,
+					rootBeanType,
+					pathToTraversableObject,
+					elementType
+			);
+		}
+
+		public boolean isCascadable(Object traversableObject, Path.Node traversableProperty, Class<?> rootBeanType, Path pathToTraversableObject, ElementType elementType) {
+			return isTraversable(
+					askedCascade,
+					traversableObject,
+					traversableProperty,
+					rootBeanType,
+					pathToTraversableObject,
+					elementType
+			);
+		}
+
+		public static class Holder {
+			Object NULL = new Object();
+			Object to;
+			Path.Node tp;
+
+			public Holder(Object traversableObject, Path.Node traversableProperty) {
+				to = traversableObject == null ? NULL : traversableObject;
+				tp = traversableProperty;
+			}
+
+			@Override
+			public int hashCode() {
+				return to.hashCode() + tp.hashCode();
+			}
+
+			@Override
+			public boolean equals(Object obj) {
+				if ( !( obj instanceof Holder ) ) {
+					return false;
+				}
+				Holder that = ( Holder ) obj;
+
+				return to != NULL && to == that.to && tp.equals( that.tp );
+			}
+		}
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/Cloth.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/Cloth.java
new file mode 100644
index 0000000..5793657
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/Cloth.java
@@ -0,0 +1,24 @@
+// $Id: Cloth.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.engine.traversableresolver;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public interface Cloth {
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/Jacket.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/Jacket.java
new file mode 100644
index 0000000..8ee81d9
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/Jacket.java
@@ -0,0 +1,37 @@
+// $Id: Jacket.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.engine.traversableresolver;
+
+import javax.validation.constraints.Max;
+
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class Jacket {
+	Integer width;
+
+	@Max(30)
+	public Integer getWidth() {
+		return width;
+	}
+
+	public void setWidth(Integer width) {
+		this.width = width;
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/JpaTraversableResolverTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/JpaTraversableResolverTest.java
new file mode 100644
index 0000000..b0bea17
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/JpaTraversableResolverTest.java
@@ -0,0 +1,67 @@
+// $Id: JpaTraversableResolverTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+ * 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.test.engine.traversableresolver;
+
+import java.util.Set;
+import javax.validation.Configuration;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.engine.resolver.DefaultTraversableResolver;
+import org.hibernate.validator.test.util.TestUtil;
+
+import static org.testng.Assert.assertTrue;
+
+
+/**
+ * See HV-305
+ *
+ * @author Hardy Ferentschik
+ */
+public class JpaTraversableResolverTest {
+	private Validator validator;
+
+	@BeforeTest
+	public void setUp() {
+		Configuration<?> configuration = TestUtil.getConfiguration();
+		configuration.traversableResolver( new DefaultTraversableResolver() );
+		validator = configuration.buildValidatorFactory().getValidator();
+	}
+
+	@Test
+	public void testWithBooks() {
+		Author author = new Author();
+		author.books.add( new Book() );
+		Set<ConstraintViolation<Author>> results = validator.validate( author );
+		assertTrue( results.isEmpty() );
+	}
+
+	@Test
+	public void testWithoutBooks() {
+		Author author = new Author();
+
+		// If the "books" collection is empty, everything works as expected.
+		Set<ConstraintViolation<Author>> results = validator.validate( author );
+		assertTrue( results.isEmpty() );
+	}
+}
+
+
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/Suit.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/Suit.java
new file mode 100644
index 0000000..1f35e0b
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/Suit.java
@@ -0,0 +1,61 @@
+// $Id: Suit.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.engine.traversableresolver;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.Valid;
+import javax.validation.GroupSequence;
+import javax.validation.groups.Default;
+
+/**
+ * @author Emmanuel Bernard
+ */
+ at GroupSequence( {Suit.class, Cloth.class })
+public class Suit {
+	@Max(value=50, groups = { Default.class, Cloth.class})
+	@Min(1)
+	private Integer size;
+	@Valid private Trousers trousers;
+	private Jacket jacket;
+
+	public Trousers getTrousers() {
+		return trousers;
+	}
+
+	public void setTrousers(Trousers trousers) {
+		this.trousers = trousers;
+	}
+
+	@Valid
+	public Jacket getJacket() {
+		return jacket;
+	}
+
+	public void setJacket(Jacket jacket) {
+		this.jacket = jacket;
+	}
+
+	public Integer getSize() {
+		return size;
+	}
+
+	public void setSize(Integer size) {
+		this.size = size;
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/Trousers.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/Trousers.java
new file mode 100644
index 0000000..0e5a9c0
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/traversableresolver/Trousers.java
@@ -0,0 +1,39 @@
+// $Id: Trousers.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.engine.traversableresolver;
+
+import javax.validation.constraints.Min;
+import javax.validation.constraints.Max;
+import javax.validation.groups.Default;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class Trousers {
+	@Min(value=70, groups = {Default.class, Cloth.class})
+	@Max(value=220)
+	private Integer length;
+
+	public Integer getLength() {
+		return length;
+	}
+
+	public void setLength(Integer length) {
+		this.length = length;
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/metadata/ConstraintHelperTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/metadata/ConstraintHelperTest.java
new file mode 100644
index 0000000..d3b55f4
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/metadata/ConstraintHelperTest.java
@@ -0,0 +1,74 @@
+// $Id: ConstraintHelperTest.java 19573 2010-05-20 22:13:26Z hardy.ferentschik $
+/*
+* 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.test.metadata;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.util.List;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.metadata.ConstraintHelper;
+import org.hibernate.validator.util.ReflectionHelper;
+
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class ConstraintHelperTest {
+
+	private static ConstraintHelper constraintHelper;
+
+	@BeforeClass
+	public static void init() {
+		constraintHelper = new ConstraintHelper();
+	}
+
+	@Test
+	public void testGetMultiValueConstraints() throws Exception {
+		Engine engine = new Engine();
+		Field[] fields = engine.getClass().getDeclaredFields();
+		assertNotNull( fields );
+		assertTrue( fields.length == 1 );
+		ReflectionHelper.setAccessibility( fields[0] );
+
+		Annotation annotation = fields[0].getAnnotation( Pattern.List.class );
+		assertNotNull( annotation );
+		List<Annotation> multiValueConstraintAnnotations = constraintHelper.getMultiValueConstraints( annotation );
+		assertTrue( multiValueConstraintAnnotations.size() == 2, "There should be two constraint annotations" );
+		assertTrue( multiValueConstraintAnnotations.get( 0 ) instanceof Pattern, "Wrong constraint annotation" );
+		assertTrue( multiValueConstraintAnnotations.get( 1 ) instanceof Pattern, "Wrong constraint annotation" );
+
+
+		Order order = new Order();
+		fields = order.getClass().getDeclaredFields();
+		assertNotNull( fields );
+		assertTrue( fields.length == 1 );
+		ReflectionHelper.setAccessibility( fields[0] );
+
+		annotation = fields[0].getAnnotation( NotNull.class );
+		assertNotNull( annotation );
+		multiValueConstraintAnnotations = constraintHelper.getMultiValueConstraints( annotation );
+		assertTrue( multiValueConstraintAnnotations.size() == 0, "There should be no constraint annotations" );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/metadata/Customer.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/metadata/Customer.java
new file mode 100644
index 0000000..65790b4
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/metadata/Customer.java
@@ -0,0 +1,67 @@
+// $Id: Customer.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.metadata;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.validation.Valid;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Customer implements Person {
+
+	private String firstName;
+	private String middleName;
+	private String lastName;
+
+	@Valid
+	private List<Order> orderList = new ArrayList<Order>();
+
+	public void addOrder(Order order) {
+		orderList.add( order );
+	}
+
+	public List<Order> getOrderList() {
+		return orderList;
+	}
+
+	public String getFirstName() {
+		return firstName;
+	}
+
+	public void setFirstName(String firstName) {
+		this.firstName = firstName;
+	}
+
+	public String getMiddleName() {
+		return middleName;
+	}
+
+	public void setMiddleName(String middleName) {
+		this.middleName = middleName;
+	}
+
+	public String getLastName() {
+		return lastName;
+	}
+
+	public void setLastName(String lastName) {
+		this.lastName = lastName;
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/metadata/ElementDescriptorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/metadata/ElementDescriptorTest.java
new file mode 100644
index 0000000..65cf3a7
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/metadata/ElementDescriptorTest.java
@@ -0,0 +1,87 @@
+// $Id: ElementDescriptorTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.metadata;
+
+import java.util.Set;
+import javax.validation.Validator;
+import javax.validation.metadata.BeanDescriptor;
+import javax.validation.metadata.ConstraintDescriptor;
+import javax.validation.metadata.ElementDescriptor;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.test.util.TestUtil;
+
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class ElementDescriptorTest {
+
+
+	@Test
+	public void testGetTypeForConstrainedBean() {
+		Validator validator = TestUtil.getValidator();
+		BeanDescriptor beanDescriptor = validator.getConstraintsForClass( Customer.class );
+		assertEquals( beanDescriptor.getElementClass(), Customer.class, "Wrong type." );
+	}
+
+	@Test
+	public void testGetTypeForConstrainedProperty() {
+		ElementDescriptor elementDescriptor = TestUtil.getPropertyDescriptor( Order.class, "orderNumber" );
+		assertEquals( elementDescriptor.getElementClass(), Integer.class, "Wrong type." );
+	}
+
+	/**
+	 * HV-95
+	 */
+	@Test
+	public void testElementDescriptorForProperty() {
+		ElementDescriptor elementDescriptor = TestUtil.getPropertyDescriptor( Order.class, "orderNumber" );
+		Set<ConstraintDescriptor<?>> constraintDescriptors = elementDescriptor.getConstraintDescriptors();
+		assertTrue( constraintDescriptors.size() == 1, "There should be a descriptor" );
+	}
+
+	/**
+	 * HV-95
+	 */
+	@Test
+	public void testElementDescriptorImmutable() {
+		ElementDescriptor elementDescriptor = TestUtil.getPropertyDescriptor( Order.class, "orderNumber" );
+		Set<ConstraintDescriptor<?>> constraintDescriptors = elementDescriptor.getConstraintDescriptors();
+
+		try {
+			constraintDescriptors.add( null );
+			fail( "Set should be immutable" );
+		}
+		catch ( UnsupportedOperationException e ) {
+			// success
+		}
+
+		try {
+			constraintDescriptors.remove( null );
+			fail( "Set should be immutable" );
+		}
+		catch ( UnsupportedOperationException e ) {
+			// success
+		}
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/metadata/Engine.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/metadata/Engine.java
new file mode 100644
index 0000000..f43a3f4
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/metadata/Engine.java
@@ -0,0 +1,41 @@
+// $Id: Engine.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.metadata;
+
+import javax.validation.constraints.Pattern;
+
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Engine {
+	@Pattern.List({
+			@Pattern(regexp = "^[A-Z0-9-]+$",
+					message = "must contain alphabetical characters only"),
+			@Pattern(regexp = "^....-....-....$", message = "must match ....-....-....")
+	})
+	private String serialNumber;
+
+	public String getSerialNumber() {
+		return serialNumber;
+	}
+
+	public void setSerialNumber(String serialNumber) {
+		this.serialNumber = serialNumber;
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/metadata/Order.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/metadata/Order.java
new file mode 100644
index 0000000..6a379a6
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/metadata/Order.java
@@ -0,0 +1,36 @@
+// $Id: Order.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.metadata;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Order {
+	@NotNull(message = "Order number must be specified")
+	Integer orderNumber;
+
+	public Integer getOrderNumber() {
+		return orderNumber;
+	}
+
+	public void setOrderNumber(Integer orderNumber) {
+		this.orderNumber = orderNumber;
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/metadata/Person.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/metadata/Person.java
new file mode 100644
index 0000000..d45236f
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/metadata/Person.java
@@ -0,0 +1,36 @@
+// $Id: Person.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.metadata;
+
+import org.hibernate.validator.constraints.NotEmpty;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public interface Person {
+	@NotEmpty(groups = PersonValidation.class)
+	String getFirstName();
+
+	String getMiddleName();
+
+	@NotEmpty
+	String getLastName();
+
+	public interface PersonValidation {
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/resourceloading/AggregateBundleTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/resourceloading/AggregateBundleTest.java
new file mode 100644
index 0000000..0dc1609
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/resourceloading/AggregateBundleTest.java
@@ -0,0 +1,99 @@
+// $Id: AggregateBundleTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.resourceloading;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.ResourceBundle;
+import java.util.Set;
+
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.resourceloading.AggregateResourceBundleLocator.AggregateBundle;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+/**
+ * Test for {@link AggregateBundle}.
+ *
+ * @author Gunnar Morling
+ */
+public class AggregateBundleTest {
+
+	private final static String BUNDLE_NAME_1 = AggregateResourceBundleLocatorTest.class.getPackage()
+			.getName() + ".AggregateResourceBundleLocatorTestBundle1";
+
+	private final static String BUNDLE_NAME_2 = AggregateResourceBundleLocatorTest.class.getPackage()
+			.getName() + ".AggregateResourceBundleLocatorTestBundle2";
+
+	@Test
+	public void aggregateBundleContainsKeysOfAllSourceBundles() {
+		ResourceBundle bundle_1 = ResourceBundle.getBundle( BUNDLE_NAME_1 );
+		ResourceBundle bundle_2 = ResourceBundle.getBundle( BUNDLE_NAME_2 );
+
+		ResourceBundle aggregateBundle = new AggregateBundle( Arrays.asList( bundle_1, bundle_2 ) );
+
+		Set<String> actualKeys = getAsSet( aggregateBundle.getKeys() );
+		Set<String> expectedKeys = new HashSet<String>( Arrays.asList( "key_1", "key_2", "key_3" ) );
+
+		assertEquals( actualKeys, expectedKeys );
+	}
+
+	@Test
+	public void aggregateBundleWithNoSourceBundlesContainsNoKeys() {
+		ResourceBundle aggregateBundle = new AggregateBundle( Collections.<ResourceBundle>emptyList() );
+		assertTrue( getAsSet( aggregateBundle.getKeys() ).isEmpty() );
+	}
+
+	@Test
+	public void valuesProperlyRetrievedFromAggregateBundle() {
+		ResourceBundle bundle_1 = ResourceBundle.getBundle( BUNDLE_NAME_1 );
+		ResourceBundle bundle_2 = ResourceBundle.getBundle( BUNDLE_NAME_2 );
+
+		ResourceBundle aggregateBundle = new AggregateBundle( Arrays.asList( bundle_1, bundle_2 ) );
+
+		assertEquals(
+				aggregateBundle.getString( "key_1" ),
+				"value 1 from bundle 1",
+				"Value for key_1 should be retrieved from bundle 1"
+		);
+		assertEquals(
+				aggregateBundle.getString( "key_2" ),
+				"value 2 from bundle 1",
+				"Value for key_2 should be retrieved from bundle 1"
+		);
+		assertEquals(
+				aggregateBundle.getString( "key_3" ),
+				"value 3 from bundle 2",
+				"Value for key_3 should be retrieved from bundle 2"
+		);
+	}
+
+	private Set<String> getAsSet(Enumeration<String> e) {
+		Set<String> theValue = new HashSet<String>();
+
+		while ( e.hasMoreElements() ) {
+			theValue.add( e.nextElement() );
+		}
+
+		return theValue;
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/resourceloading/AggregateResourceBundleLocatorTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/resourceloading/AggregateResourceBundleLocatorTest.java
new file mode 100644
index 0000000..2a89b3e
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/resourceloading/AggregateResourceBundleLocatorTest.java
@@ -0,0 +1,100 @@
+// $Id: AggregateResourceBundleLocatorTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.resourceloading;
+
+import java.util.Arrays;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.resourceloading.AggregateResourceBundleLocator;
+import org.hibernate.validator.resourceloading.PlatformResourceBundleLocator;
+import org.hibernate.validator.resourceloading.ResourceBundleLocator;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
+
+/**
+ * Test for {@link org.hibernate.validator.resourceloading.AggregateResourceBundleLocator}.
+ *
+ * @author Gunnar Morling
+ */
+public class AggregateResourceBundleLocatorTest {
+
+	private final static String BUNDLE_NAME_1 =
+			AggregateResourceBundleLocatorTest.class.getPackage()
+					.getName() + ".AggregateResourceBundleLocatorTestBundle1";
+
+	private final static String BUNDLE_NAME_2 =
+			AggregateResourceBundleLocatorTest.class.getPackage()
+					.getName() + ".AggregateResourceBundleLocatorTestBundle2";
+
+	@Test
+	public void valuesAreRetrievedFromBothSourceBundles() {
+
+		ResourceBundleLocator locator =
+				new AggregateResourceBundleLocator( Arrays.asList( BUNDLE_NAME_1, BUNDLE_NAME_2 ) );
+
+		ResourceBundle resourceBundle = locator.getResourceBundle( Locale.getDefault() );
+
+		assertNotNull( resourceBundle );
+
+		//contained in bundle 1
+		assertEquals( resourceBundle.getString( "key_1" ), "value 1 from bundle 1" );
+
+		//contained in both bundles, bundle 1 comes first
+		assertEquals( resourceBundle.getString( "key_2" ), "value 2 from bundle 1" );
+
+		//contained in bundle 2
+		assertEquals( resourceBundle.getString( "key_3" ), "value 3 from bundle 2" );
+	}
+
+	@Test
+	public void valuesAreRetrievedFromDelegate() {
+
+		ResourceBundleLocator locator =
+				new AggregateResourceBundleLocator(
+						Arrays.asList( BUNDLE_NAME_1 ),
+						new PlatformResourceBundleLocator( BUNDLE_NAME_2 )
+				);
+
+		ResourceBundle resourceBundle = locator.getResourceBundle( Locale.ENGLISH );
+
+		assertNotNull( resourceBundle );
+
+		//contained in bundle 1
+		assertEquals( resourceBundle.getString( "key_1" ), "value 1 from bundle 1" );
+
+		//contained in both bundles, but bundle 1 is queried before bundle 2 (delegate)
+		assertEquals( resourceBundle.getString( "key_2" ), "value 2 from bundle 1" );
+
+		//contained in bundle 2
+		assertEquals( resourceBundle.getString( "key_3" ), "value 3 from bundle 2" );
+	}
+
+	@Test
+	public void nullReturnedAsBundleDoesNotExist() {
+
+		ResourceBundleLocator locator = new AggregateResourceBundleLocator( Arrays.asList( "foo" ) );
+		ResourceBundle resourceBundle = locator.getResourceBundle( Locale.ENGLISH );
+
+		assertNull( resourceBundle );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/util/BoundariesConstraintValidator.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/util/BoundariesConstraintValidator.java
new file mode 100644
index 0000000..6c29ee6
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/util/BoundariesConstraintValidator.java
@@ -0,0 +1,39 @@
+// $Id: BoundariesConstraintValidator.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.util;
+
+import java.lang.annotation.Annotation;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public abstract class BoundariesConstraintValidator<T extends Annotation> implements ConstraintValidator<T, Integer> {
+	private int low;
+	private int high;
+
+	protected void initialize(int low, int high) {
+		this.low = low;
+		this.high = high;
+	}
+
+	public boolean isValid(Integer value, ConstraintValidatorContext constraintValidatorContext) {
+		return value >= low && value <= high;
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/util/DummyTraversableResolver.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/util/DummyTraversableResolver.java
new file mode 100644
index 0000000..ee54c7d
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/util/DummyTraversableResolver.java
@@ -0,0 +1,39 @@
+// $Id: DummyTraversableResolver.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+ * 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.test.util;
+
+import java.lang.annotation.ElementType;
+import javax.validation.Path;
+import javax.validation.TraversableResolver;
+
+/**
+ * A dummy traversable resolver which returns always {@code true}. This resolver is used by default by all test cases. 
+ *
+ * @author Hardy Ferentschik
+ */
+public class DummyTraversableResolver implements TraversableResolver {
+	public boolean isReachable(Object traversableObject, Path.Node traversableProperty, Class<?> rootBeanType, Path pathToTraversableObject, ElementType elementType) {
+		return true;
+	}
+
+	public boolean isCascadable(Object traversableObject, Path.Node traversableProperty, Class<?> rootBeanType, Path pathToTraversableObject, ElementType elementType) {
+		return true;
+	}
+}
+
+
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/util/HibernateTestCase.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/util/HibernateTestCase.java
new file mode 100644
index 0000000..933539d
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/util/HibernateTestCase.java
@@ -0,0 +1,119 @@
+/*
+ * 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.
+ */
+
+// $Id: HibernateTestCase.java 19597 2010-05-24 19:18:21Z hardy.ferentschik $
+package org.hibernate.validator.test.util;
+
+import java.io.InputStream;
+import java.util.Properties;
+import javax.validation.ValidatorFactory;
+
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+
+import org.hibernate.SessionFactory;
+import org.hibernate.cfg.AnnotationConfiguration;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.tool.hbm2ddl.SchemaExport;
+
+/**
+ * Base class for validation test which work in combination with Hibernate Core.
+ *
+ * @author Hardy Ferentschik
+ */
+public abstract class HibernateTestCase {
+	private SessionFactory sessionFactory;
+	private Configuration cfg;
+
+	@BeforeTest
+	protected void setUp() throws Exception {
+		buildSessionFactory( getAnnotatedClasses(), getAnnotatedPackages(), getXmlFiles() );
+	}
+
+	@AfterTest
+	protected void tearDown() throws Exception {
+		SchemaExport export = new SchemaExport( cfg );
+		export.drop( false, true );
+		sessionFactory = null;
+	}
+
+	public SessionFactory getSessionFactory() {
+		return sessionFactory;
+	}
+
+	private void buildSessionFactory(Class<?>[] classes, String[] packages, String[] xmlFiles) throws Exception {
+		if ( sessionFactory != null ) {
+			sessionFactory.close();
+		}
+		try {
+			setCfg( new AnnotationConfiguration() );
+			configure( cfg );
+			if ( recreateSchema() ) {
+				cfg.setProperty( org.hibernate.cfg.Environment.HBM2DDL_AUTO, "create-drop" );
+			}
+			for ( String aPackage : packages ) {
+				( ( AnnotationConfiguration ) getCfg() ).addPackage( aPackage );
+			}
+			for ( Class<?> aClass : classes ) {
+				( ( AnnotationConfiguration ) getCfg() ).addAnnotatedClass( aClass );
+			}
+			for ( String xmlFile : xmlFiles ) {
+				InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream( xmlFile );
+				getCfg().addInputStream( is );
+			}
+			sessionFactory = getCfg().buildSessionFactory();
+		}
+		catch ( Exception e ) {
+			e.printStackTrace();
+			throw e;
+		}
+	}
+
+	protected void configure(Configuration cfg) {
+		Properties prop = cfg.getProperties();
+		//prop.put( "javax.persistence.validation.mode", "none" );
+		prop.put( "javax.persistence.validation.factory", getValidatorFactory() );
+		prop.put( "hibernate.current_session_context_class", "thread" );
+	}
+
+	protected abstract ValidatorFactory getValidatorFactory();
+
+	protected abstract Class<?>[] getAnnotatedClasses();
+
+	protected String[] getAnnotatedPackages() {
+		return new String[] { };
+	}
+
+	protected String[] getXmlFiles() {
+		return new String[] { };
+	}
+
+	protected boolean recreateSchema() {
+		return true;
+	}
+
+	protected void setCfg(Configuration cfg) {
+		this.cfg = cfg;
+	}
+
+	protected Configuration getCfg() {
+		return cfg;
+	}
+}
+
+
+
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/util/IdentitySetTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/util/IdentitySetTest.java
new file mode 100644
index 0000000..a0fb6a0
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/util/IdentitySetTest.java
@@ -0,0 +1,78 @@
+// $Id: IdentitySetTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.util;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.util.IdentitySet;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class IdentitySetTest {
+
+	@SuppressWarnings("unchecked")
+	@Test
+	public void testAddIdenticalInstance() {
+		Set identitySet = new IdentitySet();
+		Set hashSet = new HashSet();
+		assertTrue( identitySet.size() == 0 );
+		assertTrue( hashSet.size() == 0 );
+
+		Object o1 = new Object() {
+			int counter = 0;
+
+			public int hashCode() {
+				return counter++;
+			}
+
+			public boolean equals() {
+				return false;
+			}
+		};
+		identitySet.add( o1 );
+		hashSet.add( o1 );
+		assertTrue( identitySet.size() == 1 );
+		assertTrue( hashSet.size() == 1 );
+
+		identitySet.add( o1 );
+		hashSet.add( o1 );
+		assertTrue( identitySet.size() == 1 );
+		assertTrue( hashSet.size() == 2 );
+
+		Object o2 = new Object() {
+			int counter = 0;
+
+			public int hashCode() {
+				return counter++;
+			}
+
+			public boolean equals() {
+				return false;
+			}
+		};
+		identitySet.add( o2 );
+		hashSet.add( o2 );
+		assertTrue( identitySet.size() == 2 );
+		assertTrue( hashSet.size() == 3 );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/util/Positive.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/util/Positive.java
new file mode 100644
index 0000000..1aab39d
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/util/Positive.java
@@ -0,0 +1,39 @@
+// $Id: Positive.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.util;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Documented;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import javax.validation.Constraint;
+
+/**
+ * @author Emmanuel Bernard
+ */
+ at Constraint( validatedBy = { PositiveConstraintValidator.class })
+ at Target({ METHOD, FIELD, ANNOTATION_TYPE })
+ at Retention(RUNTIME)
+ at Documented
+public @interface Positive {
+	public abstract String message() default "{validation.positive}";
+	public abstract Class<?>[] groups() default {};
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/util/PositiveConstraintValidator.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/util/PositiveConstraintValidator.java
new file mode 100644
index 0000000..a2aaba9
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/util/PositiveConstraintValidator.java
@@ -0,0 +1,27 @@
+// $Id: PositiveConstraintValidator.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.util;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class PositiveConstraintValidator extends BoundariesConstraintValidator<Positive> {
+	public void initialize(Positive constraintAnnotation) {
+		super.initialize( 0, Integer.MAX_VALUE );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/util/ReflectionHelperTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/util/ReflectionHelperTest.java
new file mode 100644
index 0000000..0c94406
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/util/ReflectionHelperTest.java
@@ -0,0 +1,207 @@
+// $Id: ReflectionHelperTest.java 19566 2010-05-20 11:58:01Z hardy.ferentschik $
+/*
+* 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.test.util;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeSet;
+import javax.validation.Payload;
+import javax.validation.ValidationException;
+import javax.validation.constraints.NotNull;
+import javax.validation.groups.Default;
+
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.util.ReflectionHelper;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+/**
+ * Tests for the {@code ReflectionHelper}.
+ *
+ * @author Hardy Ferentschik
+ */
+public class ReflectionHelperTest {
+
+	@Test
+	public void testIsIterable() throws Exception {
+		Type type = TestTypes.class.getField( "stringList" ).getGenericType();
+		assertTrue( ReflectionHelper.isIterable( type ) );
+
+		assertTrue( ReflectionHelper.isIterable( TreeSet.class ) );
+
+		assertTrue( ReflectionHelper.isIterable( List.class ) );
+		assertTrue( ReflectionHelper.isIterable( HashSet.class ) );
+		assertTrue( ReflectionHelper.isIterable( Iterable.class ) );
+		assertTrue( ReflectionHelper.isIterable( Collection.class ) );
+
+		assertFalse( ReflectionHelper.isIterable( null ) );
+		assertFalse( ReflectionHelper.isIterable( Object.class ) );
+	}
+
+	@Test
+	public void testIsMap() throws Exception {
+		assertTrue( ReflectionHelper.isMap( Map.class ) );
+		assertTrue( ReflectionHelper.isMap( SortedMap.class ) );
+
+		Type type = TestTypes.class.getField( "objectMap" ).getGenericType();
+		assertTrue( ReflectionHelper.isMap( type ) );
+
+		assertFalse( ReflectionHelper.isMap( null ) );
+		assertFalse( ReflectionHelper.isMap( Object.class ) );
+	}
+
+	@Test
+	public void testGetIndexedType() throws Exception {
+		Type type = TestTypes.class.getField( "stringList" ).getGenericType();
+		assertEquals( String.class, ReflectionHelper.getIndexedType( type ) );
+
+		type = TestTypes.class.getField( "objectMap" ).getGenericType();
+		assertEquals( Object.class, ReflectionHelper.getIndexedType( type ) );
+
+		type = TestTypes.class.getField( "stringArray" ).getGenericType();
+		assertEquals( String.class, ReflectionHelper.getIndexedType( type ) );
+	}
+
+	@Test
+	public void testGetIndexedValueForMap() {
+		Map<String, Object> map = new HashMap<String, Object>();
+		Object testObject = new Object();
+		String key = "key";
+		map.put( key, testObject );
+
+		Object value = ReflectionHelper.getMappedValue( map, key );
+		assertEquals( value, testObject, "We should be able to retrieve the indexed object" );
+
+		value = ReflectionHelper.getMappedValue( map, "foo" );
+		assertNull( value, "A non existent index should return the null value" );
+
+		value = ReflectionHelper.getMappedValue( map, "2" );
+		assertNull( value, "A non existent index should return the null value" );
+	}
+
+	@Test
+	public void testGetIndexedValueForList() {
+		List<Object> list = new ArrayList<Object>();
+		Object testObject = new Object();
+		list.add( testObject );
+
+		Object value = ReflectionHelper.getIndexedValue( list, 0 );
+		assertEquals( value, testObject, "We should be able to retrieve the indexed object" );
+
+		value = ReflectionHelper.getIndexedValue( list, 2 );
+		assertNull( value, "A non existent index should return the null value" );
+	}
+
+	@Test
+	public void testGetIndexedValueForNull() {
+		Object value = ReflectionHelper.getIndexedValue( null, 0 );
+		assertNull( value );
+	}
+
+	@Test
+	public void testGetMessageParameter() {
+		NotNull testAnnotation = new NotNull() {
+			public String message() {
+				return "test";
+			}
+
+			public Class<?>[] groups() {
+				return new Class<?>[] { Default.class };
+			}
+
+			public Class<? extends Payload>[] payload() {
+				@SuppressWarnings("unchecked")
+				Class<? extends Payload>[] classes = new Class[] { };
+				return classes;
+			}
+
+			public Class<? extends Annotation> annotationType() {
+				return this.getClass();
+			}
+		};
+		String message = ReflectionHelper.getAnnotationParameter( testAnnotation, "message", String.class );
+		assertEquals( "test", message, "Wrong message" );
+
+		Class<?>[] group = ReflectionHelper.getAnnotationParameter( testAnnotation, "groups", Class[].class );
+		assertEquals( group[0], Default.class, "Wrong message" );
+
+		try {
+			ReflectionHelper.getAnnotationParameter( testAnnotation, "message", Integer.class );
+			fail();
+		}
+		catch ( ValidationException e ) {
+			assertTrue( e.getMessage().startsWith( "Wrong parameter type." ), "Wrong exception message" );
+		}
+
+		try {
+			ReflectionHelper.getAnnotationParameter( testAnnotation, "foo", Integer.class );
+			fail();
+		}
+		catch ( ValidationException e ) {
+			assertTrue(
+					e.getMessage().startsWith( "The specified annotation defines no parameter" ),
+					"Wrong exception message"
+			);
+		}
+	}
+
+	@Test
+	public void testPropertyExists() {
+		assertTrue( ReflectionHelper.propertyExists( Foo.class, "foo", FIELD ) );
+		assertFalse( ReflectionHelper.propertyExists( Foo.class, "foo", METHOD ) );
+		assertFalse( ReflectionHelper.propertyExists( Foo.class, "bar", FIELD ) );
+		assertTrue( ReflectionHelper.propertyExists( Foo.class, "bar", METHOD ) );
+
+		try {
+			assertTrue( ReflectionHelper.propertyExists( Foo.class, "bar", TYPE ) );
+			fail();
+		}
+		catch ( IllegalArgumentException e ) {
+			// success
+		}
+	}
+
+	public class TestTypes {
+		public List<String> stringList;
+		public Map<String, Object> objectMap;
+		public String[] stringArray;
+	}
+
+	public class Foo {
+		String foo;
+
+		public String getBar() {
+			return "bar";
+		}
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/util/TestUtil.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/util/TestUtil.java
new file mode 100644
index 0000000..69b2f0e
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/util/TestUtil.java
@@ -0,0 +1,262 @@
+// $Id: TestUtil.java 19635 2010-05-31 14:03:26Z hardy.ferentschik $
+/*
+* 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.test.util;
+
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Set;
+import javax.validation.Configuration;
+import javax.validation.ConstraintViolation;
+import javax.validation.Path;
+import javax.validation.Validation;
+import javax.validation.Validator;
+import javax.validation.metadata.PropertyDescriptor;
+import javax.validation.spi.ValidationProvider;
+
+import org.slf4j.Logger;
+
+import org.hibernate.validator.HibernateValidator;
+import org.hibernate.validator.HibernateValidatorConfiguration;
+import org.hibernate.validator.engine.PathImpl;
+import org.hibernate.validator.util.LoggerFactory;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.FileAssert.fail;
+
+/**
+ * Tests for the <code>ReflectionHelper</code>.
+ *
+ * @author Hardy Ferentschik
+ */
+public class TestUtil {
+	private static final Logger log = LoggerFactory.make();
+
+	private static Validator hibernateValidator;
+
+	private TestUtil() {
+	}
+
+	public static Validator getValidator() {
+		if ( hibernateValidator == null ) {
+			Configuration configuration = getConfiguration( Locale.ENGLISH );
+			configuration.traversableResolver( new DummyTraversableResolver() );
+			hibernateValidator = configuration.buildValidatorFactory().getValidator();
+		}
+		return hibernateValidator;
+	}
+
+	public static Configuration<HibernateValidatorConfiguration> getConfiguration() {
+		return getConfiguration( HibernateValidator.class, Locale.ENGLISH );
+	}
+
+	public static Configuration<HibernateValidatorConfiguration> getConfiguration(Locale locale) {
+		return getConfiguration( HibernateValidator.class, locale );
+	}
+
+	public static <T extends Configuration<T>, U extends ValidationProvider<T>> T getConfiguration(Class<U> type) {
+		return getConfiguration( type, Locale.ENGLISH );
+	}
+
+	public static <T extends Configuration<T>, U extends ValidationProvider<T>> T getConfiguration(Class<U> type, Locale locale) {
+		Locale.setDefault( locale );
+		return Validation.byProvider( type ).configure();
+	}
+
+	/**
+	 * @param path The path to the xml file which should server as <code>validation.xml</code> for the returned
+	 * <code>Validator</code>.
+	 *
+	 * @return A <code>Validator</code> instance which respects the configuration specified in the file with the path
+	 *         <code>path</code>.
+	 */
+	public static Validator getValidatorWithCustomConfiguration(String path) {
+		Thread.currentThread().setContextClassLoader( new CustomValidationXmlClassLoader( path ) );
+		return getConfiguration().buildValidatorFactory().getValidator();
+	}
+
+	public static PropertyDescriptor getPropertyDescriptor(Class<?> clazz, String property) {
+		Validator validator = getValidator();
+		return validator.getConstraintsForClass( clazz ).getConstraintsForProperty( property );
+	}
+
+	public static <T> void assertCorrectConstraintViolationMessages(Set<ConstraintViolation<T>> violations, String... messages) {
+		List<String> actualMessages = new ArrayList<String>();
+		for ( ConstraintViolation<?> violation : violations ) {
+			actualMessages.add( violation.getMessage() );
+		}
+
+		assertEquals( actualMessages.size(), messages.length, "Wrong number of error messages" );
+
+		for ( String expectedMessage : messages ) {
+			assertTrue(
+					actualMessages.contains( expectedMessage ),
+					"The message '" + expectedMessage + "' should have been in the list of actual messages: " + actualMessages
+			);
+			actualMessages.remove( expectedMessage );
+		}
+		assertTrue(
+				actualMessages.isEmpty(), "Actual messages contained more messages as specified expected messages"
+		);
+	}
+
+	public static <T> void assertCorrectConstraintTypes(Set<ConstraintViolation<T>> violations, Class<?>... expectedConstraintTypes) {
+		List<String> actualConstraintTypes = new ArrayList<String>();
+		for ( ConstraintViolation<?> violation : violations ) {
+			actualConstraintTypes.add(
+					( ( Annotation ) violation.getConstraintDescriptor().getAnnotation() ).annotationType().getName()
+			);
+		}
+
+		assertEquals(
+				expectedConstraintTypes.length, actualConstraintTypes.size(), "Wrong number of constraint types."
+		);
+
+		for ( Class<?> expectedConstraintType : expectedConstraintTypes ) {
+			assertTrue(
+					actualConstraintTypes.contains( expectedConstraintType.getName() ),
+					"The constraint type " + expectedConstraintType.getName() + " should have been violated."
+			);
+		}
+	}
+
+	public static <T> void assertCorrectPropertyPaths(Set<ConstraintViolation<T>> violations, String... propertyPaths) {
+		List<Path> propertyPathsOfViolations = new ArrayList<Path>();
+		for ( ConstraintViolation<?> violation : violations ) {
+			propertyPathsOfViolations.add( violation.getPropertyPath() );
+		}
+
+		for ( String propertyPath : propertyPaths ) {
+			Path expectedPath = PathImpl.createPathFromString( propertyPath );
+			boolean containsPath = false;
+			for ( Path actualPath : propertyPathsOfViolations ) {
+				if ( assertEqualPaths( expectedPath, actualPath ) ) {
+					containsPath = true;
+					break;
+				}
+			}
+			if ( !containsPath ) {
+				fail( expectedPath + " is not in the list of path instances contained in the actual constraint violations: " + propertyPathsOfViolations );
+			}
+		}
+	}
+
+	public static void assertConstraintViolation(ConstraintViolation violation, String errorMessage, Class rootBean, Object invalidValue, String propertyPath) {
+		assertEquals(
+				violation.getPropertyPath(),
+				PathImpl.createPathFromString( propertyPath ),
+				"Wrong propertyPath"
+		);
+		assertConstraintViolation( violation, errorMessage, rootBean, invalidValue );
+	}
+
+	public static void assertConstraintViolation(ConstraintViolation violation, String errorMessage, Class rootBean, Object invalidValue) {
+		assertEquals(
+				violation.getInvalidValue(),
+				invalidValue,
+				"Wrong invalid value"
+		);
+		assertConstraintViolation( violation, errorMessage, rootBean );
+	}
+
+	public static void assertConstraintViolation(ConstraintViolation violation, String errorMessage, Class rootBean) {
+		assertEquals(
+				violation.getRootBean().getClass(),
+				rootBean,
+				"Wrong root bean type"
+		);
+		assertConstraintViolation( violation, errorMessage );
+	}
+
+	public static void assertConstraintViolation(ConstraintViolation violation, String message) {
+		assertEquals( violation.getMessage(), message, "Wrong message" );
+	}
+
+	public static void assertNumberOfViolations(Set violations, int expectedViolations) {
+		assertEquals( violations.size(), expectedViolations, "Wrong number of constraint violations" );
+	}
+
+	public static boolean assertEqualPaths(Path p1, Path p2) {
+		Iterator<Path.Node> p1Iterator = p1.iterator();
+		Iterator<Path.Node> p2Iterator = p2.iterator();
+		while ( p1Iterator.hasNext() ) {
+			Path.Node p1Node = p1Iterator.next();
+			if ( !p2Iterator.hasNext() ) {
+				return false;
+			}
+			Path.Node p2Node = p2Iterator.next();
+
+			// do the comparison on the node values
+			if ( p2Node.getName() == null ) {
+				if ( p1Node.getName() != null ) {
+					return false;
+				}
+			}
+			else if ( !p2Node.getName().equals( p1Node.getName() ) ) {
+				return false;
+			}
+
+			if ( p2Node.isInIterable() != p1Node.isInIterable() ) {
+				return false;
+			}
+
+
+			if ( p2Node.getIndex() == null ) {
+				if ( p1Node.getIndex() != null ) {
+					return false;
+				}
+			}
+			else if ( !p2Node.getIndex().equals( p1Node.getIndex() ) ) {
+				return false;
+			}
+
+			if ( p2Node.getKey() == null ) {
+				if ( p1Node.getKey() != null ) {
+					return false;
+				}
+			}
+			else if ( !p2Node.getKey().equals( p1Node.getKey() ) ) {
+				return false;
+			}
+		}
+
+		return !p2Iterator.hasNext();
+	}
+
+	private static class CustomValidationXmlClassLoader extends ClassLoader {
+		private final String customValidationXmlPath;
+
+		CustomValidationXmlClassLoader(String pathToCustomValidationXml) {
+			super( CustomValidationXmlClassLoader.class.getClassLoader() );
+			customValidationXmlPath = pathToCustomValidationXml;
+		}
+
+		public InputStream getResourceAsStream(String path) {
+			String finalPath = path;
+			if ( "META-INF/validation.xml".equals( path ) ) {
+				log.info( "Using {} as validation.xml", customValidationXmlPath );
+				finalPath = customValidationXmlPath;
+			}
+			return super.getResourceAsStream( finalPath );
+		}
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/util/ValidatorTypeTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/util/ValidatorTypeTest.java
new file mode 100644
index 0000000..6c73fd5
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/util/ValidatorTypeTest.java
@@ -0,0 +1,50 @@
+// $Id: ValidatorTypeTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.util;
+
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import javax.validation.ConstraintValidator;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.util.ValidatorTypeHelper;
+
+/**
+ * Tests for message resolution.
+ *
+ * @author Emmanuel Bernard
+ */
+public class ValidatorTypeTest {
+
+	@Test
+	public void testTypeDiscovery() {
+		List<Class<? extends ConstraintValidator<Positive, ?>>> validators =
+				new ArrayList<Class<? extends ConstraintValidator<Positive, ?>>>();
+		validators.add( PositiveConstraintValidator.class );
+		Map<Type, Class<? extends ConstraintValidator<?, ?>>> validatorsTypes = ValidatorTypeHelper
+				.getValidatorsTypes( validators );
+
+		assertEquals( validatorsTypes.get( Integer.class ), PositiveConstraintValidator.class );
+		assertNull( validatorsTypes.get( String.class ) );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/util/annotationfactory/AnnotationFactoryTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/util/annotationfactory/AnnotationFactoryTest.java
new file mode 100644
index 0000000..2f2f4ec
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/util/annotationfactory/AnnotationFactoryTest.java
@@ -0,0 +1,62 @@
+// $Id: AnnotationFactoryTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.util.annotationfactory;
+
+import javax.validation.constraints.Pattern;
+import javax.validation.constraints.Size;
+
+import static org.testng.Assert.assertEquals;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.util.annotationfactory.AnnotationDescriptor;
+import org.hibernate.validator.util.annotationfactory.AnnotationFactory;
+
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class AnnotationFactoryTest {
+
+	@Test
+	public void createAnnotationProxy() {
+		AnnotationDescriptor<Size> descriptor = new AnnotationDescriptor<Size>( Size.class );
+		descriptor.setValue( "min", 5 );
+		descriptor.setValue( "max", 10 );
+
+		Size size = AnnotationFactory.create( descriptor );
+
+		assertEquals( size.min(), 5, "Wrong parameter value" );
+		assertEquals( size.max(), 10, "Wrong parameter value" );
+	}
+
+	@Test(expectedExceptions = IllegalArgumentException.class)
+	public void createAnnotationProxyMissingRequiredParamter() {
+		AnnotationDescriptor<Pattern> descriptor = new AnnotationDescriptor<Pattern>( Pattern.class );
+		AnnotationFactory.create( descriptor );
+	}
+
+	@Test
+	public void createAnnotationProxyWithRequiredParamter() {
+		AnnotationDescriptor<Pattern> descriptor = new AnnotationDescriptor<Pattern>( Pattern.class );
+		descriptor.setValue( "regexp", ".*" );
+
+		Pattern pattern = AnnotationFactory.create( descriptor );
+
+		assertEquals( ".*", pattern.regexp(), "Wrong parameter value" );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/Customer.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/Customer.java
new file mode 100644
index 0000000..bdf3cd0
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/Customer.java
@@ -0,0 +1,71 @@
+// $Id: Customer.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.xml;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Customer implements Person {
+    private String firstName;
+    private String middleName;
+    private String lastName;
+
+    private String customerId;
+
+    private String password;
+
+    public String getFirstName() {
+	return this.firstName;
+    }
+
+    public void setFirstName(final String firstName) {
+	this.firstName = firstName;
+    }
+
+    public String getMiddleName() {
+	return this.middleName;
+    }
+
+    public void setMiddleName(final String middleName) {
+	this.middleName = middleName;
+    }
+
+    public String getLastName() {
+	return this.lastName;
+    }
+
+    public void setLastName(final String lastName) {
+	this.lastName = lastName;
+    }
+
+    public String getCustomerId() {
+	return this.customerId;
+    }
+
+    public void setCustomerId(final String customerId) {
+	this.customerId = customerId;
+    }
+
+    public String getPassword() {
+	return this.password;
+    }
+
+    public void setPassword(final String password) {
+	this.password = password;
+    }
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/MyInterface.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/MyInterface.java
new file mode 100644
index 0000000..9f0762e
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/MyInterface.java
@@ -0,0 +1,27 @@
+// $Id: MyInterface.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.xml;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public interface MyInterface {
+	Integer getId();
+}
+
+
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/MyInterfaceImpl.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/MyInterfaceImpl.java
new file mode 100644
index 0000000..86e4ec2
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/MyInterfaceImpl.java
@@ -0,0 +1,28 @@
+// $Id: MyInterfaceImpl.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.xml;
+
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class MyInterfaceImpl implements MyInterface {
+	public Integer getId() {
+		return null;
+	}
+}
\ No newline at end of file
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/Person.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/Person.java
new file mode 100644
index 0000000..e69c54a
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/Person.java
@@ -0,0 +1,30 @@
+// $Id: Person.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.xml;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public interface Person {
+
+    String getFirstName();
+
+    String getMiddleName();
+
+    String getLastName();
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/Properties.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/Properties.java
new file mode 100644
index 0000000..ca7b23f
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/Properties.java
@@ -0,0 +1,37 @@
+// $Id: Properties.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, 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.test.xml;
+
+import java.util.List;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Properties {
+	private List<String> listOfString;
+
+	public List<String> getListOfString() {
+		return listOfString;
+	}
+
+	public void setListOfString(List<String> listOfString) {
+		this.listOfString = listOfString;
+	}
+}
+
+
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/XmlMappingTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/XmlMappingTest.java
new file mode 100644
index 0000000..d78d58f
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/XmlMappingTest.java
@@ -0,0 +1,127 @@
+// $Id: XmlMappingTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.xml;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import javax.validation.Configuration;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+import javax.validation.groups.Default;
+
+import static org.testng.Assert.assertEquals;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.test.util.TestUtil;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class XmlMappingTest {
+
+	@Test
+	/**
+	 * HV-214
+	 */
+	public void testConstraintInheritanceWithXmlConfiguration() {
+
+		final Configuration<?> configuration = TestUtil.getConfiguration();
+		configuration.addMapping( XmlMappingTest.class.getResourceAsStream( "mapping.xml" ) );
+
+		final ValidatorFactory validatorFactory = configuration.buildValidatorFactory();
+		final Validator validator = validatorFactory.getValidator();
+
+		final Set<ConstraintViolation<Customer>> violations = validator.validate( new Customer(), Default.class );
+
+		assertEquals( violations.size(), 1 );
+	}
+
+	@Test
+	/**
+	 * HV-252
+	 */
+	public void testListOfString() {
+
+		final Configuration<?> configuration = TestUtil.getConfiguration();
+		configuration.addMapping( XmlMappingTest.class.getResourceAsStream( "properties-mapping.xml" ) );
+
+		final ValidatorFactory validatorFactory = configuration.buildValidatorFactory();
+		final Validator validator = validatorFactory.getValidator();
+
+		List<String> listOfString = new ArrayList<String>();
+		listOfString.add( "one" );
+		listOfString.add( "two" );
+		listOfString.add( "three" );
+
+		final Set<ConstraintViolation<Properties>> violations = validator.validateValue(
+				Properties.class, "listOfString", listOfString
+		);
+
+		assertEquals( violations.size(), 0 );
+	}
+
+	@Test
+	/**
+	 * HV-262
+	 */
+	public void testInterfaceConfiguration() {
+
+		final Configuration<?> configuration = TestUtil.getConfiguration();
+		configuration.addMapping( XmlMappingTest.class.getResourceAsStream( "my-interface-mapping.xml" ) );
+
+		final ValidatorFactory validatorFactory = configuration.buildValidatorFactory();
+		final Validator validator = validatorFactory.getValidator();
+		final Set<ConstraintViolation<MyInterfaceImpl>> violations = validator.validate( new MyInterfaceImpl() );
+
+		assertEquals( violations.size(), 1 );
+	}
+
+	@Test
+	/**
+	 * HV-262
+	 */
+	public void testInterfaceImplementationConfiguration() {
+
+		final Configuration<?> configuration = TestUtil.getConfiguration();
+		configuration.addMapping( XmlMappingTest.class.getResourceAsStream( "my-interface-impl-mapping.xml" ) );
+
+		final ValidatorFactory validatorFactory = configuration.buildValidatorFactory();
+		final Validator validator = validatorFactory.getValidator();
+		final Set<ConstraintViolation<MyInterfaceImpl>> violations = validator.validate( new MyInterfaceImpl() );
+
+		assertEquals( violations.size(), 1 );
+	}
+
+	@Test
+	/**
+	 * HV-263
+	 */
+	public void testEmptyInterfaceConfiguration() {
+
+		final Configuration<?> configuration = TestUtil.getConfiguration();
+		configuration.addMapping( XmlMappingTest.class.getResourceAsStream( "empty-my-interface-mapping.xml" ) );
+
+		final ValidatorFactory validatorFactory = configuration.buildValidatorFactory();
+		final Validator validator = validatorFactory.getValidator();
+		final Set<ConstraintViolation<MyInterfaceImpl>> violations = validator.validate( new MyInterfaceImpl() );
+
+		assertEquals( violations.size(), 0 );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/ICompetition.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/ICompetition.java
new file mode 100755
index 0000000..69d65a1
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/ICompetition.java
@@ -0,0 +1,20 @@
+// $Id: ICompetition.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.xml.mixedconfiguration;
+
+public interface ICompetition {}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/IFixture.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/IFixture.java
new file mode 100755
index 0000000..c892b95
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/IFixture.java
@@ -0,0 +1,22 @@
+// $Id: IFixture.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.xml.mixedconfiguration;
+
+public interface IFixture {
+	ICompetition getCompetition();
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/InheritanceMappingsTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/InheritanceMappingsTest.java
new file mode 100755
index 0000000..0a49d2a
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/InheritanceMappingsTest.java
@@ -0,0 +1,133 @@
+// $Id: InheritanceMappingsTest.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.xml.mixedconfiguration;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+import javax.validation.Configuration;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+import javax.validation.constraints.NotNull;
+
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.test.util.DummyTraversableResolver;
+import org.hibernate.validator.test.util.TestUtil;
+import org.hibernate.validator.test.xml.mixedconfiguration.annotation.Competition;
+import org.hibernate.validator.test.xml.mixedconfiguration.annotation.Fixture;
+import org.hibernate.validator.test.xml.mixedconfiguration.annotation.PersonCompetition;
+import org.hibernate.validator.test.xml.mixedconfiguration.annotation.TeamCompetition;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.FileAssert.fail;
+
+
+/**
+ * See HV-265
+ *
+ * @author Hardy Ferentschik
+ */
+public class InheritanceMappingsTest {
+
+	@Test
+	public void defaultConfigurationNoExplicitAnnotationDefinition1() {
+		validateAnnotatedFixture(
+				new PersonCompetition(),
+				TestUtil.getValidator()
+		);
+	}
+
+	@Test
+	public void defaultConfigurationNoExplicitAnnotationDefinition2() {
+		validateAnnotatedFixture(
+				new TeamCompetition(),
+				TestUtil.getValidator()
+		);
+	}
+
+	@Test
+	public void customConfigurationNoExplicitAnnotationDefinition1() {
+		validateAnnotatedFixture(
+				new PersonCompetition(),
+				configure( "annotation-mappings.xml" )
+		);
+	}
+
+	@Test
+	public void customConfigurationNoExplicitAnnotationDefinition2() {
+		validateAnnotatedFixture(
+				new TeamCompetition(),
+				configure( "annotation-mappings.xml" )
+		);
+	}
+
+	@Test
+	public void customConfigurationExplicitXmlDefinition() {
+		validateXmlDefinedFixture(
+				new org.hibernate.validator.test.xml.mixedconfiguration.xml.PersonCompetition(),
+				configure( "xml-mappings.xml" )
+		);
+	}
+
+	@Test
+	public void customConfigurationNoExplicitXmlDefinition() {
+		validateXmlDefinedFixture(
+				new org.hibernate.validator.test.xml.mixedconfiguration.xml.TeamCompetition(),
+				configure( "xml-mappings.xml" )
+		);
+	}
+
+	private Validator configure(String mappingsUrl) {
+		Configuration<?> configuration = TestUtil.getConfiguration();
+		configuration.traversableResolver( new DummyTraversableResolver() );
+		configuration.addMapping( InheritanceMappingsTest.class.getResourceAsStream( mappingsUrl ) );
+
+		ValidatorFactory validatorFactory = configuration.buildValidatorFactory();
+		return validatorFactory.getValidator();
+	}
+
+	private void validateFixture(IFixture fixture, Validator validator) {
+		Set<ConstraintViolation<IFixture>> violations = validator.validate( fixture );
+
+		for ( ConstraintViolation<IFixture> violation : violations ) {
+			if ( violation.getLeafBean() instanceof ICompetition
+					&& "detail.competition.name".equals( violation.getPropertyPath().toString() ) ) {
+				assertEquals( violation.getLeafBean(), fixture.getCompetition() );
+				Annotation annotation = ( ( Annotation ) violation.getConstraintDescriptor().getAnnotation() );
+				assertEquals( annotation.annotationType(), NotNull.class );
+				return;
+			}
+		}
+		fail( "@NotNull constraint violation for 'detail.competition.name' not detected" );
+	}
+
+	private void validateAnnotatedFixture(Competition competition,
+										  Validator validator) {
+		Fixture fixture = new Fixture();
+		fixture.setCompetition( competition );
+		validateFixture( fixture, validator );
+	}
+
+	private void validateXmlDefinedFixture(org.hibernate.validator.test.xml.mixedconfiguration.xml.Competition competition,
+										   Validator validator) {
+		org.hibernate.validator.test.xml.mixedconfiguration.xml.Fixture fixture = new org.hibernate.validator.test.xml.mixedconfiguration.xml.Fixture();
+		fixture.setCompetition( competition );
+		validateFixture( fixture, validator );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/annotation/Competition.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/annotation/Competition.java
new file mode 100755
index 0000000..8509e6b
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/annotation/Competition.java
@@ -0,0 +1,46 @@
+// $Id: Competition.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.xml.mixedconfiguration.annotation;
+
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+
+import org.hibernate.validator.test.xml.mixedconfiguration.ICompetition;
+
+public abstract class Competition implements ICompetition {
+
+	@NotNull
+	@Size(min = 1)
+	private String name;
+
+	public Competition() {
+		super();
+	}
+
+	public Competition(String name) {
+		setName( name );
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/annotation/Fixture.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/annotation/Fixture.java
new file mode 100755
index 0000000..1b94572
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/annotation/Fixture.java
@@ -0,0 +1,31 @@
+// $Id: Fixture.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.xml.mixedconfiguration.annotation;
+
+import org.hibernate.validator.test.xml.mixedconfiguration.IFixture;
+
+public class Fixture extends Game implements IFixture {
+
+	public Fixture() {
+		super();
+	}
+
+	public Fixture(Competition competition) {
+		super( competition );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/annotation/Game.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/annotation/Game.java
new file mode 100755
index 0000000..1db2b37
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/annotation/Game.java
@@ -0,0 +1,48 @@
+// $Id: Game.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.xml.mixedconfiguration.annotation;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+
+public abstract class Game {
+
+	@NotNull
+	@Valid
+	private GameDetail detail;
+
+	private Game(GameDetail detail) {
+		this.detail = detail;
+	}
+
+	public Game() {
+		this( new GameDetail() );
+	}
+
+	public Game(Competition competition) {
+		this( new GameDetail( competition ) );
+	}
+
+	public Competition getCompetition() {
+		return detail.getCompetition();
+	}
+
+	public void setCompetition(Competition competition) {
+		detail.setCompetition( competition );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/annotation/GameDetail.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/annotation/GameDetail.java
new file mode 100755
index 0000000..1f65de4
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/annotation/GameDetail.java
@@ -0,0 +1,44 @@
+// $Id: GameDetail.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.xml.mixedconfiguration.annotation;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+
+public class GameDetail {
+
+	@NotNull
+	@Valid
+	private Competition competition;
+
+	public GameDetail() {
+		super();
+	}
+
+	public GameDetail(Competition competition) {
+		setCompetition( competition );
+	}
+
+	public Competition getCompetition() {
+		return competition;
+	}
+
+	public void setCompetition(Competition competition) {
+		this.competition = competition;
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/annotation/PersonCompetition.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/annotation/PersonCompetition.java
new file mode 100755
index 0000000..34916ac
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/annotation/PersonCompetition.java
@@ -0,0 +1,29 @@
+// $Id: PersonCompetition.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.xml.mixedconfiguration.annotation;
+
+public class PersonCompetition extends Competition {
+
+	public PersonCompetition() {
+		super();
+	}
+
+	public PersonCompetition(String name) {
+		super( name );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/annotation/TeamCompetition.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/annotation/TeamCompetition.java
new file mode 100755
index 0000000..26e7a3b
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/annotation/TeamCompetition.java
@@ -0,0 +1,28 @@
+// $Id: TeamCompetition.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.xml.mixedconfiguration.annotation;
+
+public class TeamCompetition extends Competition {
+	public TeamCompetition() {
+		super();
+	}
+
+	public TeamCompetition(String name) {
+		super( name );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/xml/Competition.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/xml/Competition.java
new file mode 100755
index 0000000..a0372e6
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/xml/Competition.java
@@ -0,0 +1,41 @@
+// $Id: Competition.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.xml.mixedconfiguration.xml;
+
+import org.hibernate.validator.test.xml.mixedconfiguration.ICompetition;
+
+public abstract class Competition implements ICompetition {
+
+	private String name;
+
+	public Competition() {
+		super();
+	}
+
+	public Competition(String name) {
+		setName( name );
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/xml/Fixture.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/xml/Fixture.java
new file mode 100755
index 0000000..ff33451
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/xml/Fixture.java
@@ -0,0 +1,36 @@
+// $Id: Fixture.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.xml.mixedconfiguration.xml;
+
+import org.hibernate.validator.test.xml.mixedconfiguration.IFixture;
+
+public class Fixture extends Game implements IFixture {
+
+	public Fixture() {
+		super();
+	}
+
+	public Fixture(Competition competition) {
+		super( competition );
+	}
+
+	@Override
+	public void setCompetition(Competition competition) {
+		super.setCompetition( competition );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/xml/Game.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/xml/Game.java
new file mode 100755
index 0000000..273ec31
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/xml/Game.java
@@ -0,0 +1,43 @@
+// $Id: Game.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.xml.mixedconfiguration.xml;
+
+public abstract class Game {
+
+	private GameDetail detail;
+
+	private Game(GameDetail detail) {
+		this.detail = detail;
+	}
+
+	public Game() {
+		this( new GameDetail() );
+	}
+
+	public Game(Competition competition) {
+		this( new GameDetail( competition ) );
+	}
+
+	public Competition getCompetition() {
+		return detail.getCompetition();
+	}
+
+	public void setCompetition(Competition competition) {
+		detail.setCompetition( competition );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/xml/GameDetail.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/xml/GameDetail.java
new file mode 100755
index 0000000..b14b221
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/xml/GameDetail.java
@@ -0,0 +1,39 @@
+// $Id: GameDetail.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.xml.mixedconfiguration.xml;
+
+public class GameDetail {
+
+	private Competition competition;
+
+	public GameDetail() {
+		super();
+	}
+
+	public GameDetail(Competition competition) {
+		setCompetition( competition );
+	}
+
+	public Competition getCompetition() {
+		return competition;
+	}
+
+	public void setCompetition(Competition competition) {
+		this.competition = competition;
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/xml/PersonCompetition.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/xml/PersonCompetition.java
new file mode 100755
index 0000000..1c4340e
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/xml/PersonCompetition.java
@@ -0,0 +1,29 @@
+// $Id: PersonCompetition.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.xml.mixedconfiguration.xml;
+
+public class PersonCompetition extends Competition {
+
+	public PersonCompetition() {
+		super();
+	}
+
+	public PersonCompetition(String name) {
+		super( name );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/xml/TeamCompetition.java b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/xml/TeamCompetition.java
new file mode 100755
index 0000000..b95ec08
--- /dev/null
+++ b/hibernate-validator/src/test/java/org/hibernate/validator/test/xml/mixedconfiguration/xml/TeamCompetition.java
@@ -0,0 +1,29 @@
+// $Id: TeamCompetition.java 19547 2010-05-19 15:40:07Z hardy.ferentschik $
+/*
+* 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.test.xml.mixedconfiguration.xml;
+
+public class TeamCompetition extends Competition {
+
+	public TeamCompetition() {
+		super();
+	}
+
+	public TeamCompetition(String name) {
+		super( name );
+	}
+}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/util/BoundariesConstraintValidator.java b/hibernate-validator/src/test/java/org/hibernate/validator/util/BoundariesConstraintValidator.java
deleted file mode 100644
index 4694c6e..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/util/BoundariesConstraintValidator.java
+++ /dev/null
@@ -1,39 +0,0 @@
-// $Id: BoundariesConstraintValidator.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.util;
-
-import java.lang.annotation.Annotation;
-import javax.validation.ConstraintValidator;
-import javax.validation.ConstraintValidatorContext;
-
-/**
- * @author Emmanuel Bernard
- */
-public abstract class BoundariesConstraintValidator<T extends Annotation> implements ConstraintValidator<T, Integer> {
-	private int low;
-	private int high;
-
-	protected void initialize(int low, int high) {
-		this.low = low;
-		this.high = high;
-	}
-
-	public boolean isValid(Integer value, ConstraintValidatorContext constraintValidatorContext) {
-		return value >= low && value <= high;
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/util/IdentitySetTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/util/IdentitySetTest.java
deleted file mode 100644
index 9d24014..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/util/IdentitySetTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-// $Id: IdentitySetTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.util;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-
-/**
- * @author Hardy Ferentschik
- */
-public class IdentitySetTest {
-
-	@SuppressWarnings("unchecked")
-	@Test
-	public void testAddIdenticalInstance() {
-		Set identitySet = new IdentitySet();
-		Set hashSet = new HashSet();
-		assertTrue( identitySet.size() == 0 );
-		assertTrue( hashSet.size() == 0 );
-
-		Object o1 = new Object() {
-			int counter = 0;
-
-			public int hashCode() {
-				return counter++;
-			}
-
-			public boolean equals() {
-				return false;
-			}
-		};
-		identitySet.add( o1 );
-		hashSet.add( o1 );
-		assertTrue( identitySet.size() == 1 );
-		assertTrue( hashSet.size() == 1 );
-
-		identitySet.add( o1 );
-		hashSet.add( o1 );
-		assertTrue( identitySet.size() == 1 );
-		assertTrue( hashSet.size() == 2 );
-
-		Object o2 = new Object() {
-			int counter = 0;
-
-			public int hashCode() {
-				return counter++;
-			}
-
-			public boolean equals() {
-				return false;
-			}
-		};
-		identitySet.add( o2 );
-		hashSet.add( o2 );
-		assertTrue( identitySet.size() == 2 );
-		assertTrue( hashSet.size() == 3 );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/util/Positive.java b/hibernate-validator/src/test/java/org/hibernate/validator/util/Positive.java
deleted file mode 100644
index 4218fd6..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/util/Positive.java
+++ /dev/null
@@ -1,39 +0,0 @@
-// $Id: Positive.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.util;
-
-import java.lang.annotation.Target;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Documented;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import javax.validation.Constraint;
-
-/**
- * @author Emmanuel Bernard
- */
- at Constraint( validatedBy = { PositiveConstraintValidator.class })
- at Target({ METHOD, FIELD, ANNOTATION_TYPE })
- at Retention(RUNTIME)
- at Documented
-public @interface Positive {
-	public abstract String message() default "{validation.positive}";
-	public abstract Class<?>[] groups() default {};
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/util/PositiveConstraintValidator.java b/hibernate-validator/src/test/java/org/hibernate/validator/util/PositiveConstraintValidator.java
deleted file mode 100644
index 8387d6f..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/util/PositiveConstraintValidator.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// $Id: PositiveConstraintValidator.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.util;
-
-/**
- * @author Emmanuel Bernard
- */
-public class PositiveConstraintValidator extends BoundariesConstraintValidator<Positive> {
-	public void initialize(Positive constraintAnnotation) {
-		super.initialize( 0, Integer.MAX_VALUE );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/util/ReflectionHelperTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/util/ReflectionHelperTest.java
deleted file mode 100644
index 2814d61..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/util/ReflectionHelperTest.java
+++ /dev/null
@@ -1,177 +0,0 @@
-// $Id: ReflectionHelperTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.util;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.SortedMap;
-import java.util.TreeSet;
-import javax.validation.Payload;
-import javax.validation.ValidationException;
-import javax.validation.constraints.NotNull;
-import javax.validation.groups.Default;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-import org.testng.annotations.Test;
-
-/**
- * Tests for the <code>ReflectionHelper</code>.
- *
- * @author Hardy Ferentschik
- */
-public class ReflectionHelperTest {
-
-	@Test
-	public void testIsIterable() throws Exception {
-		Type type = TestTypes.class.getField( "stringList" ).getGenericType();
-		assertTrue( ReflectionHelper.isIterable( type ) );
-
-		assertTrue( ReflectionHelper.isIterable( TreeSet.class ) );
-
-		assertTrue( ReflectionHelper.isIterable( List.class ) );
-		assertTrue( ReflectionHelper.isIterable( HashSet.class ) );
-		assertTrue( ReflectionHelper.isIterable( Iterable.class ) );
-		assertTrue( ReflectionHelper.isIterable( Collection.class ) );
-
-		assertFalse( ReflectionHelper.isIterable( null ) );
-		assertFalse( ReflectionHelper.isIterable( Object.class ) );
-	}
-
-	@Test
-	public void testIsMap() throws Exception {
-		assertTrue( ReflectionHelper.isMap( Map.class ) );
-		assertTrue( ReflectionHelper.isMap( SortedMap.class ) );
-
-		Type type = TestTypes.class.getField( "objectMap" ).getGenericType();
-		assertTrue( ReflectionHelper.isMap( type ) );
-
-		assertFalse( ReflectionHelper.isMap( null ) );
-		assertFalse( ReflectionHelper.isMap( Object.class ) );
-	}
-
-	@Test
-	public void testGetIndexedType() throws Exception {
-		Type type = TestTypes.class.getField( "stringList" ).getGenericType();
-		assertEquals( String.class, ReflectionHelper.getIndexedType( type ) );
-
-		type = TestTypes.class.getField( "objectMap" ).getGenericType();
-		assertEquals( Object.class, ReflectionHelper.getIndexedType( type ) );
-
-		type = TestTypes.class.getField( "stringArray" ).getGenericType();
-		assertEquals( String.class, ReflectionHelper.getIndexedType( type ) );
-	}
-
-	@Test
-	public void testGetIndexedValueForMap() {
-		Map<String, Object> map = new HashMap<String, Object>();
-		Object testObject = new Object();
-		String key = "key";
-		map.put( key, testObject );
-
-		Object value = ReflectionHelper.getMappedValue( map, key );
-		assertEquals( value, testObject, "We should be able to retrieve the indexed object" );
-
-		value = ReflectionHelper.getMappedValue( map, "foo" );
-		assertNull( value, "A non existent index should return the null value" );
-
-		value = ReflectionHelper.getMappedValue( map, "2" );
-		assertNull( value, "A non existent index should return the null value" );
-	}
-
-	@Test
-	public void testGetIndexedValueForList() {
-		List<Object> list = new ArrayList<Object>();
-		Object testObject = new Object();
-		list.add( testObject );
-
-		Object value = ReflectionHelper.getIndexedValue( list, 0 );
-		assertEquals( value, testObject, "We should be able to retrieve the indexed object" );
-
-		value = ReflectionHelper.getIndexedValue( list, 2 );
-		assertNull( value, "A non existent index should return the null value" );
-	}
-
-	@Test
-	public void testGetIndexedValueForNull() {
-		Object value = ReflectionHelper.getIndexedValue( null, 0 );
-		assertNull( value );
-	}
-
-	@Test
-	public void testGetMessageParameter() {
-		NotNull testAnnotation = new NotNull() {
-			public String message() {
-				return "test";
-			}
-
-			public Class<?>[] groups() {
-				return new Class<?>[] { Default.class };
-			}
-
-			public Class<? extends Payload>[] payload() {
-				@SuppressWarnings("unchecked")
-				Class<? extends Payload>[] classes = new Class[] { };
-				return classes;
-			}
-
-			public Class<? extends Annotation> annotationType() {
-				return this.getClass();
-			}
-		};
-		String message = ReflectionHelper.getAnnotationParameter( testAnnotation, "message", String.class );
-		assertEquals( "test", message, "Wrong message" );
-
-		Class<?>[] group = ReflectionHelper.getAnnotationParameter( testAnnotation, "groups", Class[].class );
-		assertEquals( group[0], Default.class, "Wrong message" );
-
-		try {
-			ReflectionHelper.getAnnotationParameter( testAnnotation, "message", Integer.class );
-			fail();
-		}
-		catch ( ValidationException e ) {
-			assertTrue( e.getMessage().startsWith( "Wrong parameter type." ), "Wrong exception message" );
-		}
-
-		try {
-			ReflectionHelper.getAnnotationParameter( testAnnotation, "foo", Integer.class );
-			fail();
-		}
-		catch ( ValidationException e ) {
-			assertTrue(
-					e.getMessage().startsWith( "The specified annotation defines no parameter" ),
-					"Wrong exception message"
-			);
-		}
-	}
-
-	public class TestTypes {
-		public List<String> stringList;
-		public Map<String, Object> objectMap;
-		public String[] stringArray;
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/util/TestUtil.java b/hibernate-validator/src/test/java/org/hibernate/validator/util/TestUtil.java
deleted file mode 100644
index c8b17c8..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/util/TestUtil.java
+++ /dev/null
@@ -1,299 +0,0 @@
-// $Id: TestUtil.java 17911 2009-11-04 16:24:28Z hardy.ferentschik $
-/*
-* 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.util;
-
-import java.io.InputStream;
-import java.lang.annotation.Annotation;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import javax.validation.Configuration;
-import javax.validation.ConstraintViolation;
-import javax.validation.Path;
-import javax.validation.Validation;
-import javax.validation.Validator;
-import javax.validation.metadata.ConstraintDescriptor;
-import javax.validation.metadata.ElementDescriptor;
-import javax.validation.metadata.PropertyDescriptor;
-
-import org.slf4j.Logger;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-import static org.testng.FileAssert.fail;
-
-import org.hibernate.validator.HibernateValidator;
-import org.hibernate.validator.HibernateValidatorConfiguration;
-import org.hibernate.validator.engine.PathImpl;
-
-/**
- * Tests for the <code>ReflectionHelper</code>.
- *
- * @author Hardy Ferentschik
- */
-public class TestUtil {
-	private static final Logger log = LoggerFactory.make();
-
-	private static Validator hibernateValidator;
-
-	private TestUtil() {
-	}
-
-	public static Validator getValidator() {
-		if ( hibernateValidator == null ) {
-			Configuration configuration = getConfiguration();
-			hibernateValidator = configuration.buildValidatorFactory().getValidator();
-		}
-		return hibernateValidator;
-	}
-
-	public static Configuration<?> getConfiguration() {
-		return Validation.byProvider( HibernateValidator.class ).configure();
-	}
-
-	/**
-	 * @param path The path to the xml file which should server as <code>validation.xml</code> for the returned
-	 * <code>Validator</code>.
-	 *
-	 * @return A <code>Validator</code> instance which respects the configuration specified in the file with the path
-	 *         <code>path</code>.
-	 */
-	public static Validator getValidatorWithCustomConfiguration(String path) {
-		Thread.currentThread().setContextClassLoader( new CustomValidationXmlClassLoader( path ) );
-
-		HibernateValidatorConfiguration configuration = Validation
-				.byProvider( HibernateValidator.class )
-				.configure();
-		return configuration.buildValidatorFactory().getValidator();
-	}
-
-	/**
-	 * @return A <code>Validator</code> instance which ignores <i>validation.xml</code>.
-	 */
-	public static Validator getValidatorIgnoringValidationXml() {
-		Thread.currentThread().setContextClassLoader( new IgnoringValidationXmlClassLoader() );
-
-		HibernateValidatorConfiguration configuration = Validation
-				.byProvider( HibernateValidator.class )
-				.configure();
-		return configuration.buildValidatorFactory().getValidator();
-	}
-
-	public static ConstraintDescriptor<?> getSingleConstraintDescriptorFor(Class<?> clazz, String property) {
-		Set<ConstraintDescriptor<?>> constraintDescriptors = getConstraintDescriptorsFor( clazz, property );
-		assertTrue(
-				constraintDescriptors.size() == 1, "This method should only be used when there is a single constraint"
-		);
-		return constraintDescriptors.iterator().next();
-	}
-
-	public static PropertyDescriptor getPropertyDescriptor(Class<?> clazz, String property) {
-		Validator validator = getValidator();
-		return validator.getConstraintsForClass( clazz ).getConstraintsForProperty( property );
-	}
-
-	public static Set<ConstraintDescriptor<?>> getConstraintDescriptorsFor(Class<?> clazz, String property) {
-		ElementDescriptor elementDescriptor = getPropertyDescriptor( clazz, property );
-		return elementDescriptor.getConstraintDescriptors();
-	}
-
-	public static <T> void assertCorrectConstraintViolationMessages(Set<ConstraintViolation<T>> violations, String... messages) {
-		List<String> actualMessages = new ArrayList<String>();
-		for ( ConstraintViolation<?> violation : violations ) {
-			actualMessages.add( violation.getMessage() );
-		}
-
-		assertTrue( actualMessages.size() == messages.length, "Wrong number or error messages" );
-
-		for ( String expectedMessage : messages ) {
-			assertTrue(
-					actualMessages.contains( expectedMessage ),
-					"The message '" + expectedMessage + "' should have been in the list of actual messages: " + actualMessages
-			);
-			actualMessages.remove( expectedMessage );
-		}
-		assertTrue(
-				actualMessages.isEmpty(), "Actual messages contained more messages as specidied expected messages"
-		);
-	}
-
-	public static <T> void assertCorrectConstraintTypes(Set<ConstraintViolation<T>> violations, Class<?>... expectedConsraintTypes) {
-		List<String> actualConstraintTypes = new ArrayList<String>();
-		for ( ConstraintViolation<?> violation : violations ) {
-			actualConstraintTypes.add(
-					( ( Annotation ) violation.getConstraintDescriptor().getAnnotation() ).annotationType().getName()
-			);
-		}
-
-		assertEquals(
-				expectedConsraintTypes.length, actualConstraintTypes.size(), "Wrong number of constraint types."
-		);
-
-		for ( Class<?> expectedConstraintType : expectedConsraintTypes ) {
-			assertTrue(
-					actualConstraintTypes.contains( expectedConstraintType.getName() ),
-					"The constraint type " + expectedConstraintType.getName() + " should have been violated."
-			);
-		}
-	}
-
-	public static <T> void assertCorrectPropertyPaths(Set<ConstraintViolation<T>> violations, String... propertyPaths) {
-		List<Path> propertyPathsOfViolations = new ArrayList<Path>();
-		for ( ConstraintViolation<?> violation : violations ) {
-			propertyPathsOfViolations.add( violation.getPropertyPath() );
-		}
-
-		for ( String propertyPath : propertyPaths ) {
-			Path expectedPath = PathImpl.createPathFromString( propertyPath );
-			boolean containsPath = false;
-			for ( Path actualPath : propertyPathsOfViolations ) {
-				if ( assertEqualPaths( expectedPath, actualPath ) ) {
-					containsPath = true;
-					break;
-				}
-			}
-			if ( !containsPath ) {
-				fail( expectedPath + " is not in the list of path instances contained in the actual constraint violations: " + propertyPathsOfViolations );
-			}
-		}
-	}
-
-	public static void assertConstraintViolation(ConstraintViolation violation, String errorMessage, Class rootBean, Object invalidValue, String propertyPath, Class leafBean) {
-		assertEquals(
-
-				violation.getLeafBean().getClass(),
-				leafBean,
-				"Wrong leaf bean type"
-		);
-		assertConstraintViolation( violation, errorMessage, rootBean, invalidValue, propertyPath );
-	}
-
-	public static void assertConstraintViolation(ConstraintViolation violation, String errorMessage, Class rootBean, Object invalidValue, String propertyPath) {
-		assertEquals(
-				violation.getPropertyPath(),
-				PathImpl.createPathFromString( propertyPath ),
-				"Wrong propertyPath"
-		);
-		assertConstraintViolation( violation, errorMessage, rootBean, invalidValue );
-	}
-
-	public static void assertConstraintViolation(ConstraintViolation violation, String errorMessage, Class rootBean, Object invalidValue) {
-		assertEquals(
-				violation.getInvalidValue(),
-				invalidValue,
-				"Wrong invalid value"
-		);
-		assertConstraintViolation( violation, errorMessage, rootBean );
-	}
-
-	public static void assertConstraintViolation(ConstraintViolation violation, String errorMessage, Class rootBean) {
-		assertEquals(
-				violation.getRootBean().getClass(),
-				rootBean,
-				"Wrong root bean type"
-		);
-		assertConstraintViolation( violation, errorMessage );
-	}
-
-	public static void assertConstraintViolation(ConstraintViolation violation, String message) {
-		assertEquals( violation.getMessage(), message, "Wrong message" );
-	}
-
-	public static void assertNumberOfViolations(Set violations, int expectedViolations) {
-		assertEquals( violations.size(), expectedViolations, "Wrong number of constraint violations" );
-	}
-
-	public static boolean assertEqualPaths(Path p1, Path p2) {
-		Iterator<Path.Node> p1Iterator = p1.iterator();
-		Iterator<Path.Node> p2Iterator = p2.iterator();
-		while ( p1Iterator.hasNext() ) {
-			Path.Node p1Node = p1Iterator.next();
-			if ( !p2Iterator.hasNext() ) {
-				return false;
-			}
-			Path.Node p2Node = p2Iterator.next();
-
-			// do the comparison on the node values
-			if ( p2Node.getName() == null ) {
-				if ( p1Node.getName() != null ) {
-					return false;
-				}
-			}
-			else if ( !p2Node.getName().equals( p1Node.getName() ) ) {
-				return false;
-			}
-
-			if ( p2Node.isInIterable() != p1Node.isInIterable() ) {
-				return false;
-			}
-
-
-			if ( p2Node.getIndex() == null ) {
-				if ( p1Node.getIndex() != null ) {
-					return false;
-				}
-			}
-			else if ( !p2Node.getIndex().equals( p1Node.getIndex() ) ) {
-				return false;
-			}
-
-			if ( p2Node.getKey() == null ) {
-				if ( p1Node.getKey() != null ) {
-					return false;
-				}
-			}
-			else if ( !p2Node.getKey().equals( p1Node.getKey() ) ) {
-				return false;
-			}
-		}
-
-		return !p2Iterator.hasNext();
-	}
-
-	private static class CustomValidationXmlClassLoader extends ClassLoader {
-		private final String customValidationXmlPath;
-
-		CustomValidationXmlClassLoader(String pathToCustomValidationXml) {
-			super( CustomValidationXmlClassLoader.class.getClassLoader() );
-			customValidationXmlPath = pathToCustomValidationXml;
-		}
-
-		public InputStream getResourceAsStream(String path) {
-			String finalPath = path;
-			if ( "META-INF/validation.xml".equals( path ) ) {
-				log.info( "Using {} as validation.xml", customValidationXmlPath );
-				finalPath = customValidationXmlPath;
-			}
-			return super.getResourceAsStream( finalPath );
-		}
-	}
-
-	private static class IgnoringValidationXmlClassLoader extends ClassLoader {
-		IgnoringValidationXmlClassLoader() {
-			super( IgnoringValidationXmlClassLoader.class.getClassLoader() );
-		}
-
-		public InputStream getResourceAsStream(String path) {
-			if ( "META-INF/validation.xml".equals( path ) ) {
-				log.info( "Ignoring call to load validation.xml" );
-				return null;
-			}
-			return super.getResourceAsStream( path );
-		}
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/util/ValidatorTypeTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/util/ValidatorTypeTest.java
deleted file mode 100644
index 111750d..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/util/ValidatorTypeTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-// $Id: ValidatorTypeTest.java 17747 2009-10-14 17:06:14Z hardy.ferentschik $
-/*
-* 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.util;
-
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import javax.validation.ConstraintValidator;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNull;
-import org.testng.annotations.Test;
-
-/**
- * Tests for message resolution.
- *
- * @author Emmanuel Bernard
- */
-public class ValidatorTypeTest {
-
-	@Test
-	public void testTypeDiscovery() {
-		List<Class<? extends ConstraintValidator<Positive, ?>>> validators =
-				new ArrayList<Class<? extends ConstraintValidator<Positive, ?>>>();
-		validators.add( PositiveConstraintValidator.class );
-		Map<Type, Class<? extends ConstraintValidator<?, ?>>> validatorsTypes = ValidatorTypeHelper
-				.getValidatorsTypes( validators );
-
-		assertEquals( validatorsTypes.get( Integer.class ), PositiveConstraintValidator.class );
-		assertNull( validatorsTypes.get( String.class ) );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/util/annotationfactory/AnnotationFactoryTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/util/annotationfactory/AnnotationFactoryTest.java
deleted file mode 100644
index bc75622..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/util/annotationfactory/AnnotationFactoryTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.util.annotationfactory;
-
-import javax.validation.constraints.Pattern;
-import javax.validation.constraints.Size;
-
-import static org.testng.Assert.assertEquals;
-import org.testng.annotations.Test;
-
-
-/**
- * @author Hardy Ferentschik
- */
-public class AnnotationFactoryTest {
-
-	@Test
-	public void createAnnotationProxy() {
-		AnnotationDescriptor<Size> descriptor = new AnnotationDescriptor<Size>( Size.class );
-		descriptor.setValue( "min", 5 );
-		descriptor.setValue( "max", 10 );
-
-		Size size = AnnotationFactory.create( descriptor );
-
-		assertEquals( size.min(), 5, "Wrong parameter value" );
-		assertEquals( size.max(), 10, "Wrong parameter value" );
-	}
-
-	@Test(expectedExceptions = IllegalArgumentException.class)
-	public void createAnnotationProxyMissingRequiredParamter() {
-		AnnotationDescriptor<Pattern> descriptor = new AnnotationDescriptor<Pattern>( Pattern.class );
-		AnnotationFactory.create( descriptor );
-	}
-
-	@Test
-	public void createAnnotationProxyWithRequiredParamter() {
-		AnnotationDescriptor<Pattern> descriptor = new AnnotationDescriptor<Pattern>( Pattern.class );
-		descriptor.setValue( "regexp", ".*" );
-
-		Pattern pattern = AnnotationFactory.create( descriptor );
-
-		assertEquals( ".*", pattern.regexp(), "Wrong parameter value" );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/xml/Customer.java b/hibernate-validator/src/test/java/org/hibernate/validator/xml/Customer.java
deleted file mode 100644
index 1004d22..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/xml/Customer.java
+++ /dev/null
@@ -1,71 +0,0 @@
-// $Id: Customer.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.xml;
-
-/**
- * @author Hardy Ferentschik
- */
-public class Customer implements Person {
-    private String firstName;
-    private String middleName;
-    private String lastName;
-
-    private String customerId;
-
-    private String password;
-
-    public String getFirstName() {
-	return this.firstName;
-    }
-
-    public void setFirstName(final String firstName) {
-	this.firstName = firstName;
-    }
-
-    public String getMiddleName() {
-	return this.middleName;
-    }
-
-    public void setMiddleName(final String middleName) {
-	this.middleName = middleName;
-    }
-
-    public String getLastName() {
-	return this.lastName;
-    }
-
-    public void setLastName(final String lastName) {
-	this.lastName = lastName;
-    }
-
-    public String getCustomerId() {
-	return this.customerId;
-    }
-
-    public void setCustomerId(final String customerId) {
-	this.customerId = customerId;
-    }
-
-    public String getPassword() {
-	return this.password;
-    }
-
-    public void setPassword(final String password) {
-	this.password = password;
-    }
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/xml/MyInterface.java b/hibernate-validator/src/test/java/org/hibernate/validator/xml/MyInterface.java
deleted file mode 100644
index d611c18..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/xml/MyInterface.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// $Id: MyInterface.java 17861 2009-10-28 12:15:44Z hardy.ferentschik $
-/*
-* 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.xml;
-
-/**
- * @author Hardy Ferentschik
- */
-public interface MyInterface {
-	Integer getId();
-}
-
-
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/xml/MyInterfaceImpl.java b/hibernate-validator/src/test/java/org/hibernate/validator/xml/MyInterfaceImpl.java
deleted file mode 100644
index b45a056..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/xml/MyInterfaceImpl.java
+++ /dev/null
@@ -1,28 +0,0 @@
-// $Id: MyInterfaceImpl.java 17861 2009-10-28 12:15:44Z hardy.ferentschik $
-/*
-* 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.xml;
-
-
-/**
- * @author Hardy Ferentschik
- */
-public class MyInterfaceImpl implements MyInterface {
-	public Integer getId() {
-		return null;
-	}
-}
\ No newline at end of file
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/xml/Person.java b/hibernate-validator/src/test/java/org/hibernate/validator/xml/Person.java
deleted file mode 100644
index 86ee227..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/xml/Person.java
+++ /dev/null
@@ -1,30 +0,0 @@
-// $Id: Person.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.xml;
-
-/**
- * @author Hardy Ferentschik
- */
-public interface Person {
-
-    String getFirstName();
-
-    String getMiddleName();
-
-    String getLastName();
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/xml/Properties.java b/hibernate-validator/src/test/java/org/hibernate/validator/xml/Properties.java
deleted file mode 100644
index 6d56c79..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/xml/Properties.java
+++ /dev/null
@@ -1,37 +0,0 @@
-// $Id: Properties.java 17743 2009-10-14 11:47:08Z hardy.ferentschik $
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, 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.xml;
-
-import java.util.List;
-
-/**
- * @author Hardy Ferentschik
- */
-public class Properties {
-	private List<String> listOfString;
-
-	public List<String> getListOfString() {
-		return listOfString;
-	}
-
-	public void setListOfString(List<String> listOfString) {
-		this.listOfString = listOfString;
-	}
-}
-
-
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/xml/XmlMappingTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/xml/XmlMappingTest.java
deleted file mode 100644
index 6ce5ec2..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/xml/XmlMappingTest.java
+++ /dev/null
@@ -1,127 +0,0 @@
-// $Id: XmlMappingTest.java 17911 2009-11-04 16:24:28Z hardy.ferentschik $
-/*
-* 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.xml;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import javax.validation.Configuration;
-import javax.validation.ConstraintViolation;
-import javax.validation.Validator;
-import javax.validation.ValidatorFactory;
-import javax.validation.groups.Default;
-
-import static org.testng.Assert.assertEquals;
-import org.testng.annotations.Test;
-
-import org.hibernate.validator.util.TestUtil;
-
-/**
- * @author Hardy Ferentschik
- */
-public class XmlMappingTest {
-
-	@Test
-	/**
-	 * HV-214
-	 */
-	public void testConstraintInheritanceWithXmlConfiguration() {
-
-		final Configuration<?> configuration = TestUtil.getConfiguration();
-		configuration.addMapping( XmlMappingTest.class.getResourceAsStream( "mapping.xml" ) );
-
-		final ValidatorFactory validatorFactory = configuration.buildValidatorFactory();
-		final Validator validator = validatorFactory.getValidator();
-
-		final Set<ConstraintViolation<Customer>> violations = validator.validate( new Customer(), Default.class );
-
-		assertEquals( violations.size(), 1 );
-	}
-
-	@Test
-	/**
-	 * HV-252
-	 */
-	public void testListOfString() {
-
-		final Configuration<?> configuration = TestUtil.getConfiguration();
-		configuration.addMapping( XmlMappingTest.class.getResourceAsStream( "properties-mapping.xml" ) );
-
-		final ValidatorFactory validatorFactory = configuration.buildValidatorFactory();
-		final Validator validator = validatorFactory.getValidator();
-
-		List<String> listOfString = new ArrayList<String>();
-		listOfString.add( "one" );
-		listOfString.add( "two" );
-		listOfString.add( "three" );
-
-		final Set<ConstraintViolation<Properties>> violations = validator.validateValue(
-				Properties.class, "listOfString", listOfString
-		);
-
-		assertEquals( violations.size(), 0 );
-	}
-
-	@Test
-	/**
-	 * HV-262
-	 */
-	public void testInterfaceConfiguration() {
-
-		final Configuration<?> configuration = TestUtil.getConfiguration();
-		configuration.addMapping( XmlMappingTest.class.getResourceAsStream( "my-interface-mapping.xml" ) );
-
-		final ValidatorFactory validatorFactory = configuration.buildValidatorFactory();
-		final Validator validator = validatorFactory.getValidator();
-		final Set<ConstraintViolation<MyInterfaceImpl>> violations = validator.validate( new MyInterfaceImpl() );
-
-		assertEquals( violations.size(), 1 );
-	}
-
-	@Test
-	/**
-	 * HV-262
-	 */
-	public void testInterfaceImplementationConfiguration() {
-
-		final Configuration<?> configuration = TestUtil.getConfiguration();
-		configuration.addMapping( XmlMappingTest.class.getResourceAsStream( "my-interface-impl-mapping.xml" ) );
-
-		final ValidatorFactory validatorFactory = configuration.buildValidatorFactory();
-		final Validator validator = validatorFactory.getValidator();
-		final Set<ConstraintViolation<MyInterfaceImpl>> violations = validator.validate( new MyInterfaceImpl() );
-
-		assertEquals( violations.size(), 1 );
-	}
-
-	@Test
-	/**
-	 * HV-263
-	 */
-	public void testEmptyInterfaceConfiguration() {
-
-		final Configuration<?> configuration = TestUtil.getConfiguration();
-		configuration.addMapping( XmlMappingTest.class.getResourceAsStream( "empty-my-interface-mapping.xml" ) );
-
-		final ValidatorFactory validatorFactory = configuration.buildValidatorFactory();
-		final Validator validator = validatorFactory.getValidator();
-		final Set<ConstraintViolation<MyInterfaceImpl>> violations = validator.validate( new MyInterfaceImpl() );
-
-		assertEquals( violations.size(), 0 );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/ICompetition.java b/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/ICompetition.java
deleted file mode 100755
index c1acc78..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/ICompetition.java
+++ /dev/null
@@ -1,20 +0,0 @@
-// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.xml.mixedconfiguration;
-
-public interface ICompetition {}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/IFixture.java b/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/IFixture.java
deleted file mode 100755
index 50bde89..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/IFixture.java
+++ /dev/null
@@ -1,22 +0,0 @@
-// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.xml.mixedconfiguration;
-
-public interface IFixture {
-	ICompetition getCompetition();
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/InheritanceMappingsTest.java b/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/InheritanceMappingsTest.java
deleted file mode 100755
index c1ce096..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/InheritanceMappingsTest.java
+++ /dev/null
@@ -1,130 +0,0 @@
-// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.xml.mixedconfiguration;
-
-import java.lang.annotation.Annotation;
-import java.util.Set;
-import javax.validation.Configuration;
-import javax.validation.ConstraintViolation;
-import javax.validation.Validator;
-import javax.validation.ValidatorFactory;
-import javax.validation.constraints.NotNull;
-
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.FileAssert.fail;
-import org.testng.annotations.Test;
-
-import org.hibernate.validator.util.TestUtil;
-
-
-/**
- * See HV-265
- *
- * @author Hardy Ferentschik
- */
-public class InheritanceMappingsTest {
-
-	@Test
-	public void defaultConfigurationNoExplicitAnnotationDefinition1() {
-		validateAnnotatedFixture(
-				new org.hibernate.validator.xml.mixedconfiguration.annotation.PersonCompetition(),
-				configure()
-		);
-	}
-
-	@Test
-	public void defaultConfigurationNoExplicitAnnotationDefinition2() {
-		validateAnnotatedFixture(
-				new org.hibernate.validator.xml.mixedconfiguration.annotation.TeamCompetition(),
-				configure()
-		);
-	}
-
-	@Test
-	public void customConfigurationNoExplicitAnnotationDefinition1() {
-		validateAnnotatedFixture(
-				new org.hibernate.validator.xml.mixedconfiguration.annotation.PersonCompetition(),
-				configure( "annotation-mappings.xml" )
-		);
-	}
-
-	@Test
-	public void customConfigurationNoExplicitAnnotationDefinition2() {
-		validateAnnotatedFixture(
-				new org.hibernate.validator.xml.mixedconfiguration.annotation.TeamCompetition(),
-				configure( "annotation-mappings.xml" )
-		);
-	}
-
-	@Test
-	public void customConfigurationExplicitXmlDefinition() {
-		validateXmlDefinedFixture(
-				new org.hibernate.validator.xml.mixedconfiguration.xml.PersonCompetition(),
-				configure( "xml-mappings.xml" )
-		);
-	}
-
-	@Test
-	public void customConfigurationNoExplicitXmlDefinition() {
-		validateXmlDefinedFixture(
-				new org.hibernate.validator.xml.mixedconfiguration.xml.TeamCompetition(),
-				configure( "xml-mappings.xml" )
-		);
-	}
-
-	private Validator configure() {
-		return TestUtil.getValidator();
-	}
-
-	private Validator configure(String mappingsUrl) {
-		Configuration<?> configuration = TestUtil.getConfiguration();
-		configuration.addMapping( InheritanceMappingsTest.class.getResourceAsStream( mappingsUrl ) );
-
-		ValidatorFactory validatorFactory = configuration.buildValidatorFactory();
-		return validatorFactory.getValidator();
-	}
-
-	private void validateFixture(IFixture fixture, Validator validator) {
-		Set<ConstraintViolation<IFixture>> violations = validator.validate( fixture );
-
-		for ( ConstraintViolation<IFixture> violation : violations ) {
-			if ( violation.getLeafBean() instanceof ICompetition
-					&& "detail.competition.name".equals( violation.getPropertyPath().toString() ) ) {
-				assertEquals( violation.getLeafBean(), fixture.getCompetition() );
-				Annotation annotation = ( ( Annotation ) violation.getConstraintDescriptor().getAnnotation() );
-				assertEquals( annotation.annotationType(), NotNull.class );
-				return;
-			}
-		}
-		fail( "@NotNull constraint violation for 'detail.competition.name' not detected" );
-	}
-
-	private void validateAnnotatedFixture(org.hibernate.validator.xml.mixedconfiguration.annotation.Competition competition,
-										  Validator validator) {
-		org.hibernate.validator.xml.mixedconfiguration.annotation.Fixture fixture = new org.hibernate.validator.xml.mixedconfiguration.annotation.Fixture();
-		fixture.setCompetition( competition );
-		validateFixture( fixture, validator );
-	}
-
-	private void validateXmlDefinedFixture(org.hibernate.validator.xml.mixedconfiguration.xml.Competition competition,
-										   Validator validator) {
-		org.hibernate.validator.xml.mixedconfiguration.xml.Fixture fixture = new org.hibernate.validator.xml.mixedconfiguration.xml.Fixture();
-		fixture.setCompetition( competition );
-		validateFixture( fixture, validator );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/Competition.java b/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/Competition.java
deleted file mode 100755
index bee5c86..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/Competition.java
+++ /dev/null
@@ -1,46 +0,0 @@
-// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.xml.mixedconfiguration.annotation;
-
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-
-import org.hibernate.validator.xml.mixedconfiguration.ICompetition;
-
-public abstract class Competition implements ICompetition {
-
-	@NotNull
-	@Size(min = 1)
-	private String name;
-
-	public Competition() {
-		super();
-	}
-
-	public Competition(String name) {
-		setName( name );
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/Fixture.java b/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/Fixture.java
deleted file mode 100755
index b5141fd..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/Fixture.java
+++ /dev/null
@@ -1,31 +0,0 @@
-// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.xml.mixedconfiguration.annotation;
-
-import org.hibernate.validator.xml.mixedconfiguration.IFixture;
-
-public class Fixture extends Game implements IFixture {
-
-	public Fixture() {
-		super();
-	}
-
-	public Fixture(Competition competition) {
-		super( competition );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/Game.java b/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/Game.java
deleted file mode 100755
index d3b1a3f..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/Game.java
+++ /dev/null
@@ -1,48 +0,0 @@
-// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.xml.mixedconfiguration.annotation;
-
-import javax.validation.Valid;
-import javax.validation.constraints.NotNull;
-
-public abstract class Game {
-
-	@NotNull
-	@Valid
-	private GameDetail detail;
-
-	private Game(GameDetail detail) {
-		this.detail = detail;
-	}
-
-	public Game() {
-		this( new GameDetail() );
-	}
-
-	public Game(Competition competition) {
-		this( new GameDetail( competition ) );
-	}
-
-	public Competition getCompetition() {
-		return detail.getCompetition();
-	}
-
-	public void setCompetition(Competition competition) {
-		detail.setCompetition( competition );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/GameDetail.java b/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/GameDetail.java
deleted file mode 100755
index f436b26..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/GameDetail.java
+++ /dev/null
@@ -1,44 +0,0 @@
-// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.xml.mixedconfiguration.annotation;
-
-import javax.validation.Valid;
-import javax.validation.constraints.NotNull;
-
-public class GameDetail {
-
-	@NotNull
-	@Valid
-	private Competition competition;
-
-	public GameDetail() {
-		super();
-	}
-
-	public GameDetail(Competition competition) {
-		setCompetition( competition );
-	}
-
-	public Competition getCompetition() {
-		return competition;
-	}
-
-	public void setCompetition(Competition competition) {
-		this.competition = competition;
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/PersonCompetition.java b/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/PersonCompetition.java
deleted file mode 100755
index d9608b7..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/PersonCompetition.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.xml.mixedconfiguration.annotation;
-
-public class PersonCompetition extends Competition {
-
-	public PersonCompetition() {
-		super();
-	}
-
-	public PersonCompetition(String name) {
-		super( name );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/TeamCompetition.java b/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/TeamCompetition.java
deleted file mode 100755
index ec85a8b..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/annotation/TeamCompetition.java
+++ /dev/null
@@ -1,28 +0,0 @@
-// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.xml.mixedconfiguration.annotation;
-
-public class TeamCompetition extends Competition {
-	public TeamCompetition() {
-		super();
-	}
-
-	public TeamCompetition(String name) {
-		super( name );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/Competition.java b/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/Competition.java
deleted file mode 100755
index 784ebc2..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/Competition.java
+++ /dev/null
@@ -1,41 +0,0 @@
-// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.xml.mixedconfiguration.xml;
-
-import org.hibernate.validator.xml.mixedconfiguration.ICompetition;
-
-public abstract class Competition implements ICompetition {
-
-	private String name;
-
-	public Competition() {
-		super();
-	}
-
-	public Competition(String name) {
-		setName( name );
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/Fixture.java b/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/Fixture.java
deleted file mode 100755
index 2d7c9f3..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/Fixture.java
+++ /dev/null
@@ -1,36 +0,0 @@
-// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.xml.mixedconfiguration.xml;
-
-import org.hibernate.validator.xml.mixedconfiguration.IFixture;
-
-public class Fixture extends Game implements IFixture {
-
-	public Fixture() {
-		super();
-	}
-
-	public Fixture(Competition competition) {
-		super( competition );
-	}
-
-	@Override
-	public void setCompetition(Competition competition) {
-		super.setCompetition( competition );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/Game.java b/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/Game.java
deleted file mode 100755
index ca8ff81..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/Game.java
+++ /dev/null
@@ -1,43 +0,0 @@
-// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.xml.mixedconfiguration.xml;
-
-public abstract class Game {
-
-	private GameDetail detail;
-
-	private Game(GameDetail detail) {
-		this.detail = detail;
-	}
-
-	public Game() {
-		this( new GameDetail() );
-	}
-
-	public Game(Competition competition) {
-		this( new GameDetail( competition ) );
-	}
-
-	public Competition getCompetition() {
-		return detail.getCompetition();
-	}
-
-	public void setCompetition(Competition competition) {
-		detail.setCompetition( competition );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/GameDetail.java b/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/GameDetail.java
deleted file mode 100755
index 1ca8cb1..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/GameDetail.java
+++ /dev/null
@@ -1,39 +0,0 @@
-// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.xml.mixedconfiguration.xml;
-
-public class GameDetail {
-
-	private Competition competition;
-
-	public GameDetail() {
-		super();
-	}
-
-	public GameDetail(Competition competition) {
-		setCompetition( competition );
-	}
-
-	public Competition getCompetition() {
-		return competition;
-	}
-
-	public void setCompetition(Competition competition) {
-		this.competition = competition;
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/PersonCompetition.java b/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/PersonCompetition.java
deleted file mode 100755
index ae0097d..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/PersonCompetition.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.xml.mixedconfiguration.xml;
-
-public class PersonCompetition extends Competition {
-
-	public PersonCompetition() {
-		super();
-	}
-
-	public PersonCompetition(String name) {
-		super( name );
-	}
-}
diff --git a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/TeamCompetition.java b/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/TeamCompetition.java
deleted file mode 100755
index afa473b..0000000
--- a/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/xml/TeamCompetition.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// $Id: AnnotationFactoryTest.java 17620 2009-10-04 19:19:28Z hardy.ferentschik $
-/*
-* 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.xml.mixedconfiguration.xml;
-
-public class TeamCompetition extends Competition {
-
-	public TeamCompetition() {
-		super();
-	}
-
-	public TeamCompetition(String name) {
-		super( name );
-	}
-}
diff --git a/hibernate-validator/src/test/resources/hibernate.properties b/hibernate-validator/src/test/resources/hibernate.properties
new file mode 100644
index 0000000..b3fb7eb
--- /dev/null
+++ b/hibernate-validator/src/test/resources/hibernate.properties
@@ -0,0 +1,30 @@
+#
+# 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.
+#
+
+hibernate.dialect ${db.dialect}
+hibernate.connection.driver_class ${jdbc.driver}
+hibernate.connection.url ${jdbc.url}
+hibernate.connection.username ${jdbc.user}
+hibernate.connection.password ${jdbc.pass}
+hibernate.connection.isolation ${jdbc.isolation}
+
+hibernate.connection.pool_size 5
+
+hibernate.show_sql true
+hibernate.format_sql true
+
+
diff --git a/hibernate-validator/src/test/resources/log4j.properties b/hibernate-validator/src/test/resources/log4j.properties
index 2342416..23f34ce 100644
--- a/hibernate-validator/src/test/resources/log4j.properties
+++ b/hibernate-validator/src/test/resources/log4j.properties
@@ -21,5 +21,6 @@ log4j.appender.socket.locationInfo=true
 log4j.rootLogger=debug, stdout
 
 log4j.logger.org.hibernate.validator.engine.ValidatorImpl=trace
+#log4j.logger.org.hibernate.validator.engine.resolver.JPATraversableResolver=trace
 #log4j.logger.org.hibernate.validatorengine.ConstraintTree=trace
-log4j.logger.org.hibernate.validator.engine.ResourceBundleMessageInterpolator=info
+log4j.logger.org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator=info
diff --git a/hibernate-validator/src/test/resources/org/hibernate/validator/test/resourceloading/AggregateResourceBundleLocatorTestBundle1.properties b/hibernate-validator/src/test/resources/org/hibernate/validator/test/resourceloading/AggregateResourceBundleLocatorTestBundle1.properties
new file mode 100644
index 0000000..82a0da4
--- /dev/null
+++ b/hibernate-validator/src/test/resources/org/hibernate/validator/test/resourceloading/AggregateResourceBundleLocatorTestBundle1.properties
@@ -0,0 +1,2 @@
+key_1=value 1 from bundle 1
+key_2=value 2 from bundle 1
diff --git a/hibernate-validator/src/test/resources/org/hibernate/validator/test/resourceloading/AggregateResourceBundleLocatorTestBundle2.properties b/hibernate-validator/src/test/resources/org/hibernate/validator/test/resourceloading/AggregateResourceBundleLocatorTestBundle2.properties
new file mode 100644
index 0000000..a0902f4
--- /dev/null
+++ b/hibernate-validator/src/test/resources/org/hibernate/validator/test/resourceloading/AggregateResourceBundleLocatorTestBundle2.properties
@@ -0,0 +1,2 @@
+key_2=value 2 from bundle 2
+key_3=value 3 from bundle 2
\ No newline at end of file
diff --git a/hibernate-validator/src/test/resources/org/hibernate/validator/test/xml/empty-my-interface-mapping.xml b/hibernate-validator/src/test/resources/org/hibernate/validator/test/xml/empty-my-interface-mapping.xml
new file mode 100644
index 0000000..81d0cdf
--- /dev/null
+++ b/hibernate-validator/src/test/resources/org/hibernate/validator/test/xml/empty-my-interface-mapping.xml
@@ -0,0 +1,7 @@
+<constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                     xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd"
+                     xmlns="http://jboss.org/xml/ns/javax/validation/mapping">
+    <default-package>org.hibernate.validator.xml</default-package>
+    <bean class="org.hibernate.validator.test.xml.MyInterface" ignore-annotations="true">
+    </bean>
+</constraint-mappings>
\ No newline at end of file
diff --git a/hibernate-validator/src/test/resources/org/hibernate/validator/test/xml/mapping.xml b/hibernate-validator/src/test/resources/org/hibernate/validator/test/xml/mapping.xml
new file mode 100644
index 0000000..4020cc6
--- /dev/null
+++ b/hibernate-validator/src/test/resources/org/hibernate/validator/test/xml/mapping.xml
@@ -0,0 +1,16 @@
+<constraint-mappings
+        xmlns="http://jboss.org/xml/ns/javax/validation/mapping"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation=
+                "http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd">
+
+    <default-package>org.hibernate.validator.xml</default-package>
+
+    <bean class="org.hibernate.validator.test.xml.Person" ignore-annotations="false">
+        <getter name="firstName">
+            <constraint annotation="javax.validation.constraints.NotNull"/>
+        </getter>
+    </bean>
+
+    <bean class="org.hibernate.validator.test.xml.Customer" ignore-annotations="false"/>
+</constraint-mappings>
\ No newline at end of file
diff --git a/hibernate-validator/src/test/resources/org/hibernate/validator/xml/mixedconfiguration/annotation-mappings.xml b/hibernate-validator/src/test/resources/org/hibernate/validator/test/xml/mixedconfiguration/annotation-mappings.xml
similarity index 100%
rename from hibernate-validator/src/test/resources/org/hibernate/validator/xml/mixedconfiguration/annotation-mappings.xml
rename to hibernate-validator/src/test/resources/org/hibernate/validator/test/xml/mixedconfiguration/annotation-mappings.xml
diff --git a/hibernate-validator/src/test/resources/org/hibernate/validator/test/xml/mixedconfiguration/xml-mappings.xml b/hibernate-validator/src/test/resources/org/hibernate/validator/test/xml/mixedconfiguration/xml-mappings.xml
new file mode 100755
index 0000000..97418ca
--- /dev/null
+++ b/hibernate-validator/src/test/resources/org/hibernate/validator/test/xml/mixedconfiguration/xml-mappings.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<constraint-mappings
+        xmlns="http://jboss.org/xml/ns/javax/validation/mapping"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="
+		http://jboss.org/xml/ns/javax/validation/mapping
+		validation-mapping-1.0.xsd">
+
+    <default-package>org.hibernate.validator.xml.mixedconfiguration.xml</default-package>
+
+    <bean class="org.hibernate.validator.test.xml.mixedconfiguration.xml.Competition" ignore-annotations="true">
+        <field name="name">
+            <constraint annotation="javax.validation.constraints.NotNull"/>
+            <constraint annotation="javax.validation.constraints.Size">
+                <element name="min">1</element>
+            </constraint>
+        </field>
+    </bean>
+    <bean class="org.hibernate.validator.test.xml.mixedconfiguration.xml.PersonCompetition" ignore-annotations="true"/>
+    <!--bean class="TeamCompetition"/-->
+
+    <bean class="org.hibernate.validator.test.xml.mixedconfiguration.xml.Game" ignore-annotations="true">
+        <field name="detail">
+            <valid/>
+            <constraint annotation="javax.validation.constraints.NotNull"/>
+        </field>
+    </bean>
+
+    <bean class="org.hibernate.validator.test.xml.mixedconfiguration.xml.GameDetail" ignore-annotations="true">
+        <field name="competition">
+            <valid/>
+            <constraint annotation="javax.validation.constraints.NotNull"/>
+        </field>
+    </bean>
+    <bean class="org.hibernate.validator.test.xml.mixedconfiguration.xml.Fixture"/>
+
+</constraint-mappings>
diff --git a/hibernate-validator/src/test/resources/org/hibernate/validator/test/xml/my-interface-impl-mapping.xml b/hibernate-validator/src/test/resources/org/hibernate/validator/test/xml/my-interface-impl-mapping.xml
new file mode 100644
index 0000000..706419f
--- /dev/null
+++ b/hibernate-validator/src/test/resources/org/hibernate/validator/test/xml/my-interface-impl-mapping.xml
@@ -0,0 +1,10 @@
+<constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                     xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd"
+                     xmlns="http://jboss.org/xml/ns/javax/validation/mapping">
+    <default-package>org.hibernate.validator.xml</default-package>
+    <bean class="org.hibernate.validator.test.xml.MyInterfaceImpl" ignore-annotations="true">
+        <getter name="id" ignore-annotations="true">
+            <constraint annotation="javax.validation.constraints.NotNull"/>
+        </getter>
+    </bean>
+</constraint-mappings>
\ No newline at end of file
diff --git a/hibernate-validator/src/test/resources/org/hibernate/validator/test/xml/my-interface-mapping.xml b/hibernate-validator/src/test/resources/org/hibernate/validator/test/xml/my-interface-mapping.xml
new file mode 100644
index 0000000..d542b10
--- /dev/null
+++ b/hibernate-validator/src/test/resources/org/hibernate/validator/test/xml/my-interface-mapping.xml
@@ -0,0 +1,10 @@
+<constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                     xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd"
+                     xmlns="http://jboss.org/xml/ns/javax/validation/mapping">
+    <default-package>org.hibernate.validator.xml</default-package>
+    <bean class="org.hibernate.validator.test.xml.MyInterface" ignore-annotations="true">
+        <getter name="id" ignore-annotations="true">
+            <constraint annotation="javax.validation.constraints.NotNull"/>
+        </getter>
+    </bean>
+</constraint-mappings>
\ No newline at end of file
diff --git a/hibernate-validator/src/test/resources/org/hibernate/validator/test/xml/properties-mapping.xml b/hibernate-validator/src/test/resources/org/hibernate/validator/test/xml/properties-mapping.xml
new file mode 100644
index 0000000..3bf294d
--- /dev/null
+++ b/hibernate-validator/src/test/resources/org/hibernate/validator/test/xml/properties-mapping.xml
@@ -0,0 +1,11 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<constraint-mappings xmlns="http://jboss.org/xml/ns/javax/validation/mapping"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd">
+      <default-package>org.hibernate.validator.xml</default-package>
+      <bean class="org.hibernate.validator.test.xml.Properties" ignore-annotations="true">
+          <getter name="listOfString" ignore-annotations="true">
+              <constraint annotation="javax.validation.constraints.NotNull" />
+          </getter>
+      </bean>
+</constraint-mappings>
\ No newline at end of file
diff --git a/hibernate-validator/src/test/resources/org/hibernate/validator/xml/empty-my-interface-mapping.xml b/hibernate-validator/src/test/resources/org/hibernate/validator/xml/empty-my-interface-mapping.xml
deleted file mode 100644
index 8196cf3..0000000
--- a/hibernate-validator/src/test/resources/org/hibernate/validator/xml/empty-my-interface-mapping.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-                     xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd"
-                     xmlns="http://jboss.org/xml/ns/javax/validation/mapping">
-    <default-package>org.hibernate.validator.xml</default-package>
-    <bean class="MyInterface" ignore-annotations="true">
-    </bean>
-</constraint-mappings>
\ No newline at end of file
diff --git a/hibernate-validator/src/test/resources/org/hibernate/validator/xml/mapping.xml b/hibernate-validator/src/test/resources/org/hibernate/validator/xml/mapping.xml
deleted file mode 100644
index 5717fcf..0000000
--- a/hibernate-validator/src/test/resources/org/hibernate/validator/xml/mapping.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<constraint-mappings
-        xmlns="http://jboss.org/xml/ns/javax/validation/mapping"
-        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation=
-                "http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd">
-
-    <default-package>org.hibernate.validator.xml</default-package>
-
-    <bean class="Person" ignore-annotations="false">
-        <getter name="firstName">
-            <constraint annotation="javax.validation.constraints.NotNull"/>
-        </getter>
-    </bean>
-
-    <bean class="Customer" ignore-annotations="false"/>
-</constraint-mappings>
\ No newline at end of file
diff --git a/hibernate-validator/src/test/resources/org/hibernate/validator/xml/mixedconfiguration/xml-mappings.xml b/hibernate-validator/src/test/resources/org/hibernate/validator/xml/mixedconfiguration/xml-mappings.xml
deleted file mode 100755
index bad8221..0000000
--- a/hibernate-validator/src/test/resources/org/hibernate/validator/xml/mixedconfiguration/xml-mappings.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<constraint-mappings
-        xmlns="http://jboss.org/xml/ns/javax/validation/mapping"
-        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="
-		http://jboss.org/xml/ns/javax/validation/mapping
-		validation-mapping-1.0.xsd">
-
-    <default-package>org.hibernate.validator.xml.mixedconfiguration.xml</default-package>
-
-    <bean class="Competition" ignore-annotations="true">
-        <field name="name">
-            <constraint annotation="javax.validation.constraints.NotNull"/>
-            <constraint annotation="javax.validation.constraints.Size">
-                <element name="min">1</element>
-            </constraint>
-        </field>
-    </bean>
-    <bean class="PersonCompetition" ignore-annotations="true"/>
-    <!--bean class="TeamCompetition"/-->
-
-    <bean class="Game" ignore-annotations="true">
-        <field name="detail">
-            <valid/>
-            <constraint annotation="javax.validation.constraints.NotNull"/>
-        </field>
-    </bean>
-
-    <bean class="GameDetail" ignore-annotations="true">
-        <field name="competition">
-            <valid/>
-            <constraint annotation="javax.validation.constraints.NotNull"/>
-        </field>
-    </bean>
-    <bean class="Fixture"/>
-
-</constraint-mappings>
diff --git a/hibernate-validator/src/test/resources/org/hibernate/validator/xml/my-interface-impl-mapping.xml b/hibernate-validator/src/test/resources/org/hibernate/validator/xml/my-interface-impl-mapping.xml
deleted file mode 100644
index 3b3512e..0000000
--- a/hibernate-validator/src/test/resources/org/hibernate/validator/xml/my-interface-impl-mapping.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-                     xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd"
-                     xmlns="http://jboss.org/xml/ns/javax/validation/mapping">
-    <default-package>org.hibernate.validator.xml</default-package>
-    <bean class="MyInterfaceImpl" ignore-annotations="true">
-        <getter name="id" ignore-annotations="true">
-            <constraint annotation="javax.validation.constraints.NotNull"/>
-        </getter>
-    </bean>
-</constraint-mappings>
\ No newline at end of file
diff --git a/hibernate-validator/src/test/resources/org/hibernate/validator/xml/my-interface-mapping.xml b/hibernate-validator/src/test/resources/org/hibernate/validator/xml/my-interface-mapping.xml
deleted file mode 100644
index aef99ac..0000000
--- a/hibernate-validator/src/test/resources/org/hibernate/validator/xml/my-interface-mapping.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-                     xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd"
-                     xmlns="http://jboss.org/xml/ns/javax/validation/mapping">
-    <default-package>org.hibernate.validator.xml</default-package>
-    <bean class="MyInterface" ignore-annotations="true">
-        <getter name="id" ignore-annotations="true">
-            <constraint annotation="javax.validation.constraints.NotNull"/>
-        </getter>
-    </bean>
-</constraint-mappings>
\ No newline at end of file
diff --git a/hibernate-validator/src/test/resources/org/hibernate/validator/xml/properties-mapping.xml b/hibernate-validator/src/test/resources/org/hibernate/validator/xml/properties-mapping.xml
deleted file mode 100644
index b0b7c2a..0000000
--- a/hibernate-validator/src/test/resources/org/hibernate/validator/xml/properties-mapping.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<constraint-mappings xmlns="http://jboss.org/xml/ns/javax/validation/mapping"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd">
-      <default-package>org.hibernate.validator.xml</default-package>
-      <bean class="Properties" ignore-annotations="true">
-          <getter name="listOfString" ignore-annotations="true">
-              <constraint annotation="javax.validation.constraints.NotNull" />
-          </getter>
-      </bean>
-</constraint-mappings>
\ No newline at end of file
diff --git a/hibernate-validator/src/test/suite/unit-tests.xml b/hibernate-validator/src/test/suite/unit-tests.xml
index 6b38fb3..115fef3 100644
--- a/hibernate-validator/src/test/suite/unit-tests.xml
+++ b/hibernate-validator/src/test/suite/unit-tests.xml
@@ -3,20 +3,25 @@
 <suite name="Hibernate Validator Unit Tests" verbose="1">
     <test name="Unit tests">
         <packages>
-            <package name="org.hibernate.validator.bootstrap"/>
-            <package name="org.hibernate.validator.constraints"/>
-            <package name="org.hibernate.validator.constraints.impl"/>
-            <package name="org.hibernate.validator.constraints.composition"/>
-            <package name="org.hibernate.validator.engine"/>
-            <package name="org.hibernate.validator.engine.groups"/>
-            <package name="org.hibernate.validator.engine.messageinterpolation"/>
-            <package name="org.hibernate.validator.engine.serialization"/>
-            <package name="org.hibernate.validator.engine.traversableresolver"/>
-            <package name="org.hibernate.validator.metadata"/>
-            <package name="org.hibernate.validator.util"/>
-            <package name="org.hibernate.validator.util.annotationfactory"/>
-            <package name="org.hibernate.validator.xml"/>
-            <package name="org.hibernate.validator.xml.mixedconfiguration"/>
+            <package name="org.hibernate.validator.test"/>
+            <package name="org.hibernate.validator.test.bootstrap"/>
+            <package name="org.hibernate.validator.test.cfg"/>
+            <package name="org.hibernate.validator.test.constraints"/>
+            <package name="org.hibernate.validator.test.constraints.impl"/>
+            <package name="org.hibernate.validator.test.constraints.composition"/>
+            <package name="org.hibernate.validator.test.engine"/>
+            <package name="org.hibernate.validator.test.engine.customerror"/>
+            <package name="org.hibernate.validator.test.engine.groups"/>
+            <package name="org.hibernate.validator.test.engine.messageinterpolation"/>
+            <package name="org.hibernate.validator.test.engine.proxy"/>
+            <package name="org.hibernate.validator.test.engine.serialization"/>
+            <package name="org.hibernate.validator.test.engine.traversableresolver"/>
+            <package name="org.hibernate.validator.test.metadata"/>
+            <package name="org.hibernate.validator.test.resourceloading"/>
+            <package name="org.hibernate.validator.test.util"/>
+            <package name="org.hibernate.validator.test.util.annotationfactory"/>
+            <package name="org.hibernate.validator.test.xml"/>
+            <package name="org.hibernate.validator.test.xml.mixedconfiguration"/>
         </packages>
     </test>
 </suite>
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 0b1cd64..cf931fe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,14 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.hibernate</groupId>
     <artifactId>hibernate-validator-parent</artifactId>
     <packaging>pom</packaging>
-    <version>4.0.2.GA</version>
-    <name>Hibernate Validator Parent</name>
+    <version>4.1.0.Final</version>
+    <name>Hibernate Validator Aggregator</name>
     <url>http://validator.hibernate.org</url>
 
     <description>
-        Hibernate's Bean Validation (JSR-303) reference implementation.
+        Aggregator of the Hibernate Validator modules.
     </description>
 
     <developers>
@@ -26,6 +27,13 @@
             <organization>JBoss, a division of Red Hat</organization>
             <url>http://in.relation.to/Bloggers/Hardy</url>
         </developer>
+        <developer>
+            <id>gunnar.morling</id>
+            <name>Gunnar Morling</name>
+            <email>gunnar.morling at googlemail.com</email>
+            <organization>Individual</organization>
+            <url>http://musingsofaprogrammingaddict.blogspot.com/</url>
+        </developer>
     </developers>
 
     <mailingLists>
@@ -40,16 +48,32 @@
         <module>hibernate-validator-archetype</module>
         <module>hibernate-validator-legacy</module>
         <module>hibernate-validator-tck-runner</module>
+        <module>hibernate-validator-annotation-processor</module>
     </modules>
 
     <dependencyManagement>
         <dependencies>
             <dependency>
+                <groupId>org.hibernate</groupId>
+                <artifactId>hibernate-validator</artifactId>
+                <version>${version}</version>
+            </dependency>
+            <dependency>
                 <groupId>javax.validation</groupId>
                 <artifactId>validation-api</artifactId>
                 <version>1.0.0.GA</version>
             </dependency>
             <dependency>
+                <groupId>javax.xml.bind</groupId>
+                <artifactId>jaxb-api</artifactId>
+                <version>2.2</version>
+            </dependency>
+            <dependency>
+                <groupId>com.sun.xml.bind</groupId>
+                <artifactId>jaxb-impl</artifactId>
+                <version>2.1.12</version>
+            </dependency>
+            <dependency>
                 <groupId>org.slf4j</groupId>
                 <artifactId>slf4j-api</artifactId>
                 <version>1.5.6</version>
@@ -60,11 +84,46 @@
                 <version>1.5.6</version>
             </dependency>
             <dependency>
+                <groupId>com.googlecode.jtype</groupId>
+                <artifactId>jtype</artifactId>
+                <version>0.1.1</version>
+            </dependency>
+            <dependency>
+                <groupId>org.hibernate.javax.persistence</groupId>
+                <artifactId>hibernate-jpa-2.0-api</artifactId>
+                <version>1.0.0.Final</version>
+            </dependency>
+            <dependency>
+                <groupId>org.hibernate</groupId>
+                <artifactId>hibernate-entitymanager</artifactId>
+                <version>3.5.0-Final</version>
+            </dependency>
+            <dependency>
                 <groupId>org.testng</groupId>
                 <artifactId>testng</artifactId>
                 <version>5.8</version>
                 <classifier>jdk15</classifier>
             </dependency>
+            <dependency>
+              <groupId>org.easymock</groupId>
+              <artifactId>easymock</artifactId>
+              <version>3.0</version>
+            </dependency>            
+            <dependency>
+                <groupId>com.h2database</groupId>
+                <artifactId>h2</artifactId>
+                <version>1.2.124</version>
+            </dependency>
+            <dependency>
+                <groupId>org.hibernate.jsr303.tck</groupId>
+                <artifactId>jsr303-tck</artifactId>
+                <version>1.0.3.GA</version>
+            </dependency>
+            <dependency>
+                <groupId>org.jboss.test-harness</groupId>
+                <artifactId>jboss-test-harness-jboss-as-51</artifactId>
+                <version>1.0.0</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 
@@ -76,6 +135,29 @@
                 <version>1.0-beta-2</version>
             </extension>
         </extensions>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-enforcer-plugin</artifactId>
+                <version>1.0-beta-1</version>
+                <executions>
+                    <execution>
+                        <id>enforce-java</id>
+                        <goals>
+                            <goal>enforce</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <rules>
+                        <requireJavaVersion>
+                            <!-- require JDK 1.6 to run the build -->
+                            <version>[1.6,)</version>
+                        </requireJavaVersion>
+                    </rules>
+                </configuration>
+            </plugin>
+        </plugins>
         <pluginManagement>
             <plugins>
                 <plugin>
@@ -107,6 +189,7 @@
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-surefire-plugin</artifactId>
+                    <version>2.4.3</version>
                     <configuration>
                         <forkMode>always</forkMode>
                         <redirectTestOutputToFile>true</redirectTestOutputToFile>
@@ -116,7 +199,27 @@
                     </configuration>
                 </plugin>
                 <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-surefire-report-plugin</artifactId>
+                    <version>2.4.3</version>
+                    <executions>
+                        <execution>
+                            <id>generate-test-report</id>
+                            <phase>test</phase>
+                            <goals>
+                                <goal>report-only</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+                    <configuration>
+                        <outputDirectory>${project.build.directory}/surefire-reports</outputDirectory>
+                        <outputName>test-report</outputName>
+                    </configuration>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-source-plugin</artifactId>
+                    <version>2.1.1</version>
                     <executions>
                         <execution>
                             <id>attach-sources</id>
@@ -127,25 +230,81 @@
                     </executions>
                 </plugin>
                 <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-dependency-plugin</artifactId>
+                    <version>2.1</version>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-assembly-plugin</artifactId>
-                    <configuration>
-                        <descriptorRefs>
-                            <descriptorRef>project</descriptorRef>
-                        </descriptorRefs>
-                    </configuration>
+                    <version>2.2-beta-5</version>
                 </plugin>
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-release-plugin</artifactId>
-                    <version>2.0-beta-9</version>
+                    <version>2.0</version>
                     <configuration>
-                        <preparationGoals>clean install</preparationGoals>
+	                    <preparationGoals>clean install</preparationGoals>
                         <autoVersionSubmodules>true</autoVersionSubmodules>
                         <allowTimestampedSnapshots>true</allowTimestampedSnapshots>
                         <remoteTagging>true</remoteTagging>
-                        <goals>package site assembly:assembly deploy</goals>
                     </configuration>
                 </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-deploy-plugin</artifactId>
+                    <version>2.5</version>
+                </plugin>
+                <plugin>
+                    <groupId>org.codehaus.mojo</groupId>
+                    <artifactId>exec-maven-plugin</artifactId>
+                    <version>1.1.1</version>
+                </plugin>
+                <plugin>
+                    <groupId>org.codehaus.mojo</groupId>
+                    <artifactId>jaxb2-maven-plugin</artifactId>
+                    <version>1.3</version>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-shade-plugin</artifactId>
+                    <version>1.2.2</version>
+                </plugin>
+                <plugin>
+                    <groupId>org.jboss.maven.plugins</groupId>
+                    <artifactId>maven-jdocbook-plugin</artifactId>
+                    <version>2.2.3</version>
+                </plugin>
+                <plugin>
+                    <groupId>org.jboss.maven.plugins</groupId>
+                    <artifactId>maven-jdocbook-style-plugin</artifactId>
+                    <version>2.0.0</version>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-project-info-reports-plugin</artifactId>
+                    <version>2.0.1</version>
+                </plugin>
+                <plugin>
+                    <groupId>org.twdata.maven</groupId>
+                    <artifactId>maven-cli-plugin</artifactId>
+                    <version>0.6.3.CR2</version>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.felix</groupId>
+                    <artifactId>maven-bundle-plugin</artifactId>
+                    <version>2.0.1</version>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-archetype-plugin</artifactId>
+                    <version>2.0-alpha-4</version>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-javadoc-plugin</artifactId>
+                    <version>2.7</version>
+                </plugin>
             </plugins>
         </pluginManagement>
     </build>
@@ -165,27 +324,25 @@
     <licenses>
         <license>
             <name>Apache License, Version 2.0</name>
-            <url>license.txt</url>
+            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
         </license>
     </licenses>
 
     <scm>
-        <connection>scm:svn:https://svn.jboss.org/repos/hibernate/validator/tags/v4_0_2_GA</connection>
-        <url>http://fisheye.jboss.org/browse/Hibernate/validator/tags/v4_0_2_GA</url>
+        <connection>scm:svn:https://svn.jboss.org/repos/hibernate/validator/tags/v4_1_0_Final</connection>
+        <url>http://fisheye.jboss.org/browse/Hibernate/validator/tags/v4_1_0_Final</url>
     </scm>
 
     <distributionManagement>
         <repository>
-            <!-- Copy the dist to the local checkout of the JBoss maven2 repo ${maven.repository.root} -->
-            <!-- It is anticipated that ${maven.repository.root} be set in user's settings.xml -->
-            <!-- todo : replace this with direct svn access once the svnkit providers are available -->
-            <id>repository.jboss.org</id>
-            <url>file://${maven.repository.root}</url>
+            <id>jboss-releases-repository</id>
+            <name>JBoss Releases Repository</name>
+            <url>https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/</url>
         </repository>
         <snapshotRepository>
-            <id>snapshots.jboss.org</id>
-            <name>JBoss Snapshot Repository</name>
-            <url>dav:https://snapshots.jboss.org/maven2</url>
+            <id>jboss-snapshots-repository</id>
+            <name>JBoss Snapshots Repository</name>
+            <url>https://repository.jboss.org/nexus/content/repositories/snapshots/</url>
         </snapshotRepository>
     </distributionManagement>
 
@@ -197,26 +354,6 @@
                 <version>2.0.1</version>
             </plugin>
             <plugin>
-                <artifactId>maven-javadoc-plugin</artifactId>
-                <reportSets>
-                    <reportSet>
-                        <id>html</id>
-                        <configuration>
-                            <tags>
-                                <tag>
-                                    <name>todo</name>
-                                    <placement>a</placement>
-                                    <head>ToDo:</head>
-                                </tag>
-                            </tags>
-                        </configuration>
-                        <reports>
-                            <report>javadoc</report>
-                        </reports>
-                    </reportSet>
-                </reportSets>
-            </plugin>
-            <plugin>
                 <groupId>org.codehaus.mojo</groupId>
                 <artifactId>jxr-maven-plugin</artifactId>
             </plugin>

-- 
Hibernate Validator



More information about the pkg-java-commits mailing list