overhaul of support package arrangements for handler method processing; added missing package-info files
This commit is contained in:
@@ -14,25 +14,25 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.method.annotation.support;
|
||||
package org.springframework.web.bind;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.validation.ObjectError;
|
||||
|
||||
/**
|
||||
* Thrown when validation on an argument annotated with {@code @Valid} fails.
|
||||
*
|
||||
* Exception to be thrown when validation on an argument annotated with {@code @Valid} fails.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 3.1
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class MethodArgumentNotValidException extends Exception {
|
||||
|
||||
private final MethodParameter parameter;
|
||||
|
||||
private final BindingResult bindingResult;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor for {@link MethodArgumentNotValidException}.
|
||||
* @param parameter the parameter that failed validation
|
||||
@@ -47,23 +47,24 @@ public class MethodArgumentNotValidException extends Exception {
|
||||
* Return the method parameter that failed validation.
|
||||
*/
|
||||
public MethodParameter getParameter() {
|
||||
return parameter;
|
||||
return this.parameter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the results of the failed validation.
|
||||
*/
|
||||
public BindingResult getBindingResult() {
|
||||
return bindingResult;
|
||||
return this.bindingResult;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
StringBuilder sb = new StringBuilder("Validation failed for argument at index [")
|
||||
.append(parameter.getParameterIndex()).append("] in method: ")
|
||||
.append(parameter.getMethod().toGenericString())
|
||||
.append(", with ").append(bindingResult.getErrorCount()).append(" error(s): ");
|
||||
for (ObjectError error : bindingResult.getAllErrors()) {
|
||||
StringBuilder sb = new StringBuilder("Validation failed for argument at index ")
|
||||
.append(this.parameter.getParameterIndex()).append(" in method: ")
|
||||
.append(this.parameter.getMethod().toGenericString())
|
||||
.append(", with ").append(this.bindingResult.getErrorCount()).append(" error(s): ");
|
||||
for (ObjectError error : this.bindingResult.getAllErrors()) {
|
||||
sb.append("[").append(error).append("] ");
|
||||
}
|
||||
return sb.toString();
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.method.annotation.support;
|
||||
package org.springframework.web.method.annotation;
|
||||
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.core.MethodParameter;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.method.annotation.support;
|
||||
package org.springframework.web.method.annotation;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.method.annotation.support;
|
||||
package org.springframework.web.method.annotation;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.method.annotation.support;
|
||||
package org.springframework.web.method.annotation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.method.annotation.support;
|
||||
package org.springframework.web.method.annotation;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.method.annotation.support;
|
||||
package org.springframework.web.method.annotation;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.method.annotation.support;
|
||||
package org.springframework.web.method.annotation;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.method.annotation.support;
|
||||
package org.springframework.web.method.annotation;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.ui.Model;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.method.annotation.support;
|
||||
package org.springframework.web.method.annotation;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.method.annotation.support;
|
||||
package org.springframework.web.method.annotation;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.method.annotation.support;
|
||||
package org.springframework.web.method.annotation;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.method.annotation.support;
|
||||
package org.springframework.web.method.annotation;
|
||||
|
||||
import java.beans.PropertyEditor;
|
||||
import java.util.Collection;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.method.annotation.support;
|
||||
package org.springframework.web.method.annotation;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.web.bind.support.SessionStatus;
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
/**
|
||||
*
|
||||
* Support classes for annotation-based handler method processing.
|
||||
*
|
||||
*/
|
||||
package org.springframework.web.method.annotation;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
/**
|
||||
*
|
||||
* Common infrastructure for handler method processing, as used by
|
||||
* Spring MVC's <code>org.springframework.web.servlet.mvc.method</code> package.
|
||||
*
|
||||
*/
|
||||
package org.springframework.web.method;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
/**
|
||||
*
|
||||
* Generic support classes for handler method processing.
|
||||
*
|
||||
*/
|
||||
package org.springframework.web.method.support;
|
||||
|
||||
Reference in New Issue
Block a user