diff --git a/spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java b/spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java index 228f9047f29c04f51802ddc64d938b41fd09371f..25019c010f1cecdd8c8219c635f650c95ec568bd 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java @@ -309,9 +309,9 @@ public abstract class AnnotationUtils { * compiler if the supplied element is a {@link Method}. *
Meta-annotations will be searched if the annotation is not * present on the supplied element. - * @param annotatedElement the element to look for annotations on; never {@code null} - * @param annotationType the annotation type to look for; never {@code null} - * @return the annotations found or an empty set; never {@code null} + * @param annotatedElement the element to look for annotations on + * @param annotationType the annotation type to look for + * @return the annotations found or an empty set (never {@code null}) * @since 4.2 * @see #getRepeatableAnnotations(AnnotatedElement, Class, Class) * @see #getDeclaredRepeatableAnnotations(AnnotatedElement, Class, Class) @@ -339,13 +339,13 @@ public abstract class AnnotationUtils { * compiler if the supplied element is a {@link Method}. *
Meta-annotations will be searched if the annotation is not * present on the supplied element. - * @param annotatedElement the element to look for annotations on; never {@code null} - * @param annotationType the annotation type to look for; never {@code null} + * @param annotatedElement the element to look for annotations on + * @param annotationType the annotation type to look for * @param containerAnnotationType the type of the container that holds * the annotations; may be {@code null} if a container is not supported * or if it should be looked up via @{@link java.lang.annotation.Repeatable} * when running on Java 8 or higher - * @return the annotations found or an empty set; never {@code null} + * @return the annotations found or an empty set (never {@code null}) * @since 4.2 * @see #getRepeatableAnnotations(AnnotatedElement, Class) * @see #getDeclaredRepeatableAnnotations(AnnotatedElement, Class) @@ -388,9 +388,9 @@ public abstract class AnnotationUtils { * compiler if the supplied element is a {@link Method}. *
Meta-annotations will be searched if the annotation is not * present on the supplied element. - * @param annotatedElement the element to look for annotations on; never {@code null} - * @param annotationType the annotation type to look for; never {@code null} - * @return the annotations found or an empty set; never {@code null} + * @param annotatedElement the element to look for annotations on + * @param annotationType the annotation type to look for + * @return the annotations found or an empty set (never {@code null}) * @since 4.2 * @see #getRepeatableAnnotations(AnnotatedElement, Class) * @see #getRepeatableAnnotations(AnnotatedElement, Class, Class) @@ -419,13 +419,13 @@ public abstract class AnnotationUtils { * compiler if the supplied element is a {@link Method}. *
Meta-annotations will be searched if the annotation is not * present on the supplied element. - * @param annotatedElement the element to look for annotations on; never {@code null} - * @param annotationType the annotation type to look for; never {@code null} + * @param annotatedElement the element to look for annotations on + * @param annotationType the annotation type to look for * @param containerAnnotationType the type of the container that holds * the annotations; may be {@code null} if a container is not supported * or if it should be looked up via @{@link java.lang.annotation.Repeatable} * when running on Java 8 or higher - * @return the annotations found or an empty set; never {@code null} + * @return the annotations found or an empty set (never {@code null}) * @since 4.2 * @see #getRepeatableAnnotations(AnnotatedElement, Class) * @see #getRepeatableAnnotations(AnnotatedElement, Class, Class) @@ -447,15 +447,15 @@ public abstract class AnnotationUtils { * compiler if the supplied element is a {@link Method}. *
Meta-annotations will be searched if the annotation is not
* present on the supplied element.
- * @param annotatedElement the element to look for annotations on; never {@code null}
- * @param annotationType the annotation type to look for; never {@code null}
+ * @param annotatedElement the element to look for annotations on
+ * @param annotationType the annotation type to look for
* @param containerAnnotationType the type of the container that holds
* the annotations; may be {@code null} if a container is not supported
* or if it should be looked up via @{@link java.lang.annotation.Repeatable}
* when running on Java 8 or higher
* @param declaredMode {@code true} if only declared annotations (i.e.,
* directly or indirectly present) should be considered
- * @return the annotations found or an empty set; never {@code null}
+ * @return the annotations found or an empty set (never {@code null})
* @since 4.2
* @see org.springframework.core.BridgeMethodResolver#findBridgedMethod
* @see java.lang.annotation.Repeatable
@@ -497,8 +497,8 @@ public abstract class AnnotationUtils {
public static A findAnnotation(AnnotatedElement annotatedElement, Class annotationType) {
// Do NOT store result in the findAnnotationCache since doing so could break
// findAnnotation(Class, Class) and findAnnotation(Method, Class).
- return synthesizeAnnotation(findAnnotation(annotatedElement, annotationType, new HashSet An empty return value implies that the annotation does not declare
* any attribute aliases.
* @param annotationType the annotation type to find attribute aliases in
- * @return a map containing attribute aliases; never {@code null}
+ * @return a map containing attribute aliases (never {@code null})
* @since 4.2
*/
static Map Callers define handler methods of interest through the {@link MethodFilter} parameter.
* @param handlerType the handler type to search handler methods on
* @param handlerMethodFilter a {@link MethodFilter} to help recognize handler methods of interest
* @return the selected methods, or an empty set
diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/InvocableHandlerMethod.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/InvocableHandlerMethod.java
index 2f4aaab5b74e8caf50a51282fb9f15fcb3818a10..2c29f2922d959091dfe49ef1b6074026209de38a 100644
--- a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/InvocableHandlerMethod.java
+++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/InvocableHandlerMethod.java
@@ -31,8 +31,8 @@ import org.springframework.messaging.handler.HandlerMethod;
import org.springframework.util.ReflectionUtils;
/**
- * Invokes the handler method for a given message after resolving its method argument
- * values through registered {@link HandlerMethodArgumentResolver}s.
+ * Provides a method for invoking the handler method for a given message after resolving its
+ * method argument values through registered {@link HandlerMethodArgumentResolver}s.
*
* Use {@link #setMessageMethodArgumentResolvers(HandlerMethodArgumentResolver)}
* to customize the list of argument resolvers.
@@ -94,18 +94,28 @@ public class InvocableHandlerMethod extends HandlerMethod {
/**
- * Invoke the method with the given message.
- * @throws Exception raised if no suitable argument resolver can be found,
- * or the method raised an exception
+ * Invoke the method after resolving its argument values in the context of the given message.
+ * Argument values are commonly resolved through {@link HandlerMethodArgumentResolver}s.
+ * The {@code providedArgs} parameter however may supply argument values to be used directly,
+ * i.e. without argument resolution.
+ * @param message the current message being processed
+ * @param providedArgs "given" arguments matched by type, not resolved
+ * @return the raw value returned by the invoked method
+ * @exception Exception raised if no suitable argument resolver can be found,
+ * or if the method raised an exception
*/
public Object invoke(Message> message, Object... providedArgs) throws Exception {
Object[] args = getMethodArgumentValues(message, providedArgs);
if (logger.isTraceEnabled()) {
- logger.trace("Resolved arguments: " + Arrays.asList(args));
+ StringBuilder sb = new StringBuilder("Invoking [");
+ sb.append(getBeanType().getSimpleName()).append(".");
+ sb.append(getMethod().getName()).append("] method with arguments ");
+ sb.append(Arrays.asList(args));
+ logger.trace(sb.toString());
}
Object returnValue = doInvoke(args);
if (logger.isTraceEnabled()) {
- logger.trace("Returned value: " + returnValue);
+ logger.trace("Method [" + getMethod().getName() + "] returned [" + returnValue + "]");
}
return returnValue;
}
@@ -137,8 +147,8 @@ public class InvocableHandlerMethod extends HandlerMethod {
}
}
if (args[i] == null) {
- String error = getArgumentResolutionErrorMessage("No suitable resolver for argument", i);
- throw new IllegalStateException(error);
+ String msg = getArgumentResolutionErrorMessage("No suitable resolver for argument", i);
+ throw new IllegalStateException(msg);
}
}
return args;
@@ -156,10 +166,11 @@ public class InvocableHandlerMethod extends HandlerMethod {
* @param message error message to append the HandlerMethod details to
*/
protected String getDetailedErrorMessage(String message) {
- return message + "\n" +
- "HandlerMethod details: \n" +
- "Controller [" + getBeanType().getName() + "]\n" +
- "Method [" + getBridgedMethod().toGenericString() + "]\n";
+ StringBuilder sb = new StringBuilder(message).append("\n");
+ sb.append("HandlerMethod details: \n");
+ sb.append("Controller [").append(getBeanType().getName()).append("]\n");
+ sb.append("Method [").append(getBridgedMethod().toGenericString()).append("]\n");
+ return sb.toString();
}
/**
diff --git a/spring-web/src/main/java/org/springframework/web/method/support/InvocableHandlerMethod.java b/spring-web/src/main/java/org/springframework/web/method/support/InvocableHandlerMethod.java
index 65b91ae543ae57528b8f8198496255f5c216cbf3..d61432459e4bc7b5df9bcef829dc9d815b200921 100644
--- a/spring-web/src/main/java/org/springframework/web/method/support/InvocableHandlerMethod.java
+++ b/spring-web/src/main/java/org/springframework/web/method/support/InvocableHandlerMethod.java
@@ -56,17 +56,17 @@ public class InvocableHandlerMethod extends HandlerMethod {
/**
- * Create an instance from the given handler and method.
+ * Create an instance from a {@code HandlerMethod}.
*/
- public InvocableHandlerMethod(Object bean, Method method) {
- super(bean, method);
+ public InvocableHandlerMethod(HandlerMethod handlerMethod) {
+ super(handlerMethod);
}
/**
- * Create an instance from a {@code HandlerMethod}.
+ * Create an instance from a bean instance and a method.
*/
- public InvocableHandlerMethod(HandlerMethod handlerMethod) {
- super(handlerMethod);
+ public InvocableHandlerMethod(Object bean, Method method) {
+ super(bean, method);
}
/**
@@ -112,7 +112,7 @@ public class InvocableHandlerMethod extends HandlerMethod {
/**
* Invoke the method after resolving its argument values in the context of the given request.
* Argument values are commonly resolved through {@link HandlerMethodArgumentResolver}s.
- * The {@code provideArgs} parameter however may supply argument values to be used directly,
+ * The {@code providedArgs} parameter however may supply argument values to be used directly,
* i.e. without argument resolution. Examples of provided argument values include a
* {@link WebDataBinder}, a {@link SessionStatus}, or a thrown exception instance.
* Provided argument values are checked before argument resolvers.
@@ -185,7 +185,8 @@ public class InvocableHandlerMethod extends HandlerMethod {
}
/**
- * Adds HandlerMethod details such as the controller type and method signature to the given error message.
+ * Adds HandlerMethod details such as the controller type and method
+ * signature to the given error message.
* @param message error message to append the HandlerMethod details to
*/
protected String getDetailedErrorMessage(String message) {
diff --git a/spring-web/src/main/java/org/springframework/web/util/UriTemplate.java b/spring-web/src/main/java/org/springframework/web/util/UriTemplate.java
index 3d71c0cdef011c0b008ffcd8174698085dc37ca5..17d98f7b8e6367e91e1e459d32aa326b083ae2ac 100644
--- a/spring-web/src/main/java/org/springframework/web/util/UriTemplate.java
+++ b/spring-web/src/main/java/org/springframework/web/util/UriTemplate.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2014 the original author or authors.
+ * Copyright 2002-2015 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.
@@ -29,10 +29,11 @@ import java.util.regex.Pattern;
import org.springframework.util.Assert;
/**
- * Represents a URI template. A URI template is a URI-like String that contains variables enclosed
- * by braces ({@code {}}), which can be expanded to produce an actual URI.
+ * Represents a URI template. A URI template is a URI-like String that contains variables
+ * enclosed by braces ({@code {}}), which can be expanded to produce an actual URI.
*
- * See {@link #expand(Map)}, {@link #expand(Object[])}, and {@link #match(String)} for example usages.
+ * See {@link #expand(Map)}, {@link #expand(Object[])}, and {@link #match(String)}
+ * for example usages.
*
* @author Arjen Poutsma
* @author Juergen Hoeller
@@ -48,6 +49,7 @@ public class UriTemplate implements Serializable {
/** Replaces template variables in the URI template. */
private static final String DEFAULT_VARIABLE_PATTERN = "(.*)";
+
private final UriComponents uriComponents;
private final List