Browse Source

Polishing

pull/947/merge
Juergen Hoeller 10 years ago
parent
commit
773d175681
  1. 6
      spring-beans/src/main/java/org/springframework/beans/factory/UnsatisfiedDependencyException.java
  2. 6
      spring-beans/src/main/java/org/springframework/beans/factory/config/DependencyDescriptor.java
  3. 4
      spring-context-support/src/main/java/org/springframework/cache/caffeine/CaffeineCache.java
  4. 6
      spring-context/src/main/java/org/springframework/cache/Cache.java
  5. 9
      spring-web/src/main/java/org/springframework/http/converter/xml/MarshallingHttpMessageConverter.java
  6. 3
      spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java
  7. 3
      spring-webmvc/src/main/java/org/springframework/web/servlet/resource/VersionResourceResolver.java
  8. 5
      spring-webmvc/src/main/java/org/springframework/web/servlet/resource/VersionedResource.java

6
spring-beans/src/main/java/org/springframework/beans/factory/UnsatisfiedDependencyException.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2016 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.
@ -56,7 +56,7 @@ public class UnsatisfiedDependencyException extends BeanCreationException { @@ -56,7 +56,7 @@ public class UnsatisfiedDependencyException extends BeanCreationException {
public UnsatisfiedDependencyException(
String resourceDescription, String beanName, String propertyName, BeansException ex) {
this(resourceDescription, beanName, propertyName, (ex != null ? ": " + ex.getMessage() : ""));
this(resourceDescription, beanName, propertyName, (ex != null ? ex.getMessage() : ""));
initCause(ex);
}
@ -88,7 +88,7 @@ public class UnsatisfiedDependencyException extends BeanCreationException { @@ -88,7 +88,7 @@ public class UnsatisfiedDependencyException extends BeanCreationException {
public UnsatisfiedDependencyException(
String resourceDescription, String beanName, int ctorArgIndex, Class<?> ctorArgType, BeansException ex) {
this(resourceDescription, beanName, ctorArgIndex, ctorArgType, (ex != null ? ": " + ex.getMessage() : ""));
this(resourceDescription, beanName, ctorArgIndex, ctorArgType, (ex != null ? ex.getMessage() : ""));
initCause(ex);
}

6
spring-beans/src/main/java/org/springframework/beans/factory/config/DependencyDescriptor.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 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.
@ -196,6 +196,7 @@ public class DependencyDescriptor implements Serializable { @@ -196,6 +196,7 @@ public class DependencyDescriptor implements Serializable {
* Optionally set the concrete class that contains this dependency.
* This may differ from the class that declares the parameter/field in that
* it may be a subclass thereof, potentially substituting type variables.
* @since 4.0
*/
public void setContainingClass(Class<?> containingClass) {
this.containingClass = containingClass;
@ -206,6 +207,7 @@ public class DependencyDescriptor implements Serializable { @@ -206,6 +207,7 @@ public class DependencyDescriptor implements Serializable {
/**
* Build a ResolvableType object for the wrapped parameter/field.
* @since 4.0
*/
public ResolvableType getResolvableType() {
return (this.field != null ? ResolvableType.forField(this.field, this.nestingLevel, this.containingClass) :
@ -217,6 +219,7 @@ public class DependencyDescriptor implements Serializable { @@ -217,6 +219,7 @@ public class DependencyDescriptor implements Serializable {
* <p>This is {@code false} by default but may be overridden to return {@code true} in order
* to suggest to a {@link org.springframework.beans.factory.support.AutowireCandidateResolver}
* that a fallback match is acceptable as well.
* @since 4.0
*/
public boolean fallbackMatchAllowed() {
return false;
@ -224,6 +227,7 @@ public class DependencyDescriptor implements Serializable { @@ -224,6 +227,7 @@ public class DependencyDescriptor implements Serializable {
/**
* Return a variant of this descriptor that is intended for a fallback match.
* @since 4.0
* @see #fallbackMatchAllowed()
*/
public DependencyDescriptor forFallbackMatch() {

4
spring-context-support/src/main/java/org/springframework/cache/caffeine/CaffeineCache.java vendored

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 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.
@ -64,6 +64,7 @@ public class CaffeineCache extends AbstractValueAdaptingCache { @@ -64,6 +64,7 @@ public class CaffeineCache extends AbstractValueAdaptingCache {
*/
public CaffeineCache(String name, com.github.benmanes.caffeine.cache.Cache<Object, Object> cache,
boolean allowNullValues) {
super(allowNullValues);
Assert.notNull(name, "Name must not be null");
Assert.notNull(cache, "Cache must not be null");
@ -142,6 +143,7 @@ public class CaffeineCache extends AbstractValueAdaptingCache { @@ -142,6 +143,7 @@ public class CaffeineCache extends AbstractValueAdaptingCache {
}
}
private class LoadFunction implements Function<Object, Object> {
private final Callable<?> valueLoader;

6
spring-context/src/main/java/org/springframework/cache/Cache.java vendored

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 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.
@ -164,15 +164,13 @@ public interface Cache { @@ -164,15 +164,13 @@ public interface Cache {
private final Object key;
public ValueRetrievalException(Object key, Callable<?> loader, Throwable ex) {
super(String.format("Value for key '%s' could not " +
"be loaded using '%s'", key, loader), ex);
super(String.format("Value for key '%s' could not " + "be loaded using '%s'", key, loader), ex);
this.key = key;
}
public Object getKey() {
return this.key;
}
}
}

9
spring-web/src/main/java/org/springframework/http/converter/xml/MarshallingHttpMessageConverter.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2016 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.
@ -55,7 +55,7 @@ public class MarshallingHttpMessageConverter extends AbstractXmlHttpMessageConve @@ -55,7 +55,7 @@ public class MarshallingHttpMessageConverter extends AbstractXmlHttpMessageConve
/**
* Construct a new {@code MarshallingHttpMessageConverter} with no {@link Marshaller} or
* {@link Unmarshaller} set. The Marshaller and Unmarshaller must be set after construction
* by invoking {@link #setMarshaller(Marshaller)} and {@link #setUnmarshaller(Unmarshaller)} .
* by invoking {@link #setMarshaller(Marshaller)} and {@link #setUnmarshaller(Unmarshaller)}.
*/
public MarshallingHttpMessageConverter() {
}
@ -104,14 +104,15 @@ public class MarshallingHttpMessageConverter extends AbstractXmlHttpMessageConve @@ -104,14 +104,15 @@ public class MarshallingHttpMessageConverter extends AbstractXmlHttpMessageConve
this.unmarshaller = unmarshaller;
}
@Override
public boolean canRead(Class<?> clazz, MediaType mediaType) {
return canRead(mediaType) && (this.unmarshaller != null) && this.unmarshaller.supports(clazz);
return (canRead(mediaType) && this.unmarshaller != null && this.unmarshaller.supports(clazz));
}
@Override
public boolean canWrite(Class<?> clazz, MediaType mediaType) {
return canWrite(mediaType) && (this.marshaller != null) && this.marshaller.supports(clazz);
return (canWrite(mediaType) && this.marshaller != null && this.marshaller.supports(clazz));
}
@Override

3
spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 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.
@ -516,7 +516,6 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap @@ -516,7 +516,6 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
this.readWriteLock.readLock().unlock();
}
public void register(T mapping, Object handler, Method method) {
this.readWriteLock.writeLock().lock();
try {

3
spring-webmvc/src/main/java/org/springframework/web/servlet/resource/VersionResourceResolver.java

@ -27,7 +27,6 @@ import java.util.Comparator; @@ -27,7 +27,6 @@ import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.core.io.AbstractResource;
@ -225,6 +224,7 @@ public class VersionResourceResolver extends AbstractResourceResolver { @@ -225,6 +224,7 @@ public class VersionResourceResolver extends AbstractResourceResolver {
return null;
}
private class FileNameVersionedResource extends AbstractResource implements VersionedResource {
private final Resource original;
@ -300,7 +300,6 @@ public class VersionResourceResolver extends AbstractResourceResolver { @@ -300,7 +300,6 @@ public class VersionResourceResolver extends AbstractResourceResolver {
public String getVersion() {
return this.version;
}
}
}

5
spring-webmvc/src/main/java/org/springframework/web/servlet/resource/VersionedResource.java

@ -19,8 +19,8 @@ package org.springframework.web.servlet.resource; @@ -19,8 +19,8 @@ package org.springframework.web.servlet.resource;
import org.springframework.core.io.Resource;
/**
* Interface for a resource descriptor that describes its version
* with a version string that can be derived from its content and/or metadata.
* Interface for a resource descriptor that describes its version with a
* version string that can be derived from its content and/or metadata.
*
* @author Brian Clozel
* @since 4.2.5
@ -29,4 +29,5 @@ import org.springframework.core.io.Resource; @@ -29,4 +29,5 @@ import org.springframework.core.io.Resource;
public interface VersionedResource extends Resource {
String getVersion();
}

Loading…
Cancel
Save