DispatcherServlet.getHandlerMappings() accessor declared as final

Issue: SPR-15934
This commit is contained in:
Juergen Hoeller 2017-09-25 22:45:04 +02:00
parent bdde0f1ea0
commit 9ff4c0bff8
1 changed files with 16 additions and 20 deletions

View File

@ -770,20 +770,6 @@ public class DispatcherServlet extends FrameworkServlet {
}
}
/**
* Return the configured {@link HandlerMapping} beans that were detected by
* type in the {@link WebApplicationContext} or initialized based on the
* default set of strategies from {@literal DispatcherServlet.properties}.
* <p><strong>Note:</strong> This method may return {@code null} if invoked
* prior to {@link #onRefresh(ApplicationContext)}.
* @return immutable list with the configured mappings or {@code null}
* @since 5.0
*/
@Nullable
public List<HandlerMapping> getHandlerMappings() {
return this.handlerMappings != null ? Collections.unmodifiableList(this.handlerMappings) : null;
}
/**
* Return this servlet's ThemeSource, if any; else return {@code null}.
* <p>Default is to return the WebApplicationContext as ThemeSource,
@ -793,12 +779,7 @@ public class DispatcherServlet extends FrameworkServlet {
*/
@Nullable
public final ThemeSource getThemeSource() {
if (getWebApplicationContext() instanceof ThemeSource) {
return (ThemeSource) getWebApplicationContext();
}
else {
return null;
}
return (getWebApplicationContext() instanceof ThemeSource ? (ThemeSource) getWebApplicationContext() : null);
}
/**
@ -811,6 +792,21 @@ public class DispatcherServlet extends FrameworkServlet {
return this.multipartResolver;
}
/**
* Return the configured {@link HandlerMapping} beans that were detected by
* type in the {@link WebApplicationContext} or initialized based on the
* default set of strategies from {@literal DispatcherServlet.properties}.
* <p><strong>Note:</strong> This method may return {@code null} if invoked
* prior to {@link #onRefresh(ApplicationContext)}.
* @return an immutable list with the configured mappings, or {@code null}
* if not initialized yet
* @since 5.0
*/
@Nullable
public final List<HandlerMapping> getHandlerMappings() {
return (this.handlerMappings != null ? Collections.unmodifiableList(this.handlerMappings) : null);
}
/**
* Return the default strategy object for the given strategy interface.
* <p>The default implementation delegates to {@link #getDefaultStrategies},