diff --git a/spring-context/src/main/java/org/springframework/format/datetime/joda/JodaTimeFormatterRegistrar.java b/spring-context/src/main/java/org/springframework/format/datetime/joda/JodaTimeFormatterRegistrar.java index d3e809afa4..0de963a704 100644 --- a/spring-context/src/main/java/org/springframework/format/datetime/joda/JodaTimeFormatterRegistrar.java +++ b/spring-context/src/main/java/org/springframework/format/datetime/joda/JodaTimeFormatterRegistrar.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,7 +54,7 @@ import org.springframework.format.annotation.DateTimeFormat.ISO; */ public class JodaTimeFormatterRegistrar implements FormatterRegistrar { - private static enum Type {DATE, TIME, DATE_TIME} + private enum Type {DATE, TIME, DATE_TIME} /** @@ -119,9 +119,9 @@ public class JodaTimeFormatterRegistrar implements FormatterRegistrar { * the {@link #setDateStyle(String) dateStyle} and * {@link #setUseIsoFormat(boolean) useIsoFormat} properties will be ignored. * @param formatter the formatter to use + * @since 3.2 * @see #setTimeFormatter * @see #setDateTimeFormatter - * @since 3.2 */ public void setDateFormatter(DateTimeFormatter formatter) { this.formatters.put(Type.DATE, formatter); @@ -133,9 +133,9 @@ public class JodaTimeFormatterRegistrar implements FormatterRegistrar { * the {@link #setTimeStyle(String) timeStyle} and * {@link #setUseIsoFormat(boolean) useIsoFormat} properties will be ignored. * @param formatter the formatter to use + * @since 3.2 * @see #setDateFormatter * @see #setDateTimeFormatter - * @since 3.2 */ public void setTimeFormatter(DateTimeFormatter formatter) { this.formatters.put(Type.TIME, formatter); @@ -148,9 +148,9 @@ public class JodaTimeFormatterRegistrar implements FormatterRegistrar { * the {@link #setDateTimeStyle(String) dateTimeStyle} and * {@link #setUseIsoFormat(boolean) useIsoFormat} properties will be ignored. * @param formatter the formatter to use + * @since 3.2 * @see #setDateFormatter * @see #setTimeFormatter - * @since 3.2 */ public void setDateTimeFormatter(DateTimeFormatter formatter) { this.formatters.put(Type.DATE_TIME, formatter); diff --git a/spring-context/src/main/java/org/springframework/format/datetime/standard/DateTimeFormatterRegistrar.java b/spring-context/src/main/java/org/springframework/format/datetime/standard/DateTimeFormatterRegistrar.java index 6cda2edd2a..3eecedcd89 100644 --- a/spring-context/src/main/java/org/springframework/format/datetime/standard/DateTimeFormatterRegistrar.java +++ b/spring-context/src/main/java/org/springframework/format/datetime/standard/DateTimeFormatterRegistrar.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,7 +50,7 @@ import org.springframework.lang.UsesJava8; @UsesJava8 public class DateTimeFormatterRegistrar implements FormatterRegistrar { - private static enum Type {DATE, TIME, DATE_TIME} + private enum Type {DATE, TIME, DATE_TIME} /** diff --git a/spring-test/src/main/java/org/springframework/test/web/servlet/result/JsonPathResultMatchers.java b/spring-test/src/main/java/org/springframework/test/web/servlet/result/JsonPathResultMatchers.java index 5e6459c4fb..574d21bf07 100644 --- a/spring-test/src/main/java/org/springframework/test/web/servlet/result/JsonPathResultMatchers.java +++ b/spring-test/src/main/java/org/springframework/test/web/servlet/result/JsonPathResultMatchers.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ package org.springframework.test.web.servlet.result; +import com.jayway.jsonpath.JsonPath; import org.hamcrest.Matcher; import org.springframework.test.util.JsonPathExpectationsHelper; @@ -23,30 +24,36 @@ import org.springframework.test.web.servlet.MvcResult; import org.springframework.test.web.servlet.ResultMatcher; /** - * Factory for assertions on the response content using JSONPath expressions. - * An instance of this class is typically accessed via - * {@link MockMvcResultMatchers#jsonPath}. + * Factory for assertions on the response content using + * JsonPath expressions. + *
An instance of this class is typically accessed via + * {@link MockMvcResultMatchers#jsonPath(String, Matcher)} or + * {@link MockMvcResultMatchers#jsonPath(String, Object...)}. * * @author Rossen Stoyanchev * @since 3.2 */ public class JsonPathResultMatchers { - private JsonPathExpectationsHelper jsonPathHelper; + private final JsonPathExpectationsHelper jsonPathHelper; + /** - * Protected constructor. Use - * {@link MockMvcResultMatchers#jsonPath(String, Object...)} or + * Protected constructor. + *
Use {@link MockMvcResultMatchers#jsonPath(String, Object...)} or
* {@link MockMvcResultMatchers#jsonPath(String, Matcher)}.
+ * @param expression the {@link JsonPath} expression; never {@code null} or empty
+ * @param args arguments to parameterize the {@code JsonPath} expression with,
+ * using formatting specifiers defined in {@link String#format(String, Object...)}
*/
protected JsonPathResultMatchers(String expression, Object ... args) {
this.jsonPathHelper = new JsonPathExpectationsHelper(expression, args);
}
+
/**
- * Evaluate the JSONPath and assert the value of the content found with the
- * given Hamcrest {@code Matcher}.
+ * Evaluate the JSON path expression against the response content and
+ * assert the resulting value with the given Hamcrest {@link Matcher}.
*/
public If the JSON path expression is not {@linkplain JsonPath#isDefinite
+ * definite}, this method asserts that the value at the given path is not
+ * empty.
*/
public ResultMatcher exists() {
return new ResultMatcher() {
@@ -84,7 +96,11 @@ public class JsonPathResultMatchers {
}
/**
- * Evaluate the JSON path and assert not content was found.
+ * Evaluate the JSON path expression against the response content and
+ * assert that a value does not exist at the given path.
+ * If the JSON path expression is not {@linkplain JsonPath#isDefinite
+ * definite}, this method asserts that the value at the given path is
+ * empty.
*/
public ResultMatcher doesNotExist() {
return new ResultMatcher() {
@@ -97,7 +113,8 @@ public class JsonPathResultMatchers {
}
/**
- * Evluate the JSON path and assert the content found is an array.
+ * Evaluate the JSON path expression against the response content and
+ * assert that the result is an array.
*/
public ResultMatcher isArray() {
return new ResultMatcher() {
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java
index 7055d3038c..6acaccfdcb 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java
@@ -196,7 +196,8 @@ public abstract class AbstractHandlerMethodMapping