Polishing
This commit is contained in:
parent
5bca18f091
commit
ad088f2157
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 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.
|
||||
|
@ -173,9 +173,8 @@ final class MergedAnnotationsCollection implements MergedAnnotations {
|
|||
if (!isMappingForType(mapping, requiredType)) {
|
||||
continue;
|
||||
}
|
||||
MergedAnnotation<A> candidate = (mappingIndex == 0
|
||||
? (MergedAnnotation<A>) root
|
||||
: TypeMappedAnnotation.createIfPossible(mapping, root, IntrospectionFailureLogger.INFO));
|
||||
MergedAnnotation<A> candidate = (mappingIndex == 0 ? (MergedAnnotation<A>) root :
|
||||
TypeMappedAnnotation.createIfPossible(mapping, root, IntrospectionFailureLogger.INFO));
|
||||
if (candidate != null && (predicate == null || predicate.test(candidate))) {
|
||||
if (selector.isBestCandidate(candidate)) {
|
||||
return candidate;
|
||||
|
|
|
@ -596,8 +596,7 @@ final class TypeMappedAnnotation<A extends Annotation> extends AbstractMergedAnn
|
|||
|
||||
private int getAttributeIndex(String attributeName, boolean required) {
|
||||
Assert.hasText(attributeName, "Attribute name must not be null");
|
||||
int attributeIndex = (isFiltered(attributeName) ? -1 :
|
||||
this.mapping.getAttributes().indexOf(attributeName));
|
||||
int attributeIndex = (isFiltered(attributeName) ? -1 : this.mapping.getAttributes().indexOf(attributeName));
|
||||
if (attributeIndex == -1 && required) {
|
||||
throw new NoSuchElementException("No attribute named '" + attributeName +
|
||||
"' present in merged annotation " + getType().getName());
|
||||
|
@ -648,6 +647,7 @@ final class TypeMappedAnnotation<A extends Annotation> extends AbstractMergedAnn
|
|||
@Nullable
|
||||
static <A extends Annotation> TypeMappedAnnotation<A> createIfPossible(
|
||||
AnnotationTypeMapping mapping, MergedAnnotation<?> annotation, IntrospectionFailureLogger logger) {
|
||||
|
||||
if (annotation instanceof TypeMappedAnnotation) {
|
||||
TypeMappedAnnotation<?> typeMappedAnnotation = (TypeMappedAnnotation<?>) annotation;
|
||||
return createIfPossible(mapping, typeMappedAnnotation.source,
|
||||
|
|
Loading…
Reference in New Issue