Skip to content

Commit 97148ce

Browse files
committed
Polishing
1 parent e410129 commit 97148ce

File tree

4 files changed

+41
-23
lines changed

4 files changed

+41
-23
lines changed

spring-context/src/main/java/org/springframework/format/datetime/joda/JodaTimeFormatterRegistrar.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2015 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.
@@ -54,7 +54,7 @@
5454
*/
5555
public class JodaTimeFormatterRegistrar implements FormatterRegistrar {
5656

57-
private static enum Type {DATE, TIME, DATE_TIME}
57+
private enum Type {DATE, TIME, DATE_TIME}
5858

5959

6060
/**
@@ -119,9 +119,9 @@ public void setDateTimeStyle(String dateTimeStyle) {
119119
* the {@link #setDateStyle(String) dateStyle} and
120120
* {@link #setUseIsoFormat(boolean) useIsoFormat} properties will be ignored.
121121
* @param formatter the formatter to use
122+
* @since 3.2
122123
* @see #setTimeFormatter
123124
* @see #setDateTimeFormatter
124-
* @since 3.2
125125
*/
126126
public void setDateFormatter(DateTimeFormatter formatter) {
127127
this.formatters.put(Type.DATE, formatter);
@@ -133,9 +133,9 @@ public void setDateFormatter(DateTimeFormatter formatter) {
133133
* the {@link #setTimeStyle(String) timeStyle} and
134134
* {@link #setUseIsoFormat(boolean) useIsoFormat} properties will be ignored.
135135
* @param formatter the formatter to use
136+
* @since 3.2
136137
* @see #setDateFormatter
137138
* @see #setDateTimeFormatter
138-
* @since 3.2
139139
*/
140140
public void setTimeFormatter(DateTimeFormatter formatter) {
141141
this.formatters.put(Type.TIME, formatter);
@@ -148,9 +148,9 @@ public void setTimeFormatter(DateTimeFormatter formatter) {
148148
* the {@link #setDateTimeStyle(String) dateTimeStyle} and
149149
* {@link #setUseIsoFormat(boolean) useIsoFormat} properties will be ignored.
150150
* @param formatter the formatter to use
151+
* @since 3.2
151152
* @see #setDateFormatter
152153
* @see #setTimeFormatter
153-
* @since 3.2
154154
*/
155155
public void setDateTimeFormatter(DateTimeFormatter formatter) {
156156
this.formatters.put(Type.DATE_TIME, formatter);

spring-context/src/main/java/org/springframework/format/datetime/standard/DateTimeFormatterRegistrar.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2015 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.
@@ -50,7 +50,7 @@
5050
@UsesJava8
5151
public class DateTimeFormatterRegistrar implements FormatterRegistrar {
5252

53-
private static enum Type {DATE, TIME, DATE_TIME}
53+
private enum Type {DATE, TIME, DATE_TIME}
5454

5555

5656
/**

spring-test/src/main/java/org/springframework/test/web/servlet/result/JsonPathResultMatchers.java

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2015 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.
@@ -16,37 +16,44 @@
1616

1717
package org.springframework.test.web.servlet.result;
1818

19+
import com.jayway.jsonpath.JsonPath;
1920
import org.hamcrest.Matcher;
2021

2122
import org.springframework.test.util.JsonPathExpectationsHelper;
2223
import org.springframework.test.web.servlet.MvcResult;
2324
import org.springframework.test.web.servlet.ResultMatcher;
2425

2526
/**
26-
* Factory for assertions on the response content using <a
27-
* href="http://goessner.net/articles/JsonPath/">JSONPath</a> expressions.
28-
* An instance of this class is typically accessed via
29-
* {@link MockMvcResultMatchers#jsonPath}.
27+
* Factory for assertions on the response content using
28+
* <a href="https://github.com/jayway/JsonPath">JsonPath</a> expressions.
29+
* <p>An instance of this class is typically accessed via
30+
* {@link MockMvcResultMatchers#jsonPath(String, Matcher)} or
31+
* {@link MockMvcResultMatchers#jsonPath(String, Object...)}.
3032
*
3133
* @author Rossen Stoyanchev
3234
* @since 3.2
3335
*/
3436
public class JsonPathResultMatchers {
3537

36-
private JsonPathExpectationsHelper jsonPathHelper;
38+
private final JsonPathExpectationsHelper jsonPathHelper;
39+
3740

3841
/**
39-
* Protected constructor. Use
40-
* {@link MockMvcResultMatchers#jsonPath(String, Object...)} or
42+
* Protected constructor.
43+
* <p>Use {@link MockMvcResultMatchers#jsonPath(String, Object...)} or
4144
* {@link MockMvcResultMatchers#jsonPath(String, Matcher)}.
45+
* @param expression the {@link JsonPath} expression; never {@code null} or empty
46+
* @param args arguments to parameterize the {@code JsonPath} expression with,
47+
* using formatting specifiers defined in {@link String#format(String, Object...)}
4248
*/
4349
protected JsonPathResultMatchers(String expression, Object ... args) {
4450
this.jsonPathHelper = new JsonPathExpectationsHelper(expression, args);
4551
}
4652

53+
4754
/**
48-
* Evaluate the JSONPath and assert the value of the content found with the
49-
* given Hamcrest {@code Matcher}.
55+
* Evaluate the JSON path expression against the response content and
56+
* assert the resulting value with the given Hamcrest {@link Matcher}.
5057
*/
5158
public <T> ResultMatcher value(final Matcher<T> matcher) {
5259
return new ResultMatcher() {
@@ -59,7 +66,8 @@ public void match(MvcResult result) throws Exception {
5966
}
6067

6168
/**
62-
* Evaluate the JSONPath and assert the value of the content found.
69+
* Evaluate the JSON path expression against the response content and
70+
* assert that the result is equal to the supplied value.
6371
*/
6472
public ResultMatcher value(final Object expectedValue) {
6573
return new ResultMatcher() {
@@ -71,7 +79,11 @@ public void match(MvcResult result) throws Exception {
7179
}
7280

7381
/**
74-
* Evaluate the JSONPath and assert that content exists.
82+
* Evaluate the JSON path expression against the response content and
83+
* assert that a non-null value exists at the given path.
84+
* <p>If the JSON path expression is not {@linkplain JsonPath#isDefinite
85+
* definite}, this method asserts that the value at the given path is not
86+
* <em>empty</em>.
7587
*/
7688
public ResultMatcher exists() {
7789
return new ResultMatcher() {
@@ -84,7 +96,11 @@ public void match(MvcResult result) throws Exception {
8496
}
8597

8698
/**
87-
* Evaluate the JSON path and assert not content was found.
99+
* Evaluate the JSON path expression against the response content and
100+
* assert that a value does not exist at the given path.
101+
* <p>If the JSON path expression is not {@linkplain JsonPath#isDefinite
102+
* definite}, this method asserts that the value at the given path is
103+
* <em>empty</em>.
88104
*/
89105
public ResultMatcher doesNotExist() {
90106
return new ResultMatcher() {
@@ -97,7 +113,8 @@ public void match(MvcResult result) throws Exception {
97113
}
98114

99115
/**
100-
* Evluate the JSON path and assert the content found is an array.
116+
* Evaluate the JSON path expression against the response content and
117+
* assert that the result is an array.
101118
*/
102119
public ResultMatcher isArray() {
103120
return new ResultMatcher() {

spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ public boolean matches(Method method) {
196196
protected abstract T getMappingForMethod(Method method, Class<?> handlerType);
197197

198198
/**
199-
* Register a handler method and its unique mapping.
199+
* Register a handler method and its unique mapping. Invoked at startup for
200+
* each detected handler method.
200201
* @param handler the bean name of the handler or the handler instance
201202
* @param method the method to register
202203
* @param mapping the mapping conditions associated with the handler method
@@ -346,7 +347,7 @@ protected HandlerMethod lookupHandlerMethod(String lookupPath, HttpServletReques
346347
return bestMatch.handlerMethod;
347348
}
348349
else {
349-
return handleNoMatch(handlerMethods.keySet(), lookupPath, request);
350+
return handleNoMatch(this.handlerMethods.keySet(), lookupPath, request);
350351
}
351352
}
352353

0 commit comments

Comments
 (0)