Polishing (backported from master)

This commit is contained in:
Juergen Hoeller
2014-07-01 12:12:42 +02:00
parent c16032b98a
commit 48f753f368
15 changed files with 159 additions and 135 deletions
@@ -311,14 +311,15 @@ public class AnnotationConfigUtils {
static Set<AnnotationAttributes> attributesForRepeatable(AnnotationMetadata metadata,
Class<?> containerClass, Class<?> annotationClass) {
return attributesForRepeatable(metadata, containerClass.getName(), annotationClass.getName());
}
@SuppressWarnings("unchecked")
static Set<AnnotationAttributes> attributesForRepeatable(AnnotationMetadata metadata,
String containerClassName, String annotationClassName) {
Set<AnnotationAttributes> result = new LinkedHashSet<AnnotationAttributes>();
Set<AnnotationAttributes> result = new LinkedHashSet<AnnotationAttributes>();
addAttributesIfNotNull(result, metadata.getAnnotationAttributes(annotationClassName, false));
Map<String, Object> container = metadata.getAnnotationAttributes(containerClassName, false);
@@ -330,8 +331,7 @@ public class AnnotationConfigUtils {
return Collections.unmodifiableSet(result);
}
private static void addAttributesIfNotNull(Set<AnnotationAttributes> result,
Map<String, Object> attributes) {
private static void addAttributesIfNotNull(Set<AnnotationAttributes> result, Map<String, Object> attributes) {
if (attributes != null) {
result.add(AnnotationAttributes.fromMap(attributes));
}
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -94,19 +94,18 @@ public class SpringValidatorAdapter implements SmartValidator, javax.validation.
}
@Override
@SuppressWarnings("rawtypes")
public void validate(Object target, Errors errors, Object... validationHints) {
if (this.targetValidator != null) {
Set<Class> groups = new LinkedHashSet<Class>();
Set<Class<?>> groups = new LinkedHashSet<Class<?>>();
if (validationHints != null) {
for (Object hint : validationHints) {
if (hint instanceof Class) {
groups.add((Class) hint);
groups.add((Class<?>) hint);
}
}
}
processConstraintViolations(
this.targetValidator.validate(target, groups.toArray(new Class[groups.size()])), errors);
this.targetValidator.validate(target, groups.toArray(new Class<?>[groups.size()])), errors);
}
}