Browse Source

Polishing

pull/26273/head
Juergen Hoeller 5 years ago
parent
commit
f3f19504c6
  1. 3
      spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/HandlerMethodReturnValueHandlerComposite.java
  2. 4
      spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/InvocableHelper.java
  3. 28
      spring-web/src/main/java/org/springframework/web/method/support/InvocableHandlerMethod.java
  4. 9
      spring-webflux/src/main/java/org/springframework/web/reactive/result/method/InvocableHandlerMethod.java

3
spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/HandlerMethodReturnValueHandlerComposite.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2020 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.
@ -38,7 +38,6 @@ public class HandlerMethodReturnValueHandlerComposite implements HandlerMethodRe @@ -38,7 +38,6 @@ public class HandlerMethodReturnValueHandlerComposite implements HandlerMethodRe
protected final Log logger = LogFactory.getLog(getClass());
private final List<HandlerMethodReturnValueHandler> returnValueHandlers = new ArrayList<>();

4
spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/InvocableHelper.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@ -46,7 +46,7 @@ import org.springframework.util.Assert; @@ -46,7 +46,7 @@ import org.springframework.util.Assert;
*/
class InvocableHelper {
private static Log logger = LogFactory.getLog(InvocableHelper.class);
private static final Log logger = LogFactory.getLog(InvocableHelper.class);
private final HandlerMethodArgumentResolverComposite argumentResolvers =

28
spring-web/src/main/java/org/springframework/web/method/support/InvocableHandlerMethod.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@ -46,13 +46,13 @@ public class InvocableHandlerMethod extends HandlerMethod { @@ -46,13 +46,13 @@ public class InvocableHandlerMethod extends HandlerMethod {
private static final Object[] EMPTY_ARGS = new Object[0];
@Nullable
private WebDataBinderFactory dataBinderFactory;
private HandlerMethodArgumentResolverComposite resolvers = new HandlerMethodArgumentResolverComposite();
private ParameterNameDiscoverer parameterNameDiscoverer = new DefaultParameterNameDiscoverer();
@Nullable
private WebDataBinderFactory dataBinderFactory;
/**
* Create an instance from a {@code HandlerMethod}.
@ -83,16 +83,8 @@ public class InvocableHandlerMethod extends HandlerMethod { @@ -83,16 +83,8 @@ public class InvocableHandlerMethod extends HandlerMethod {
/**
* Set the {@link WebDataBinderFactory} to be passed to argument resolvers allowing them to create
* a {@link WebDataBinder} for data binding and type conversion purposes.
* @param dataBinderFactory the data binder factory.
*/
public void setDataBinderFactory(WebDataBinderFactory dataBinderFactory) {
this.dataBinderFactory = dataBinderFactory;
}
/**
* Set {@link HandlerMethodArgumentResolver HandlerMethodArgumentResolvers} to use to use for resolving method argument values.
* Set {@link HandlerMethodArgumentResolver HandlerMethodArgumentResolvers}
* to use for resolving method argument values.
*/
public void setHandlerMethodArgumentResolvers(HandlerMethodArgumentResolverComposite argumentResolvers) {
this.resolvers = argumentResolvers;
@ -107,6 +99,14 @@ public class InvocableHandlerMethod extends HandlerMethod { @@ -107,6 +99,14 @@ public class InvocableHandlerMethod extends HandlerMethod {
this.parameterNameDiscoverer = parameterNameDiscoverer;
}
/**
* Set the {@link WebDataBinderFactory} to be passed to argument resolvers allowing them
* to create a {@link WebDataBinder} for data binding and type conversion purposes.
*/
public void setDataBinderFactory(WebDataBinderFactory dataBinderFactory) {
this.dataBinderFactory = dataBinderFactory;
}
/**
* Invoke the method after resolving its argument values in the context of the given request.

9
spring-webflux/src/main/java/org/springframework/web/reactive/result/method/InvocableHandlerMethod.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@ -60,7 +60,7 @@ public class InvocableHandlerMethod extends HandlerMethod { @@ -60,7 +60,7 @@ public class InvocableHandlerMethod extends HandlerMethod {
private static final Object NO_ARG_VALUE = new Object();
private HandlerMethodArgumentResolverComposite resolvers = new HandlerMethodArgumentResolverComposite();
private final HandlerMethodArgumentResolverComposite resolvers = new HandlerMethodArgumentResolverComposite();
private ParameterNameDiscoverer parameterNameDiscoverer = new DefaultParameterNameDiscoverer();
@ -139,8 +139,9 @@ public class InvocableHandlerMethod extends HandlerMethod { @@ -139,8 +139,9 @@ public class InvocableHandlerMethod extends HandlerMethod {
try {
ReflectionUtils.makeAccessible(getBridgedMethod());
Method method = getBridgedMethod();
if (KotlinDetector.isKotlinReflectPresent() && KotlinDetector.isKotlinType(method.getDeclaringClass())
&& CoroutinesUtils.isSuspendingFunction(method)) {
if (KotlinDetector.isKotlinReflectPresent() &&
KotlinDetector.isKotlinType(method.getDeclaringClass()) &&
CoroutinesUtils.isSuspendingFunction(method)) {
value = CoroutinesUtils.invokeSuspendingFunction(method, getBean(), args);
}
else {

Loading…
Cancel
Save