Skip to content
This repository was archived by the owner on Dec 15, 2018. It is now read-only.

Commit 19bf459

Browse files
committed
Implementation of BindingError#getSubmittedValue
1 parent 9e7542c commit 19bf459

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

core/src/main/java/org/mvcspec/ozark/binding/BindingErrorImpl.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@ public class BindingErrorImpl implements BindingError {
2828

2929
private String paramName;
3030

31-
public BindingErrorImpl(String message, String paramName) {
31+
private String submittedValue;
32+
33+
public BindingErrorImpl(String message, String paramName, String submittedValue) {
3234
this.message = message;
3335
this.paramName = paramName;
36+
this.submittedValue = submittedValue;
3437
}
3538

3639
@Override
@@ -50,4 +53,9 @@ public String getParamName() {
5053
public void setParamName(String paramName) {
5154
this.paramName = paramName;
5255
}
56+
57+
@Override
58+
public String getSubmittedValue() {
59+
return submittedValue;
60+
}
5361
}

core/src/main/java/org/mvcspec/ozark/binding/convert/MvcConverterProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public T fromString(String value) {
7474

7575
// register possible errors in BindingResult
7676
result.getError()
77-
.map(error -> new BindingErrorImpl(error, getParamName(annotations)))
77+
.map(error -> new BindingErrorImpl(error, getParamName(annotations), value))
7878
.ifPresent(bindingError -> bindingResult.addBindingError(bindingError));
7979

8080
// always return a value so JAX-RS continues processing the request

0 commit comments

Comments
 (0)