提交 dbd82d12 编写于 作者: J Juergen Hoeller

Polishing

上级 e87dc9f8
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2015 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.
...@@ -203,8 +203,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut ...@@ -203,8 +203,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
pointcutParameters[i] = parser.createPointcutParameter( pointcutParameters[i] = parser.createPointcutParameter(
this.pointcutParameterNames[i], this.pointcutParameterTypes[i]); this.pointcutParameterNames[i], this.pointcutParameterTypes[i]);
} }
return parser.parsePointcutExpression( return parser.parsePointcutExpression(replaceBooleanOperators(getExpression()),
replaceBooleanOperators(getExpression()),
this.pointcutDeclarationScope, pointcutParameters); this.pointcutDeclarationScope, pointcutParameters);
} }
......
...@@ -38,6 +38,7 @@ public class GenericApplicationListenerAdapter implements GenericApplicationList ...@@ -38,6 +38,7 @@ public class GenericApplicationListenerAdapter implements GenericApplicationList
private final ResolvableType declaredEventType; private final ResolvableType declaredEventType;
/** /**
* Create a new GenericApplicationListener for the given delegate. * Create a new GenericApplicationListener for the given delegate.
* @param delegate the delegate listener to be invoked * @param delegate the delegate listener to be invoked
...@@ -87,6 +88,7 @@ public class GenericApplicationListenerAdapter implements GenericApplicationList ...@@ -87,6 +88,7 @@ public class GenericApplicationListenerAdapter implements GenericApplicationList
return (this.delegate instanceof Ordered ? ((Ordered) this.delegate).getOrder() : Ordered.LOWEST_PRECEDENCE); return (this.delegate instanceof Ordered ? ((Ordered) this.delegate).getOrder() : Ordered.LOWEST_PRECEDENCE);
} }
static ResolvableType resolveDeclaredEventType(Class<?> listenerType) { static ResolvableType resolveDeclaredEventType(Class<?> listenerType) {
ResolvableType resolvableType = ResolvableType.forClass(listenerType).as(ApplicationListener.class); ResolvableType resolvableType = ResolvableType.forClass(listenerType).as(ApplicationListener.class);
if (resolvableType == null || !resolvableType.hasGenerics()) { if (resolvableType == null || !resolvableType.hasGenerics()) {
......
/* /*
* 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"); * 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.
...@@ -67,12 +67,12 @@ public class GenericTypeResolverTests { ...@@ -67,12 +67,12 @@ public class GenericTypeResolverTests {
@Test @Test
public void methodReturnTypes() { public void methodReturnTypes() {
assertEquals(Integer.class, assertEquals(Integer.class,
resolveReturnTypeArgument(findMethod(MyTypeWithMethods.class, "integer"), MyInterfaceType.class)); resolveReturnTypeArgument(findMethod(MyTypeWithMethods.class, "integer"), MyInterfaceType.class));
assertEquals(String.class, assertEquals(String.class,
resolveReturnTypeArgument(findMethod(MyTypeWithMethods.class, "string"), MyInterfaceType.class)); resolveReturnTypeArgument(findMethod(MyTypeWithMethods.class, "string"), MyInterfaceType.class));
assertEquals(null, resolveReturnTypeArgument(findMethod(MyTypeWithMethods.class, "raw"), MyInterfaceType.class)); assertEquals(null, resolveReturnTypeArgument(findMethod(MyTypeWithMethods.class, "raw"), MyInterfaceType.class));
assertEquals(null, assertEquals(null,
resolveReturnTypeArgument(findMethod(MyTypeWithMethods.class, "object"), MyInterfaceType.class)); resolveReturnTypeArgument(findMethod(MyTypeWithMethods.class, "object"), MyInterfaceType.class));
} }
@Test @Test
...@@ -81,13 +81,13 @@ public class GenericTypeResolverTests { ...@@ -81,13 +81,13 @@ public class GenericTypeResolverTests {
Method intMessageMethod = findMethod(MyTypeWithMethods.class, "readIntegerInputMessage", MyInterfaceType.class); Method intMessageMethod = findMethod(MyTypeWithMethods.class, "readIntegerInputMessage", MyInterfaceType.class);
MethodParameter intMessageMethodParam = new MethodParameter(intMessageMethod, 0); MethodParameter intMessageMethodParam = new MethodParameter(intMessageMethod, 0);
assertEquals(MyInterfaceType.class, assertEquals(MyInterfaceType.class,
resolveType(intMessageMethodParam.getGenericParameterType(), new HashMap<TypeVariable, Type>())); resolveType(intMessageMethodParam.getGenericParameterType(), new HashMap<TypeVariable, Type>()));
Method intArrMessageMethod = findMethod(MyTypeWithMethods.class, "readIntegerArrayInputMessage", Method intArrMessageMethod = findMethod(MyTypeWithMethods.class, "readIntegerArrayInputMessage",
MyInterfaceType[].class); MyInterfaceType[].class);
MethodParameter intArrMessageMethodParam = new MethodParameter(intArrMessageMethod, 0); MethodParameter intArrMessageMethodParam = new MethodParameter(intArrMessageMethod, 0);
assertEquals(MyInterfaceType[].class, assertEquals(MyInterfaceType[].class,
resolveType(intArrMessageMethodParam.getGenericParameterType(), new HashMap<TypeVariable, Type>())); resolveType(intArrMessageMethodParam.getGenericParameterType(), new HashMap<TypeVariable, Type>()));
Method genericArrMessageMethod = findMethod(MySimpleTypeWithMethods.class, "readGenericArrayInputMessage", Method genericArrMessageMethod = findMethod(MySimpleTypeWithMethods.class, "readGenericArrayInputMessage",
Object[].class); Object[].class);
......
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2015 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.
...@@ -13,20 +13,24 @@ ...@@ -13,20 +13,24 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.servlet; package org.springframework.web.servlet;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
/** /**
* Exception to be thrown if DispatcherServlet is unable to determine a corresponding * Exception to be thrown if DispatcherServlet is unable to determine a corresponding
* handler for an incoming HTTP request. The DispatcherServlet throws this exception only * handler for an incoming HTTP request. The DispatcherServlet throws this exception
* if its throwExceptionIfNoHandlerFound property is set to "true". * only if its "throwExceptionIfNoHandlerFound" property is set to "true".
* *
* @author Brian Clozel * @author Brian Clozel
* @since 4.0 * @since 4.0
* @see org.springframework.web.servlet.DispatcherServlet * @see DispatcherServlet#setThrowExceptionIfNoHandlerFound(boolean)
* @see DispatcherServlet#noHandlerFound(HttpServletRequest, HttpServletResponse)
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class NoHandlerFoundException extends ServletException { public class NoHandlerFoundException extends ServletException {
...@@ -51,6 +55,7 @@ public class NoHandlerFoundException extends ServletException { ...@@ -51,6 +55,7 @@ public class NoHandlerFoundException extends ServletException {
this.headers = headers; this.headers = headers;
} }
public String getHttpMethod() { public String getHttpMethod() {
return this.httpMethod; return this.httpMethod;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册