Browse Source

Polish Javadoc

pull/22643/head
Sam Brannen 7 years ago
parent
commit
14902e1744
  1. 30
      spring-web/src/main/java/org/springframework/web/bind/annotation/ControllerAdvice.java
  2. 20
      spring-web/src/main/java/org/springframework/web/method/ControllerAdviceBean.java
  3. 4
      spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java

30
spring-web/src/main/java/org/springframework/web/bind/annotation/ControllerAdvice.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2018 the original author or authors. * Copyright 2002-2019 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.
@ -46,16 +46,16 @@ import org.springframework.stereotype.Component;
* <p>Note: For {@code @ExceptionHandler} methods, a root exception match will be * <p>Note: For {@code @ExceptionHandler} methods, a root exception match will be
* preferred to just matching a cause of the current exception, among the handler * preferred to just matching a cause of the current exception, among the handler
* methods of a particular advice bean. However, a cause match on a higher-priority * methods of a particular advice bean. However, a cause match on a higher-priority
* advice will still be preferred to a any match (whether root or cause level) * advice will still be preferred over any match (whether root or cause level)
* on a lower-priority advice bean. As a consequence, please declare your primary * on a lower-priority advice bean. As a consequence, please declare your primary
* root exception mappings on a prioritized advice bean with a corresponding order! * root exception mappings on a prioritized advice bean with a corresponding order.
* *
* <p>By default the methods in an {@code @ControllerAdvice} apply globally to * <p>By default, the methods in an {@code @ControllerAdvice} apply globally to
* all Controllers. Use selectors {@link #annotations()}, * all controllers. Use selectors {@link #annotations},
* {@link #basePackageClasses()}, and {@link #basePackages()} (or its alias * {@link #basePackageClasses}, and {@link #basePackages} (or its alias
* {@link #value()}) to define a more narrow subset of targeted Controllers. * {@link #value}) to define a more narrow subset of targeted controllers.
* If multiple selectors are declared, OR logic is applied, meaning selected * If multiple selectors are declared, boolean {@code OR} logic is applied, meaning
* Controllers should match at least one selector. Note that selector checks * selected controllers should match at least one selector. Note that selector checks
* are performed at runtime and so adding many selectors may negatively impact * are performed at runtime and so adding many selectors may negatively impact
* performance and add complexity. * performance and add complexity.
* *
@ -98,8 +98,8 @@ public @interface ControllerAdvice {
String[] basePackages() default {}; String[] basePackages() default {};
/** /**
* Type-safe alternative to {@link #value()} for specifying the packages * Type-safe alternative to {@link #basePackages} for specifying the packages
* to select Controllers to be assisted by the {@code @ControllerAdvice} * in which to select controllers to be advised by the {@code @ControllerAdvice}
* annotated class. * annotated class.
* <p>Consider creating a special no-op marker class or interface in each package * <p>Consider creating a special no-op marker class or interface in each package
* that serves no purpose other than being referenced by this attribute. * that serves no purpose other than being referenced by this attribute.
@ -110,16 +110,16 @@ public @interface ControllerAdvice {
/** /**
* Array of classes. * Array of classes.
* <p>Controllers that are assignable to at least one of the given types * <p>Controllers that are assignable to at least one of the given types
* will be assisted by the {@code @ControllerAdvice} annotated class. * will be advised by the {@code @ControllerAdvice} annotated class.
* @since 4.0 * @since 4.0
*/ */
Class<?>[] assignableTypes() default {}; Class<?>[] assignableTypes() default {};
/** /**
* Array of annotations. * Array of annotations.
* <p>Controllers that are annotated with this/one of those annotation(s) * <p>Controllers that are annotated with at least one of the supplied annotations
* will be assisted by the {@code @ControllerAdvice} annotated class. * will be advised by the {@code @ControllerAdvice} annotated class.
* <p>Consider creating a special annotation or use a predefined one, * <p>Consider creating a custom composed annotation or use a predefined one,
* like {@link RestController @RestController}. * like {@link RestController @RestController}.
* @since 4.0 * @since 4.0
*/ */

20
spring-web/src/main/java/org/springframework/web/method/ControllerAdviceBean.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2018 the original author or authors. * Copyright 2002-2019 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.
@ -32,12 +32,12 @@ import org.springframework.util.ClassUtils;
import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ControllerAdvice;
/** /**
* Encapsulates information about an {@linkplain ControllerAdvice @ControllerAdvice} * Encapsulates information about an {@link ControllerAdvice @ControllerAdvice}
* Spring-managed bean without necessarily requiring it to be instantiated. * Spring-managed bean without necessarily requiring it to be instantiated.
* *
* <p>The {@link #findAnnotatedBeans(ApplicationContext)} method can be used to * <p>The {@link #findAnnotatedBeans(ApplicationContext)} method can be used to
* discover such beans. However, a {@code ControllerAdviceBean} may be created * discover such beans. However, a {@code ControllerAdviceBean} may be created
* from any object, including ones without an {@code @ControllerAdvice}. * from any object, including ones without an {@code @ControllerAdvice} annotation.
* *
* @author Rossen Stoyanchev * @author Rossen Stoyanchev
* @author Brian Clozel * @author Brian Clozel
@ -113,7 +113,7 @@ public class ControllerAdviceBean implements Ordered {
/** /**
* Returns the order value extracted from the {@link ControllerAdvice} * Return the order value extracted from the {@link ControllerAdvice}
* annotation, or {@link Ordered#LOWEST_PRECEDENCE} otherwise. * annotation, or {@link Ordered#LOWEST_PRECEDENCE} otherwise.
*/ */
@Override @Override
@ -146,11 +146,11 @@ public class ControllerAdviceBean implements Ordered {
} }
/** /**
* Check whether the given bean type should be assisted by this * Check whether the given bean type should be advised by this
* {@code @ControllerAdvice} instance. * {@code ControllerAdviceBean}.
* @param beanType the type of the bean to check * @param beanType the type of the bean to check
* @since 4.0 * @since 4.0
* @see org.springframework.web.bind.annotation.ControllerAdvice * @see ControllerAdvice
*/ */
public boolean isApplicableToBeanType(@Nullable Class<?> beanType) { public boolean isApplicableToBeanType(@Nullable Class<?> beanType) {
return this.beanTypePredicate.test(beanType); return this.beanTypePredicate.test(beanType);
@ -181,9 +181,9 @@ public class ControllerAdviceBean implements Ordered {
/** /**
* Find the names of beans annotated with * Find beans annotated with {@link ControllerAdvice @ControllerAdvice} in the
* {@linkplain ControllerAdvice @ControllerAdvice} in the given * given {@link ApplicationContext} and wrap them as {@code ControllerAdviceBean}
* ApplicationContext and wrap them as {@code ControllerAdviceBean} instances. * instances.
*/ */
public static List<ControllerAdviceBean> findAnnotatedBeans(ApplicationContext context) { public static List<ControllerAdviceBean> findAnnotatedBeans(ApplicationContext context) {
return Arrays.stream(BeanFactoryUtils.beanNamesForTypeIncludingAncestors(context, Object.class)) return Arrays.stream(BeanFactoryUtils.beanNamesForTypeIncludingAncestors(context, Object.class))

4
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2018 the original author or authors. * Copyright 2002-2019 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.
@ -99,7 +99,7 @@ import org.springframework.web.util.WebUtils;
/** /**
* Extension of {@link AbstractHandlerMethodAdapter} that supports * Extension of {@link AbstractHandlerMethodAdapter} that supports
* {@link RequestMapping} annotated {@code HandlerMethod RequestMapping} annotated {@code HandlerMethods}. * {@link RequestMapping @RequestMapping} annotated {@link HandlerMethod HandlerMethods}.
* *
* <p>Support for custom argument and return value types can be added via * <p>Support for custom argument and return value types can be added via
* {@link #setCustomArgumentResolvers} and {@link #setCustomReturnValueHandlers}, * {@link #setCustomArgumentResolvers} and {@link #setCustomReturnValueHandlers},

Loading…
Cancel
Save