Polishing (backported from master)
This commit is contained in:
@@ -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.
|
||||
@@ -85,10 +85,9 @@ public abstract class MethodIntrospector {
|
||||
|
||||
/**
|
||||
* Select methods on the given target type based on a filter.
|
||||
* <p>Callers define methods of interest through the
|
||||
* {@link ReflectionUtils.MethodFilter} parameter.
|
||||
* <p>Callers define methods of interest through the {@code MethodFilter} parameter.
|
||||
* @param targetType the target type to search methods on
|
||||
* @param methodFilter a {@link ReflectionUtils.MethodFilter} to help
|
||||
* @param methodFilter a {@code MethodFilter} to help
|
||||
* recognize handler methods of interest
|
||||
* @return the selected methods, or an empty set in case of no match
|
||||
*/
|
||||
|
||||
@@ -343,7 +343,7 @@ public class TypeDescriptor implements Serializable {
|
||||
if (streamAvailable && StreamDelegate.isStream(this.type)) {
|
||||
return StreamDelegate.getStreamElementType(this);
|
||||
}
|
||||
return getRelatedIfResolvable(this, this.resolvableType.asCollection().getGeneric());
|
||||
return getRelatedIfResolvable(this, this.resolvableType.asCollection().getGeneric(0));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -706,7 +706,7 @@ public class TypeDescriptor implements Serializable {
|
||||
}
|
||||
|
||||
public static TypeDescriptor getStreamElementType(TypeDescriptor source) {
|
||||
return getRelatedIfResolvable(source, source.resolvableType.as(Stream.class).getGeneric());
|
||||
return getRelatedIfResolvable(source, source.resolvableType.as(Stream.class).getGeneric(0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,11 +30,11 @@ import org.springframework.lang.UsesJava8;
|
||||
* Codec present, {@link #encode}/{@link #decode} calls will throw an IllegalStateException.
|
||||
* However, as of Spring 4.2, {@link #encodeToString} and {@link #decodeFromString} will
|
||||
* nevertheless work since they can delegate to the JAXB DatatypeConverter as a fallback.
|
||||
* However, this does not apply when using the ...UrlSafe... methods for RFC 4648 "URL and
|
||||
* However, this does not apply when using the "UrlSafe" methods for RFC 4648 "URL and
|
||||
* Filename Safe Alphabet"; a delegate is required.
|
||||
* <p>
|
||||
* <em>Note:</em> Apache Commons Codec does not add padding ({@code =}) when encoding with
|
||||
* the URL and Filename Safe Alphabet.
|
||||
*
|
||||
* <p><em>Note:</em> Apache Commons Codec does not add padding ({@code =}) when encoding
|
||||
* with the URL and Filename Safe Alphabet.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @author Gary Russell
|
||||
|
||||
@@ -24,13 +24,12 @@ import java.security.NoSuchAlgorithmException;
|
||||
/**
|
||||
* Miscellaneous methods for calculating digests.
|
||||
* <p>Mainly for internal use within the framework; consider
|
||||
* <a href="http://commons.apache.org/codec/">Apache Commons Codec</a> for a
|
||||
* more comprehensive suite of digest utilities.
|
||||
* <a href="http://commons.apache.org/codec/">Apache Commons Codec</a>
|
||||
* for a more comprehensive suite of digest utilities.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @author Craig Andrews
|
||||
* @since 3.0
|
||||
* @see org.apache.commons.codec.digest.DigestUtils
|
||||
*/
|
||||
public abstract class DigestUtils {
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ abstract class UpdateMessageDigestInputStream extends InputStream {
|
||||
* Update the message digest with the rest of the bytes in this stream.
|
||||
* <p>Using this method is more optimized since it avoids creating new
|
||||
* byte arrays for each call.
|
||||
* @param messageDigest The message digest to update
|
||||
* @param messageDigest the message digest to update
|
||||
* @throws IOException when propagated from {@link #read()}
|
||||
*/
|
||||
public void updateMessageDigest(MessageDigest messageDigest) throws IOException {
|
||||
@@ -47,7 +47,7 @@ abstract class UpdateMessageDigestInputStream extends InputStream {
|
||||
* Update the message digest with the next len bytes in this stream.
|
||||
* <p>Using this method is more optimized since it avoids creating new
|
||||
* byte arrays for each call.
|
||||
* @param messageDigest The message digest to update
|
||||
* @param messageDigest the message digest to update
|
||||
* @param len how many bytes to read from this stream and use to update the message digest
|
||||
* @throws IOException when propagated from {@link #read()}
|
||||
*/
|
||||
|
||||
@@ -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.
|
||||
@@ -24,7 +24,6 @@ import java.util.function.BiFunction;
|
||||
|
||||
import org.springframework.lang.UsesJava8;
|
||||
|
||||
|
||||
/**
|
||||
* Adapts a {@link CompletableFuture} into a {@link ListenableFuture}.
|
||||
*
|
||||
@@ -38,6 +37,7 @@ public class CompletableToListenableFutureAdapter<T> implements ListenableFuture
|
||||
|
||||
private final ListenableFutureCallbackRegistry<T> callbacks = new ListenableFutureCallbackRegistry<T>();
|
||||
|
||||
|
||||
public CompletableToListenableFutureAdapter(CompletableFuture<T> completableFuture) {
|
||||
this.completableFuture = completableFuture;
|
||||
this.completableFuture.handle(new BiFunction<T, Throwable, Object>() {
|
||||
@@ -54,6 +54,7 @@ public class CompletableToListenableFutureAdapter<T> implements ListenableFuture
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addCallback(ListenableFutureCallback<? super T> callback) {
|
||||
this.callbacks.addCallback(callback);
|
||||
|
||||
@@ -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.
|
||||
@@ -24,10 +24,9 @@ import java.util.concurrent.TimeoutException;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Abstract class that adapts a {@link Future} parameterized over S into a {@code
|
||||
* Future} parameterized over T. All methods are delegated to the adaptee, where {@link
|
||||
* #get()} and {@link #get(long, TimeUnit)} call {@link #adapt(Object)} on the adaptee's
|
||||
* result.
|
||||
* Abstract class that adapts a {@link Future} parameterized over S into a {@code Future}
|
||||
* parameterized over T. All methods are delegated to the adaptee, where {@link #get()}
|
||||
* and {@link #get(long, TimeUnit)} call {@link #adapt(Object)} on the adaptee's result.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 4.0
|
||||
|
||||
@@ -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.
|
||||
@@ -30,13 +30,15 @@ import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link AbstractPropertySource} implementations.
|
||||
* Unit tests for {@link PropertySource} implementations.
|
||||
*
|
||||
* @author Chris Beams
|
||||
* @since 3.1
|
||||
*/
|
||||
public class PropertySourceTests {
|
||||
@Test @SuppressWarnings("serial")
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("serial")
|
||||
public void equals() {
|
||||
Map<String, Object> map1 = new HashMap<String, Object>() {{ put("a", "b"); }};
|
||||
Map<String, Object> map2 = new HashMap<String, Object>() {{ put("c", "d"); }};
|
||||
@@ -59,14 +61,15 @@ public class PropertySourceTests {
|
||||
assertThat(new MapPropertySource("x", map1).equals(new PropertiesPropertySource("y", props2)), is(false));
|
||||
}
|
||||
|
||||
@Test @SuppressWarnings("serial")
|
||||
@Test
|
||||
@SuppressWarnings("serial")
|
||||
public void collectionsOperations() {
|
||||
Map<String, Object> map1 = new HashMap<String, Object>() {{ put("a", "b"); }};
|
||||
Map<String, Object> map2 = new HashMap<String, Object>() {{ put("c", "d"); }};
|
||||
|
||||
PropertySource<?> ps1 = new MapPropertySource("ps1", map1);
|
||||
ps1.getSource();
|
||||
List<PropertySource<?>> propertySources = new ArrayList<PropertySource<?>>();
|
||||
List<PropertySource<?>> propertySources = new ArrayList<>();
|
||||
assertThat(propertySources.add(ps1), equalTo(true));
|
||||
assertThat(propertySources.contains(ps1), is(true));
|
||||
assertThat(propertySources.contains(PropertySource.named("ps1")), is(true));
|
||||
@@ -116,4 +119,5 @@ public class PropertySourceTests {
|
||||
logger.setLevel(original);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user