General polish of new 4.0 classes
Apply consistent styling to new classes introduced in Spring 4.0. - Javadoc line wrapping, whitespace and formatting - General code whitespace - Consistent Assert.notNull messages
This commit is contained in:
@@ -21,8 +21,8 @@ import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Parameter;
|
||||
|
||||
/**
|
||||
* {@link ParameterNameDiscoverer} implementation which uses JDK 8's
|
||||
* reflection facilities for introspecting parameter names.
|
||||
* {@link ParameterNameDiscoverer} implementation which uses JDK 8's reflection facilities
|
||||
* for introspecting parameter names.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 4.0
|
||||
|
||||
@@ -27,7 +27,8 @@ import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
/**
|
||||
* Utility class used to collect all annotation values including those declared on meta-annotations.
|
||||
* Utility class used to collect all annotation values including those declared on
|
||||
* meta-annotations.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Juergen Hoeller
|
||||
|
||||
@@ -22,9 +22,9 @@ import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* A variation of {@link UUID#randomUUID()} that uses {@link SecureRandom} only for
|
||||
* the initial seed and {@link Random} thereafter. This provides better performance
|
||||
* in exchange for less securely random id's.
|
||||
* A variation of {@link UUID#randomUUID()} that uses {@link SecureRandom} only for the
|
||||
* initial seed and {@link Random} thereafter. This provides better performance in
|
||||
* exchange for less securely random id's.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @author Rob Winch
|
||||
|
||||
@@ -171,7 +171,8 @@ public class MimeType implements Comparable<MimeType>, Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the given token string for illegal characters, as defined in RFC 2616, section 2.2.
|
||||
* Checks the given token string for illegal characters, as defined in RFC 2616,
|
||||
* section 2.2.
|
||||
* @throws IllegalArgumentException in case of illegal characters
|
||||
* @see <a href="http://tools.ietf.org/html/rfc2616#section-2.2">HTTP 1.1, section 2.2</a>
|
||||
*/
|
||||
@@ -214,15 +215,17 @@ public class MimeType implements Comparable<MimeType>, Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the {@linkplain #getType() type} is the wildcard character {@code *} or not.
|
||||
* Indicates whether the {@linkplain #getType() type} is the wildcard character
|
||||
* {@code *} or not.
|
||||
*/
|
||||
public boolean isWildcardType() {
|
||||
return WILDCARD_TYPE.equals(getType());
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the {@linkplain #getSubtype() subtype} is the wildcard character {@code *}
|
||||
* or the wildcard character followed by a sufiix (e.g. {@code *+xml}), or not.
|
||||
* Indicates whether the {@linkplain #getSubtype() subtype} is the wildcard character
|
||||
* {@code *} or the wildcard character followed by a sufiix (e.g.
|
||||
* {@code *+xml}), or not.
|
||||
* @return whether the subtype is {@code *}
|
||||
*/
|
||||
public boolean isWildcardSubtype() {
|
||||
@@ -230,8 +233,8 @@ public class MimeType implements Comparable<MimeType>, Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether this media type is concrete, i.e. whether neither the type or subtype is a wildcard
|
||||
* character {@code *}.
|
||||
* Indicates whether this media type is concrete, i.e. whether neither the type or
|
||||
* subtype is a wildcard character {@code *}.
|
||||
* @return whether this media type is concrete
|
||||
*/
|
||||
public boolean isConcrete() {
|
||||
@@ -280,10 +283,12 @@ public class MimeType implements Comparable<MimeType>, Serializable {
|
||||
|
||||
/**
|
||||
* Indicate whether this {@code MediaType} includes the given media type.
|
||||
* <p>For instance, {@code text/*} includes {@code text/plain} and {@code text/html}, and {@code application/*+xml}
|
||||
* includes {@code application/soap+xml}, etc. This method is <b>not</b> symmetric.
|
||||
* <p>For instance, {@code text/*} includes {@code text/plain} and {@code text/html},
|
||||
* and {@code application/*+xml} includes {@code application/soap+xml}, etc. This
|
||||
* method is <b>not</b> symmetric.
|
||||
* @param other the reference media type with which to compare
|
||||
* @return {@code true} if this media type includes the given media type; {@code false} otherwise
|
||||
* @return {@code true} if this media type includes the given media type;
|
||||
* {@code false} otherwise
|
||||
*/
|
||||
public boolean includes(MimeType other) {
|
||||
if (other == null) {
|
||||
|
||||
@@ -29,6 +29,7 @@ import java.util.Map;
|
||||
import org.springframework.util.MimeType.SpecificityComparator;
|
||||
|
||||
/**
|
||||
* Miscellaneous {@link MimeType} utility methods.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @author Rossen Stoyanchev
|
||||
@@ -289,8 +290,7 @@ public abstract class MimeTypeUtils {
|
||||
|
||||
/**
|
||||
* Sorts the given list of {@code MimeType} objects by specificity.
|
||||
* <p>
|
||||
* Given two mime types:
|
||||
* <p>Given two mime types:
|
||||
* <ol>
|
||||
* <li>if either mime type has a {@linkplain MimeType#isWildcardType() wildcard type},
|
||||
* then the mime type without the wildcard is ordered before the other.</li>
|
||||
@@ -304,12 +304,10 @@ public abstract class MimeTypeUtils {
|
||||
* {@linkplain MimeType#getParameter(String) parameters}, then the mime type with the most
|
||||
* parameters is ordered before the other.</li>
|
||||
* </ol>
|
||||
* <p>
|
||||
* For example: <blockquote>audio/basic < audio/* < */*</blockquote>
|
||||
* <p>For example: <blockquote>audio/basic < audio/* < */*</blockquote>
|
||||
* <blockquote>audio/basic;level=1 < audio/basic</blockquote>
|
||||
* <blockquote>audio/basic == text/html</blockquote> <blockquote>audio/basic ==
|
||||
* audio/wave</blockquote>
|
||||
*
|
||||
* @param mimeTypes the list of mime types to be sorted
|
||||
* @see <a href="http://tools.ietf.org/html/rfc2616#section-14.1">HTTP 1.1, section
|
||||
* 14.1</a>
|
||||
|
||||
@@ -29,7 +29,7 @@ import javax.net.ServerSocketFactory;
|
||||
* for finding available ports on {@code localhost}.
|
||||
*
|
||||
* <p>Within this class, a TCP port refers to a port for a {@link ServerSocket};
|
||||
* whereas, a UDP port refers to a port for a {@link DatagramSocket}.
|
||||
* whereas, a UDP port refers to a port for a {@link DatagramSocket}.
|
||||
*
|
||||
* @author Sam Brannen
|
||||
* @author Ben Hale
|
||||
@@ -37,7 +37,7 @@ import javax.net.ServerSocketFactory;
|
||||
* @author Gunnar Hillert
|
||||
* @since 4.0
|
||||
*/
|
||||
public final class SocketUtils {
|
||||
public abstract class SocketUtils {
|
||||
|
||||
/**
|
||||
* The default minimum value for port ranges used when finding an available
|
||||
@@ -51,13 +51,14 @@ public final class SocketUtils {
|
||||
*/
|
||||
public static final int PORT_RANGE_MAX = 65535;
|
||||
|
||||
|
||||
private static final Random random = new Random(System.currentTimeMillis());
|
||||
|
||||
|
||||
/**
|
||||
* Although {@code SocketUtils} consists solely of static utility methods,
|
||||
* this constructor is intentionally {@code public}.
|
||||
*
|
||||
*
|
||||
* <h4>Rationale</h4>
|
||||
*
|
||||
* <p>Static methods from this class may be invoked from within XML
|
||||
@@ -81,10 +82,10 @@ public final class SocketUtils {
|
||||
/* no-op */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Find an available TCP port randomly selected from the range
|
||||
* [{@value #PORT_RANGE_MIN}, {@value #PORT_RANGE_MAX}].
|
||||
*
|
||||
* @return an available TCP port number
|
||||
* @throws IllegalStateException if no available port could be found
|
||||
*/
|
||||
@@ -95,7 +96,6 @@ public final class SocketUtils {
|
||||
/**
|
||||
* Find an available TCP port randomly selected from the range
|
||||
* [{@code minPort}, {@value #PORT_RANGE_MAX}].
|
||||
*
|
||||
* @param minPort the minimum port number
|
||||
* @return an available TCP port number
|
||||
* @throws IllegalStateException if no available port could be found
|
||||
@@ -107,7 +107,6 @@ public final class SocketUtils {
|
||||
/**
|
||||
* Find an available TCP port randomly selected from the range
|
||||
* [{@code minPort}, {@code maxPort}].
|
||||
*
|
||||
* @param minPort the minimum port number
|
||||
* @param maxPort the maximum port number
|
||||
* @return an available TCP port number
|
||||
@@ -120,7 +119,6 @@ public final class SocketUtils {
|
||||
/**
|
||||
* Find the requested number of available TCP ports, each randomly selected
|
||||
* from the range [{@value #PORT_RANGE_MIN}, {@value #PORT_RANGE_MAX}].
|
||||
*
|
||||
* @param numRequested the number of available ports to find
|
||||
* @return a sorted set of available TCP port numbers
|
||||
* @throws IllegalStateException if the requested number of available ports could not be found
|
||||
@@ -132,7 +130,6 @@ public final class SocketUtils {
|
||||
/**
|
||||
* Find the requested number of available TCP ports, each randomly selected
|
||||
* from the range [{@code minPort}, {@code maxPort}].
|
||||
*
|
||||
* @param numRequested the number of available ports to find
|
||||
* @param minPort the minimum port number
|
||||
* @param maxPort the maximum port number
|
||||
@@ -146,7 +143,6 @@ public final class SocketUtils {
|
||||
/**
|
||||
* Find an available UDP port randomly selected from the range
|
||||
* [{@value #PORT_RANGE_MIN}, {@value #PORT_RANGE_MAX}].
|
||||
*
|
||||
* @return an available UDP port number
|
||||
* @throws IllegalStateException if no available port could be found
|
||||
*/
|
||||
@@ -157,7 +153,6 @@ public final class SocketUtils {
|
||||
/**
|
||||
* Find an available UDP port randomly selected from the range
|
||||
* [{@code minPort}, {@value #PORT_RANGE_MAX}].
|
||||
*
|
||||
* @param minPort the minimum port number
|
||||
* @return an available UDP port number
|
||||
* @throws IllegalStateException if no available port could be found
|
||||
@@ -169,7 +164,6 @@ public final class SocketUtils {
|
||||
/**
|
||||
* Find an available UDP port randomly selected from the range
|
||||
* [{@code minPort}, {@code maxPort}].
|
||||
*
|
||||
* @param minPort the minimum port number
|
||||
* @param maxPort the maximum port number
|
||||
* @return an available UDP port number
|
||||
@@ -182,7 +176,6 @@ public final class SocketUtils {
|
||||
/**
|
||||
* Find the requested number of available UDP ports, each randomly selected
|
||||
* from the range [{@value #PORT_RANGE_MIN}, {@value #PORT_RANGE_MAX}].
|
||||
*
|
||||
* @param numRequested the number of available ports to find
|
||||
* @return a sorted set of available UDP port numbers
|
||||
* @throws IllegalStateException if the requested number of available ports could not be found
|
||||
@@ -194,7 +187,6 @@ public final class SocketUtils {
|
||||
/**
|
||||
* Find the requested number of available UDP ports, each randomly selected
|
||||
* from the range [{@code minPort}, {@code maxPort}].
|
||||
*
|
||||
* @param numRequested the number of available ports to find
|
||||
* @param minPort the minimum port number
|
||||
* @param maxPort the maximum port number
|
||||
@@ -247,7 +239,6 @@ public final class SocketUtils {
|
||||
/**
|
||||
* Find a pseudo-random port number within the range
|
||||
* [{@code minPort}, {@code maxPort}].
|
||||
*
|
||||
* @param minPort the minimum port number
|
||||
* @param maxPort the maximum port number
|
||||
* @return a random port number within the specified range
|
||||
@@ -260,7 +251,6 @@ public final class SocketUtils {
|
||||
/**
|
||||
* Find an available port for this {@code SocketType}, randomly selected
|
||||
* from the range [{@code minPort}, {@code maxPort}].
|
||||
*
|
||||
* @param minPort the minimum port number
|
||||
* @param maxPort the maximum port number
|
||||
* @return an available port number for this socket type
|
||||
@@ -289,7 +279,6 @@ public final class SocketUtils {
|
||||
/**
|
||||
* Find the requested number of available ports for this {@code SocketType},
|
||||
* each randomly selected from the range [{@code minPort}, {@code maxPort}].
|
||||
*
|
||||
* @param numRequested the number of available ports to find
|
||||
* @param minPort the minimum port number
|
||||
* @param maxPort the maximum port number
|
||||
|
||||
@@ -33,8 +33,8 @@ public class ListenableFutureTask<T> extends FutureTask<T>
|
||||
new ListenableFutureCallbackRegistry<T>();
|
||||
|
||||
/**
|
||||
* Creates a new {@code ListenableFutureTask} that will, upon running, execute the given
|
||||
* {@link Callable}.
|
||||
* Creates a new {@code ListenableFutureTask} that will, upon running, execute the
|
||||
* given {@link Callable}.
|
||||
* @param callable the callable task
|
||||
*/
|
||||
public ListenableFutureTask(Callable<T> callable) {
|
||||
|
||||
Reference in New Issue
Block a user