Polishing
This commit is contained in:
parent
69326dbf9a
commit
54e2d63d6f
|
@ -57,19 +57,16 @@ class IndexedStereotypesProvider implements StereotypesProvider {
|
||||||
return stereotypes;
|
return stereotypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void collectStereotypesOnAnnotations(Set<Element> seen, Set<String> stereotypes,
|
private void collectStereotypesOnAnnotations(Set<Element> seen, Set<String> stereotypes, Element element) {
|
||||||
Element element) {
|
|
||||||
for (AnnotationMirror annotation : this.typeHelper.getAllAnnotationMirrors(element)) {
|
for (AnnotationMirror annotation : this.typeHelper.getAllAnnotationMirrors(element)) {
|
||||||
Element next = collectStereotypes(seen, stereotypes, element, annotation);
|
Element next = collectStereotypes(seen, stereotypes, element, annotation);
|
||||||
if (next != null) {
|
if (next != null) {
|
||||||
collectStereotypesOnAnnotations(seen, stereotypes, next);
|
collectStereotypesOnAnnotations(seen, stereotypes, next);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void collectStereotypesOnTypes(Set<Element> seen, Set<String> stereotypes,
|
private void collectStereotypesOnTypes(Set<Element> seen, Set<String> stereotypes, Element type) {
|
||||||
Element type) {
|
|
||||||
if (!seen.contains(type)) {
|
if (!seen.contains(type)) {
|
||||||
seen.add(type);
|
seen.add(type);
|
||||||
if (isAnnotatedWithIndexed(type)) {
|
if (isAnnotatedWithIndexed(type)) {
|
||||||
|
@ -84,8 +81,8 @@ class IndexedStereotypesProvider implements StereotypesProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Element collectStereotypes(Set<Element> seen, Set<String> stereotypes,
|
private Element collectStereotypes(Set<Element> seen, Set<String> stereotypes, Element element,
|
||||||
Element element, AnnotationMirror annotation) {
|
AnnotationMirror annotation) {
|
||||||
|
|
||||||
if (isIndexedAnnotation(annotation)) {
|
if (isIndexedAnnotation(annotation)) {
|
||||||
stereotypes.add(this.typeHelper.getType(element));
|
stereotypes.add(this.typeHelper.getType(element));
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -60,8 +60,7 @@ public class LocalVariableTableParameterNameDiscoverer implements ParameterNameD
|
||||||
private static final Map<Member, String[]> NO_DEBUG_INFO_MAP = Collections.emptyMap();
|
private static final Map<Member, String[]> NO_DEBUG_INFO_MAP = Collections.emptyMap();
|
||||||
|
|
||||||
// the cache uses a nested index (value is a map) to keep the top level cache relatively small in size
|
// the cache uses a nested index (value is a map) to keep the top level cache relatively small in size
|
||||||
private final Map<Class<?>, Map<Member, String[]>> parameterNamesCache =
|
private final Map<Class<?>, Map<Member, String[]>> parameterNamesCache = new ConcurrentHashMap<>(32);
|
||||||
new ConcurrentHashMap<>(32);
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -22,12 +22,11 @@ import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ParameterNameDiscoverer implementation that tries several ParameterNameDiscoverers
|
* {@link ParameterNameDiscoverer} implementation that tries several discoverer
|
||||||
* in succession. Those added first in the {@code addDiscoverer} method have
|
* delegates in succession. Those added first in the {@code addDiscoverer} method
|
||||||
* highest priority. If one returns {@code null}, the next will be tried.
|
* have highest priority. If one returns {@code null}, the next will be tried.
|
||||||
*
|
*
|
||||||
* <p>The default behavior is always to return {@code null}
|
* <p>The default behavior is to return {@code null} if no discoverer matches.
|
||||||
* if no discoverer matches.
|
|
||||||
*
|
*
|
||||||
* @author Rod Johnson
|
* @author Rod Johnson
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
|
@ -35,13 +34,12 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public class PrioritizedParameterNameDiscoverer implements ParameterNameDiscoverer {
|
public class PrioritizedParameterNameDiscoverer implements ParameterNameDiscoverer {
|
||||||
|
|
||||||
private final List<ParameterNameDiscoverer> parameterNameDiscoverers =
|
private final List<ParameterNameDiscoverer> parameterNameDiscoverers = new LinkedList<>();
|
||||||
new LinkedList<>();
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a further ParameterNameDiscoverer to the list of discoverers
|
* Add a further {@link ParameterNameDiscoverer} delegate to the list of
|
||||||
* that this PrioritizedParameterNameDiscoverer checks.
|
* discoverers that this {@code PrioritizedParameterNameDiscoverer} checks.
|
||||||
*/
|
*/
|
||||||
public void addDiscoverer(ParameterNameDiscoverer pnd) {
|
public void addDiscoverer(ParameterNameDiscoverer pnd) {
|
||||||
this.parameterNameDiscoverers.add(pnd);
|
this.parameterNameDiscoverers.add(pnd);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -26,6 +26,7 @@ import java.lang.reflect.Parameter;
|
||||||
*
|
*
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
|
* @see java.lang.reflect.Method#getParameters()
|
||||||
* @see java.lang.reflect.Parameter#getName()
|
* @see java.lang.reflect.Parameter#getName()
|
||||||
*/
|
*/
|
||||||
public class StandardReflectionParameterNameDiscoverer implements ParameterNameDiscoverer {
|
public class StandardReflectionParameterNameDiscoverer implements ParameterNameDiscoverer {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -35,9 +35,9 @@ import org.springframework.util.comparator.ComparableComparator;
|
||||||
*/
|
*/
|
||||||
public class ConvertingComparator<S, T> implements Comparator<S> {
|
public class ConvertingComparator<S, T> implements Comparator<S> {
|
||||||
|
|
||||||
private Comparator<T> comparator;
|
private final Comparator<T> comparator;
|
||||||
|
|
||||||
private Converter<S, T> converter;
|
private final Converter<S, T> converter;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -27,7 +27,7 @@ package org.springframework.util;
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class InvalidMimeTypeException extends IllegalArgumentException {
|
public class InvalidMimeTypeException extends IllegalArgumentException {
|
||||||
|
|
||||||
private String mimeType;
|
private final String mimeType;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,7 +38,6 @@ public class InvalidMimeTypeException extends IllegalArgumentException {
|
||||||
public InvalidMimeTypeException(String mimeType, String message) {
|
public InvalidMimeTypeException(String mimeType, String message) {
|
||||||
super("Invalid mime type \"" + mimeType + "\": " + message);
|
super("Invalid mime type \"" + mimeType + "\": " + message);
|
||||||
this.mimeType = mimeType;
|
this.mimeType = mimeType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -37,7 +37,7 @@ import org.springframework.util.Assert;
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
* @since 1.2.2
|
* @since 1.2.2
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "serial", "rawtypes" })
|
@SuppressWarnings({"serial", "rawtypes"})
|
||||||
public class CompoundComparator<T> implements Comparator<T>, Serializable {
|
public class CompoundComparator<T> implements Comparator<T>, Serializable {
|
||||||
|
|
||||||
private final List<InvertibleComparator> comparators;
|
private final List<InvertibleComparator> comparators;
|
||||||
|
@ -64,7 +64,7 @@ public class CompoundComparator<T> implements Comparator<T>, Serializable {
|
||||||
Assert.notNull(comparators, "Comparators must not be null");
|
Assert.notNull(comparators, "Comparators must not be null");
|
||||||
this.comparators = new ArrayList<>(comparators.length);
|
this.comparators = new ArrayList<>(comparators.length);
|
||||||
for (Comparator comparator : comparators) {
|
for (Comparator comparator : comparators) {
|
||||||
this.addComparator(comparator);
|
addComparator(comparator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -254,27 +254,27 @@ public class MediaType extends MimeType implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Public constant media type for {@code application/problem+json}.
|
* Public constant media type for {@code application/problem+json}.
|
||||||
* @since 5.0.0
|
* @since 5.0
|
||||||
* @see <a href="https://tools.ietf.org/html/rfc7807#section-6.1">Problem Details for HTTP APIs, 6.1. application/problem+json</a>
|
* @see <a href="https://tools.ietf.org/html/rfc7807#section-6.1">Problem Details for HTTP APIs, 6.1. application/problem+json</a>
|
||||||
*/
|
*/
|
||||||
public final static MediaType APPLICATION_PROBLEM_JSON;
|
public final static MediaType APPLICATION_PROBLEM_JSON;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A String equivalent of {@link MediaType#APPLICATION_PROBLEM_JSON}.
|
* A String equivalent of {@link MediaType#APPLICATION_PROBLEM_JSON}.
|
||||||
* @since 5.0.0
|
* @since 5.0
|
||||||
*/
|
*/
|
||||||
public final static String APPLICATION_PROBLEM_JSON_VALUE = "application/problem+json";
|
public final static String APPLICATION_PROBLEM_JSON_VALUE = "application/problem+json";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Public constant media type for {@code application/problem+xml}.
|
* Public constant media type for {@code application/problem+xml}.
|
||||||
* @since 5.0.0
|
* @since 5.0
|
||||||
* @see <a href="https://tools.ietf.org/html/rfc7807#section-6.2">Problem Details for HTTP APIs, 6.2. application/problem+xml</a>
|
* @see <a href="https://tools.ietf.org/html/rfc7807#section-6.2">Problem Details for HTTP APIs, 6.2. application/problem+xml</a>
|
||||||
*/
|
*/
|
||||||
public final static MediaType APPLICATION_PROBLEM_XML;
|
public final static MediaType APPLICATION_PROBLEM_XML;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A String equivalent of {@link MediaType#APPLICATION_PROBLEM_XML}.
|
* A String equivalent of {@link MediaType#APPLICATION_PROBLEM_XML}.
|
||||||
* @since 5.0.0
|
* @since 5.0
|
||||||
*/
|
*/
|
||||||
public final static String APPLICATION_PROBLEM_XML_VALUE = "application/problem+xml";
|
public final static String APPLICATION_PROBLEM_XML_VALUE = "application/problem+xml";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue