Browse Source

Polishing

pull/1302/head
Juergen Hoeller 8 years ago
parent
commit
54e2d63d6f
  1. 11
      spring-context-indexer/src/main/java/org/springframework/context/index/IndexedStereotypesProvider.java
  2. 5
      spring-core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java
  3. 18
      spring-core/src/main/java/org/springframework/core/PrioritizedParameterNameDiscoverer.java
  4. 3
      spring-core/src/main/java/org/springframework/core/StandardReflectionParameterNameDiscoverer.java
  5. 6
      spring-core/src/main/java/org/springframework/core/convert/converter/ConvertingComparator.java
  6. 5
      spring-core/src/main/java/org/springframework/util/InvalidMimeTypeException.java
  7. 6
      spring-core/src/main/java/org/springframework/util/comparator/CompoundComparator.java
  8. 8
      spring-web/src/main/java/org/springframework/http/MediaType.java

11
spring-context-indexer/src/main/java/org/springframework/context/index/IndexedStereotypesProvider.java

@ -57,19 +57,16 @@ class IndexedStereotypesProvider implements StereotypesProvider { @@ -57,19 +57,16 @@ class IndexedStereotypesProvider implements StereotypesProvider {
return stereotypes;
}
private void collectStereotypesOnAnnotations(Set<Element> seen, Set<String> stereotypes,
Element element) {
private void collectStereotypesOnAnnotations(Set<Element> seen, Set<String> stereotypes, Element element) {
for (AnnotationMirror annotation : this.typeHelper.getAllAnnotationMirrors(element)) {
Element next = collectStereotypes(seen, stereotypes, element, annotation);
if (next != null) {
collectStereotypesOnAnnotations(seen, stereotypes, next);
}
}
}
private void collectStereotypesOnTypes(Set<Element> seen, Set<String> stereotypes,
Element type) {
private void collectStereotypesOnTypes(Set<Element> seen, Set<String> stereotypes, Element type) {
if (!seen.contains(type)) {
seen.add(type);
if (isAnnotatedWithIndexed(type)) {
@ -84,8 +81,8 @@ class IndexedStereotypesProvider implements StereotypesProvider { @@ -84,8 +81,8 @@ class IndexedStereotypesProvider implements StereotypesProvider {
}
}
private Element collectStereotypes(Set<Element> seen, Set<String> stereotypes,
Element element, AnnotationMirror annotation) {
private Element collectStereotypes(Set<Element> seen, Set<String> stereotypes, Element element,
AnnotationMirror annotation) {
if (isIndexedAnnotation(annotation)) {
stereotypes.add(this.typeHelper.getType(element));

5
spring-core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java

@ -1,5 +1,5 @@ @@ -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");
* you may not use this file except in compliance with the License.
@ -60,8 +60,7 @@ public class LocalVariableTableParameterNameDiscoverer implements ParameterNameD @@ -60,8 +60,7 @@ public class LocalVariableTableParameterNameDiscoverer implements ParameterNameD
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
private final Map<Class<?>, Map<Member, String[]>> parameterNamesCache =
new ConcurrentHashMap<>(32);
private final Map<Class<?>, Map<Member, String[]>> parameterNamesCache = new ConcurrentHashMap<>(32);
@Override

18
spring-core/src/main/java/org/springframework/core/PrioritizedParameterNameDiscoverer.java

@ -1,5 +1,5 @@ @@ -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");
* you may not use this file except in compliance with the License.
@ -22,12 +22,11 @@ import java.util.LinkedList; @@ -22,12 +22,11 @@ import java.util.LinkedList;
import java.util.List;
/**
* ParameterNameDiscoverer implementation that tries several ParameterNameDiscoverers
* in succession. Those added first in the {@code addDiscoverer} method have
* highest priority. If one returns {@code null}, the next will be tried.
* {@link ParameterNameDiscoverer} implementation that tries several discoverer
* delegates in succession. Those added first in the {@code addDiscoverer} method
* have highest priority. If one returns {@code null}, the next will be tried.
*
* <p>The default behavior is always to return {@code null}
* if no discoverer matches.
* <p>The default behavior is to return {@code null} if no discoverer matches.
*
* @author Rod Johnson
* @author Juergen Hoeller
@ -35,13 +34,12 @@ import java.util.List; @@ -35,13 +34,12 @@ import java.util.List;
*/
public class PrioritizedParameterNameDiscoverer implements ParameterNameDiscoverer {
private final List<ParameterNameDiscoverer> parameterNameDiscoverers =
new LinkedList<>();
private final List<ParameterNameDiscoverer> parameterNameDiscoverers = new LinkedList<>();
/**
* Add a further ParameterNameDiscoverer to the list of discoverers
* that this PrioritizedParameterNameDiscoverer checks.
* Add a further {@link ParameterNameDiscoverer} delegate to the list of
* discoverers that this {@code PrioritizedParameterNameDiscoverer} checks.
*/
public void addDiscoverer(ParameterNameDiscoverer pnd) {
this.parameterNameDiscoverers.add(pnd);

3
spring-core/src/main/java/org/springframework/core/StandardReflectionParameterNameDiscoverer.java

@ -1,5 +1,5 @@ @@ -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");
* you may not use this file except in compliance with the License.
@ -26,6 +26,7 @@ import java.lang.reflect.Parameter; @@ -26,6 +26,7 @@ import java.lang.reflect.Parameter;
*
* @author Juergen Hoeller
* @since 4.0
* @see java.lang.reflect.Method#getParameters()
* @see java.lang.reflect.Parameter#getName()
*/
public class StandardReflectionParameterNameDiscoverer implements ParameterNameDiscoverer {

6
spring-core/src/main/java/org/springframework/core/convert/converter/ConvertingComparator.java

@ -1,5 +1,5 @@ @@ -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");
* you may not use this file except in compliance with the License.
@ -35,9 +35,9 @@ import org.springframework.util.comparator.ComparableComparator; @@ -35,9 +35,9 @@ import org.springframework.util.comparator.ComparableComparator;
*/
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;
/**

5
spring-core/src/main/java/org/springframework/util/InvalidMimeTypeException.java

@ -1,5 +1,5 @@ @@ -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");
* you may not use this file except in compliance with the License.
@ -27,7 +27,7 @@ package org.springframework.util; @@ -27,7 +27,7 @@ package org.springframework.util;
@SuppressWarnings("serial")
public class InvalidMimeTypeException extends IllegalArgumentException {
private String mimeType;
private final String mimeType;
/**
@ -38,7 +38,6 @@ public class InvalidMimeTypeException extends IllegalArgumentException { @@ -38,7 +38,6 @@ public class InvalidMimeTypeException extends IllegalArgumentException {
public InvalidMimeTypeException(String mimeType, String message) {
super("Invalid mime type \"" + mimeType + "\": " + message);
this.mimeType = mimeType;
}

6
spring-core/src/main/java/org/springframework/util/comparator/CompoundComparator.java

@ -1,5 +1,5 @@ @@ -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");
* you may not use this file except in compliance with the License.
@ -37,7 +37,7 @@ import org.springframework.util.Assert; @@ -37,7 +37,7 @@ import org.springframework.util.Assert;
* @author Juergen Hoeller
* @since 1.2.2
*/
@SuppressWarnings({ "serial", "rawtypes" })
@SuppressWarnings({"serial", "rawtypes"})
public class CompoundComparator<T> implements Comparator<T>, Serializable {
private final List<InvertibleComparator> comparators;
@ -64,7 +64,7 @@ public class CompoundComparator<T> implements Comparator<T>, Serializable { @@ -64,7 +64,7 @@ public class CompoundComparator<T> implements Comparator<T>, Serializable {
Assert.notNull(comparators, "Comparators must not be null");
this.comparators = new ArrayList<>(comparators.length);
for (Comparator comparator : comparators) {
this.addComparator(comparator);
addComparator(comparator);
}
}

8
spring-web/src/main/java/org/springframework/http/MediaType.java

@ -254,27 +254,27 @@ public class MediaType extends MimeType implements Serializable { @@ -254,27 +254,27 @@ public class MediaType extends MimeType implements Serializable {
/**
* 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>
*/
public final static 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 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>
*/
public final static 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";

Loading…
Cancel
Save