17
17
package org .springframework .web .servlet .mvc .method ;
18
18
19
19
import java .util .List ;
20
-
21
20
import javax .servlet .http .HttpServletRequest ;
22
21
23
22
import org .springframework .http .HttpHeaders ;
39
38
/**
40
39
* Encapsulates the following request mapping conditions:
41
40
* <ol>
42
- * <li>{@link PatternsRequestCondition}
43
- * <li>{@link RequestMethodsRequestCondition}
44
- * <li>{@link ParamsRequestCondition}
45
- * <li>{@link HeadersRequestCondition}
46
- * <li>{@link ConsumesRequestCondition}
47
- * <li>{@link ProducesRequestCondition}
48
- * <li>{@code RequestCondition} (optional, custom request condition)
41
+ * <li>{@link PatternsRequestCondition}
42
+ * <li>{@link RequestMethodsRequestCondition}
43
+ * <li>{@link ParamsRequestCondition}
44
+ * <li>{@link HeadersRequestCondition}
45
+ * <li>{@link ConsumesRequestCondition}
46
+ * <li>{@link ProducesRequestCondition}
47
+ * <li>{@code RequestCondition} (optional, custom request condition)
49
48
* </ol>
50
49
*
51
50
* @author Arjen Poutsma
@@ -297,21 +296,21 @@ public int compareTo(RequestMappingInfo other, HttpServletRequest request) {
297
296
}
298
297
299
298
@ Override
300
- public boolean equals (Object obj ) {
301
- if (this == obj ) {
299
+ public boolean equals (Object other ) {
300
+ if (this == other ) {
302
301
return true ;
303
302
}
304
- if (obj != null && obj instanceof RequestMappingInfo ) {
305
- RequestMappingInfo other = ( RequestMappingInfo ) obj ;
306
- return ( this . patternsCondition . equals ( other . patternsCondition ) &&
307
- this . methodsCondition . equals ( other . methodsCondition ) &&
308
- this .paramsCondition .equals (other . paramsCondition ) &&
309
- this .headersCondition .equals (other . headersCondition ) &&
310
- this .consumesCondition .equals (other . consumesCondition ) &&
311
- this .producesCondition .equals (other . producesCondition ) &&
312
- this .customConditionHolder .equals (other . customConditionHolder ));
313
- }
314
- return false ;
303
+ if (!( other instanceof RequestMappingInfo ) ) {
304
+ return false ;
305
+ }
306
+ RequestMappingInfo otherInfo = ( RequestMappingInfo ) other ;
307
+ return ( this .patternsCondition .equals (otherInfo . patternsCondition ) &&
308
+ this .methodsCondition .equals (otherInfo . methodsCondition ) &&
309
+ this .paramsCondition .equals (otherInfo . paramsCondition ) &&
310
+ this .headersCondition .equals (otherInfo . headersCondition ) &&
311
+ this .consumesCondition .equals (otherInfo . consumesCondition ) &&
312
+ this . producesCondition . equals ( otherInfo . producesCondition ) &&
313
+ this . customConditionHolder . equals ( otherInfo . customConditionHolder )) ;
315
314
}
316
315
317
316
@ Override
@@ -348,6 +347,7 @@ public String toString() {
348
347
return builder .toString ();
349
348
}
350
349
350
+
351
351
/**
352
352
* Create a new {@code RequestMappingInfo.Builder} with the given paths.
353
353
* @param paths the paths to use
@@ -416,6 +416,7 @@ public interface Builder {
416
416
RequestMappingInfo build ();
417
417
}
418
418
419
+
419
420
private static class DefaultBuilder implements Builder {
420
421
421
422
private String [] paths ;
@@ -436,12 +437,10 @@ private static class DefaultBuilder implements Builder {
436
437
437
438
private BuilderConfiguration options = new BuilderConfiguration ();
438
439
439
-
440
440
public DefaultBuilder (String ... paths ) {
441
441
this .paths = paths ;
442
442
}
443
443
444
-
445
444
@ Override
446
445
public Builder paths (String ... paths ) {
447
446
this .paths = paths ;
@@ -498,7 +497,6 @@ public Builder options(BuilderConfiguration options) {
498
497
499
498
@ Override
500
499
public RequestMappingInfo build () {
501
-
502
500
ContentNegotiationManager manager = this .options .getContentNegotiationManager ();
503
501
504
502
PatternsRequestCondition patternsCondition = new PatternsRequestCondition (
@@ -516,13 +514,13 @@ public RequestMappingInfo build() {
516
514
}
517
515
}
518
516
517
+
519
518
/**
520
519
* Container for configuration options used for request mapping purposes.
521
520
* Such configuration is required to create RequestMappingInfo instances but
522
521
* is typically used across all RequestMappingInfo instances.
523
- *
524
- * @see Builder#options
525
522
* @since 4.2
523
+ * @see Builder#options
526
524
*/
527
525
public static class BuilderConfiguration {
528
526
@@ -538,7 +536,6 @@ public static class BuilderConfiguration {
538
536
539
537
private ContentNegotiationManager contentNegotiationManager ;
540
538
541
-
542
539
/**
543
540
* Set a custom UrlPathHelper to use for the PatternsRequestCondition.
544
541
* <p>By default this is not set.
0 commit comments