Skip to content

Commit 770f678

Browse files
committed
Polishing
1 parent e0e720c commit 770f678

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
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-2015 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.
@@ -37,20 +37,22 @@ public static boolean simpleMatch(String pattern, String str) {
3737
if (pattern == null || str == null) {
3838
return false;
3939
}
40+
4041
int firstIndex = pattern.indexOf('*');
4142
if (firstIndex == -1) {
4243
return pattern.equals(str);
4344
}
45+
4446
if (firstIndex == 0) {
4547
if (pattern.length() == 1) {
4648
return true;
4749
}
48-
int nextIndex = pattern.indexOf('*', firstIndex + 1);
50+
int nextIndex = pattern.indexOf('*', 1);
4951
if (nextIndex == -1) {
5052
return str.endsWith(pattern.substring(1));
5153
}
5254
String part = pattern.substring(1, nextIndex);
53-
if ("".equals(part)) {
55+
if (part.isEmpty()) {
5456
return simpleMatch(pattern.substring(nextIndex), str);
5557
}
5658
int partIndex = str.indexOf(part);
@@ -62,6 +64,7 @@ public static boolean simpleMatch(String pattern, String str) {
6264
}
6365
return false;
6466
}
67+
6568
return (str.length() >= firstIndex &&
6669
pattern.substring(0, firstIndex).equals(str.substring(0, firstIndex)) &&
6770
simpleMatch(pattern.substring(firstIndex), str.substring(firstIndex)));

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

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ public Jackson2ObjectMapperBuilder filters(FilterProvider filters) {
260260
* @param mixinSource class (or interface) whose annotations are to be "added"
261261
* to target's annotations as value
262262
* @since 4.1.2
263-
* @see com.fasterxml.jackson.databind.ObjectMapper#addMixInAnnotations(Class, Class)
263+
* @see com.fasterxml.jackson.databind.ObjectMapper#addMixIn(Class, Class)
264264
*/
265265
public Jackson2ObjectMapperBuilder mixIn(Class<?> target, Class<?> mixinSource) {
266266
if (mixinSource != null) {
@@ -271,11 +271,11 @@ public Jackson2ObjectMapperBuilder mixIn(Class<?> target, Class<?> mixinSource)
271271

272272
/**
273273
* Add mix-in annotations to use for augmenting specified class or interface.
274-
* @param mixIns Map of entries with target classes (or interface) whose annotations
274+
* @param mixIns a Map of entries with target classes (or interface) whose annotations
275275
* to effectively override as key and mix-in classes (or interface) whose
276276
* annotations are to be "added" to target's annotations as value.
277277
* @since 4.1.2
278-
* @see com.fasterxml.jackson.databind.ObjectMapper#addMixInAnnotations(Class, Class)
278+
* @see com.fasterxml.jackson.databind.ObjectMapper#addMixIn(Class, Class)
279279
*/
280280
public Jackson2ObjectMapperBuilder mixIns(Map<Class<?>, Class<?>> mixIns) {
281281
if (mixIns != null) {
@@ -304,8 +304,8 @@ public Jackson2ObjectMapperBuilder serializers(JsonSerializer<?>... serializers)
304304

305305
/**
306306
* Configure a custom serializer for the given type.
307-
* @see #serializers(JsonSerializer...)
308307
* @since 4.1.2
308+
* @see #serializers(JsonSerializer...)
309309
*/
310310
public Jackson2ObjectMapperBuilder serializerByType(Class<?> type, JsonSerializer<?> serializer) {
311311
if (serializer != null) {
@@ -463,6 +463,8 @@ public Jackson2ObjectMapperBuilder featuresToDisable(Object... featuresToDisable
463463

464464
/**
465465
* Specify one or more modules to be registered with the {@link ObjectMapper}.
466+
* Multiple invocations are not additive, the last one defines the modules to
467+
* register.
466468
* <p>Note: If this is set, no finding of modules is going to happen - not by
467469
* Jackson, and not by Spring either (see {@link #findModulesViaServiceLoader}).
468470
* As a consequence, specifying an empty list here will suppress any kind of
@@ -478,6 +480,8 @@ public Jackson2ObjectMapperBuilder modules(Module... modules) {
478480

479481
/**
480482
* Set a complete list of modules to be registered with the {@link ObjectMapper}.
483+
* Multiple invocations are not additive, the last one defines the modules to
484+
* register.
481485
* <p>Note: If this is set, no finding of modules is going to happen - not by
482486
* Jackson, and not by Spring either (see {@link #findModulesViaServiceLoader}).
483487
* As a consequence, specifying an empty list here will suppress any kind of
@@ -495,6 +499,8 @@ public Jackson2ObjectMapperBuilder modules(List<Module> modules) {
495499

496500
/**
497501
* Specify one or more modules to be registered with the {@link ObjectMapper}.
502+
* Multiple invocations are not additive, the last one defines the modules
503+
* to register.
498504
* <p>Modules specified here will be registered after
499505
* Spring's autodetection of JSR-310 and Joda-Time, or Jackson's
500506
* finding of modules (see {@link #findModulesViaServiceLoader}),
@@ -511,7 +517,8 @@ public Jackson2ObjectMapperBuilder modulesToInstall(Module... modules) {
511517

512518
/**
513519
* Specify one or more modules by class to be registered with
514-
* the {@link ObjectMapper}.
520+
* the {@link ObjectMapper}. Multiple invocations are not additive,
521+
* the last one defines the modules to register.
515522
* <p>Modules specified here will be registered after
516523
* Spring's autodetection of JSR-310 and Joda-Time, or Jackson's
517524
* finding of modules (see {@link #findModulesViaServiceLoader}),
@@ -529,7 +536,7 @@ public Jackson2ObjectMapperBuilder modulesToInstall(Class<? extends Module>... m
529536

530537
/**
531538
* Set whether to let Jackson find available modules via the JDK ServiceLoader,
532-
* based on META-INF metadata in the classpath. Requires Jackson 2.2 or higher.
539+
* based on META-INF metadata in the classpath.
533540
* <p>If this mode is not set, Spring's Jackson2ObjectMapperBuilder itself
534541
* will try to find the JSR-310 and Joda-Time support modules on the classpath -
535542
* provided that Java 8 and Joda-Time themselves are available, respectively.

0 commit comments

Comments
 (0)