Skip to content

Commit c28cadb

Browse files
committed
Polishing
1 parent 9198e03 commit c28cadb

File tree

3 files changed

+23
-16
lines changed

3 files changed

+23
-16
lines changed

spring-core/src/main/java/org/springframework/util/PatternMatchUtils.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -39,20 +39,22 @@ public static boolean simpleMatch(@Nullable String pattern, @Nullable String str
3939
if (pattern == null || str == null) {
4040
return false;
4141
}
42+
4243
int firstIndex = pattern.indexOf('*');
4344
if (firstIndex == -1) {
4445
return pattern.equals(str);
4546
}
47+
4648
if (firstIndex == 0) {
4749
if (pattern.length() == 1) {
4850
return true;
4951
}
50-
int nextIndex = pattern.indexOf('*', firstIndex + 1);
52+
int nextIndex = pattern.indexOf('*', 1);
5153
if (nextIndex == -1) {
5254
return str.endsWith(pattern.substring(1));
5355
}
5456
String part = pattern.substring(1, nextIndex);
55-
if ("".equals(part)) {
57+
if (part.isEmpty()) {
5658
return simpleMatch(pattern.substring(nextIndex), str);
5759
}
5860
int partIndex = str.indexOf(part);
@@ -64,6 +66,7 @@ public static boolean simpleMatch(@Nullable String pattern, @Nullable String str
6466
}
6567
return false;
6668
}
69+
6770
return (str.length() >= firstIndex &&
6871
pattern.substring(0, firstIndex).equals(str.substring(0, firstIndex)) &&
6972
simpleMatch(pattern.substring(firstIndex), str.substring(firstIndex)));

spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperBuilder.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ public Jackson2ObjectMapperBuilder filters(FilterProvider filters) {
299299
* @param mixinSource class (or interface) whose annotations are to be "added"
300300
* to target's annotations as value
301301
* @since 4.1.2
302-
* @see com.fasterxml.jackson.databind.ObjectMapper#addMixInAnnotations(Class, Class)
302+
* @see com.fasterxml.jackson.databind.ObjectMapper#addMixIn(Class, Class)
303303
*/
304304
public Jackson2ObjectMapperBuilder mixIn(Class<?> target, Class<?> mixinSource) {
305305
this.mixIns.put(target, mixinSource);
@@ -308,11 +308,11 @@ public Jackson2ObjectMapperBuilder mixIn(Class<?> target, Class<?> mixinSource)
308308

309309
/**
310310
* Add mix-in annotations to use for augmenting specified class or interface.
311-
* @param mixIns Map of entries with target classes (or interface) whose annotations
311+
* @param mixIns a Map of entries with target classes (or interface) whose annotations
312312
* to effectively override as key and mix-in classes (or interface) whose
313313
* annotations are to be "added" to target's annotations as value.
314314
* @since 4.1.2
315-
* @see com.fasterxml.jackson.databind.ObjectMapper#addMixInAnnotations(Class, Class)
315+
* @see com.fasterxml.jackson.databind.ObjectMapper#addMixIn(Class, Class)
316316
*/
317317
public Jackson2ObjectMapperBuilder mixIns(Map<Class<?>, Class<?>> mixIns) {
318318
this.mixIns.putAll(mixIns);
@@ -337,8 +337,8 @@ public Jackson2ObjectMapperBuilder serializers(JsonSerializer<?>... serializers)
337337

338338
/**
339339
* Configure a custom serializer for the given type.
340-
* @see #serializers(JsonSerializer...)
341340
* @since 4.1.2
341+
* @see #serializers(JsonSerializer...)
342342
*/
343343
public Jackson2ObjectMapperBuilder serializerByType(Class<?> type, JsonSerializer<?> serializer) {
344344
this.serializers.put(type, serializer);
@@ -482,6 +482,8 @@ public Jackson2ObjectMapperBuilder featuresToDisable(Object... featuresToDisable
482482

483483
/**
484484
* Specify one or more modules to be registered with the {@link ObjectMapper}.
485+
* Multiple invocations are not additive, the last one defines the modules to
486+
* register.
485487
* <p>Note: If this is set, no finding of modules is going to happen - not by
486488
* Jackson, and not by Spring either (see {@link #findModulesViaServiceLoader}).
487489
* As a consequence, specifying an empty list here will suppress any kind of
@@ -497,6 +499,8 @@ public Jackson2ObjectMapperBuilder modules(Module... modules) {
497499

498500
/**
499501
* Set a complete list of modules to be registered with the {@link ObjectMapper}.
502+
* Multiple invocations are not additive, the last one defines the modules to
503+
* register.
500504
* <p>Note: If this is set, no finding of modules is going to happen - not by
501505
* Jackson, and not by Spring either (see {@link #findModulesViaServiceLoader}).
502506
* As a consequence, specifying an empty list here will suppress any kind of
@@ -514,6 +518,8 @@ public Jackson2ObjectMapperBuilder modules(List<Module> modules) {
514518

515519
/**
516520
* Specify one or more modules to be registered with the {@link ObjectMapper}.
521+
* Multiple invocations are not additive, the last one defines the modules
522+
* to register.
517523
* <p>Modules specified here will be registered after
518524
* Spring's autodetection of JSR-310 and Joda-Time, or Jackson's
519525
* finding of modules (see {@link #findModulesViaServiceLoader}),
@@ -530,7 +536,8 @@ public Jackson2ObjectMapperBuilder modulesToInstall(Module... modules) {
530536

531537
/**
532538
* Specify one or more modules by class to be registered with
533-
* the {@link ObjectMapper}.
539+
* the {@link ObjectMapper}. Multiple invocations are not additive,
540+
* the last one defines the modules to register.
534541
* <p>Modules specified here will be registered after
535542
* Spring's autodetection of JSR-310 and Joda-Time, or Jackson's
536543
* finding of modules (see {@link #findModulesViaServiceLoader}),

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -111,12 +111,9 @@ public ParameterNameDiscoverer getParameterNameDiscoverer() {
111111
}
112112

113113
/**
114-
* Configure a reactive registry. This is needed for cases where the response
115-
* is fully handled within the controller in combination with an async void
116-
* return value.
117-
* <p>By default this is an instance of {@link ReactiveAdapterRegistry} with
118-
* default settings.
119-
* @param registry the registry to use
114+
* Configure a reactive adapter registry. This is needed for cases where the response is
115+
* fully handled within the controller in combination with an async void return value.
116+
* <p>By default this is a {@link ReactiveAdapterRegistry} with default settings.
120117
*/
121118
public void setReactiveAdapterRegistry(ReactiveAdapterRegistry registry) {
122119
this.reactiveAdapterRegistry = registry;
@@ -128,7 +125,7 @@ public void setReactiveAdapterRegistry(ReactiveAdapterRegistry registry) {
128125
* @param exchange the current exchange
129126
* @param bindingContext the binding context to use
130127
* @param providedArgs optional list of argument values to match by type
131-
* @return a Mono with a {@link HandlerResult}.
128+
* @return a Mono with a {@link HandlerResult}
132129
*/
133130
public Mono<HandlerResult> invoke(
134131
ServerWebExchange exchange, BindingContext bindingContext, Object... providedArgs) {

0 commit comments

Comments
 (0)