Polishing
This commit is contained in:
@@ -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");
|
* 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.
|
||||||
@@ -40,8 +40,7 @@ import org.springframework.util.NumberUtils;
|
|||||||
* @see java.math.BigDecimal
|
* @see java.math.BigDecimal
|
||||||
* @see NumberUtils
|
* @see NumberUtils
|
||||||
*/
|
*/
|
||||||
final class NumberToNumberConverterFactory implements ConverterFactory<Number, Number>,
|
final class NumberToNumberConverterFactory implements ConverterFactory<Number, Number>, ConditionalConverter {
|
||||||
ConditionalConverter {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends Number> Converter<Number, T> getConverter(Class<T> targetType) {
|
public <T extends Number> Converter<Number, T> getConverter(Class<T> targetType) {
|
||||||
@@ -53,6 +52,7 @@ final class NumberToNumberConverterFactory implements ConverterFactory<Number, N
|
|||||||
return !sourceType.equals(targetType);
|
return !sourceType.equals(targetType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private final static class NumberToNumber<T extends Number> implements Converter<Number, T> {
|
private final static class NumberToNumber<T extends Number> implements Converter<Number, T> {
|
||||||
|
|
||||||
private final Class<T> targetType;
|
private final Class<T> targetType;
|
||||||
|
|||||||
@@ -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");
|
* 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.
|
||||||
@@ -45,6 +45,7 @@ final class StringToNumberConverterFactory implements ConverterFactory<String, N
|
|||||||
return new StringToNumber<T>(targetType);
|
return new StringToNumber<T>(targetType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static final class StringToNumber<T extends Number> implements Converter<String, T> {
|
private static final class StringToNumber<T extends Number> implements Converter<String, T> {
|
||||||
|
|
||||||
private final Class<T> targetType;
|
private final Class<T> targetType;
|
||||||
|
|||||||
@@ -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");
|
* 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.
|
||||||
@@ -123,8 +123,8 @@ public abstract class AbstractResource implements Resource {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public long contentLength() throws IOException {
|
public long contentLength() throws IOException {
|
||||||
InputStream is = this.getInputStream();
|
InputStream is = getInputStream();
|
||||||
Assert.state(is != null, "resource input stream must not be null");
|
Assert.state(is != null, "Resource InputStream must not be null");
|
||||||
try {
|
try {
|
||||||
long size = 0;
|
long size = 0;
|
||||||
byte[] buf = new byte[255];
|
byte[] buf = new byte[255];
|
||||||
|
|||||||
@@ -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");
|
* 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.
|
||||||
@@ -78,12 +78,11 @@ class DefaultResourceResolverChain implements ResourceResolverChain {
|
|||||||
|
|
||||||
private ResourceResolver getNext() {
|
private ResourceResolver getNext() {
|
||||||
Assert.state(this.index <= this.resolvers.size(),
|
Assert.state(this.index <= this.resolvers.size(),
|
||||||
"Current index exceeds the number of configured ResourceResolver's");
|
"Current index exceeds the number of configured ResourceResolvers");
|
||||||
|
|
||||||
if (this.index == (this.resolvers.size() - 1)) {
|
if (this.index == (this.resolvers.size() - 1)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.index++;
|
this.index++;
|
||||||
return this.resolvers.get(this.index);
|
return this.resolvers.get(this.index);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user