https://github.com/origamidream/utils-binding-results
Simple utilities which provides functions handling BindingResult of Spring Framework.
https://github.com/origamidream/utils-binding-results
spring-boot spring-context utility-library validation
Last synced: about 2 months ago
JSON representation
Simple utilities which provides functions handling BindingResult of Spring Framework.
- Host: GitHub
- URL: https://github.com/origamidream/utils-binding-results
- Owner: OrigamiDream
- License: mit
- Created: 2019-01-21T07:33:10.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-02-02T20:35:09.000Z (over 2 years ago)
- Last Synced: 2025-03-24T16:48:45.809Z (over 1 year ago)
- Topics: spring-boot, spring-context, utility-library, validation
- Language: Java
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## BindingResult Utils
Provide methods for querying, removing, cleaning BindingResult.
#### Requires
- Spring Framework Environment
- JDK 8
#### Import / Injection
```java
import av.is.utils.bindingresults.BindingResultUtils;
@Component // Any streotype annotations of Spring Framework.
public class FooComponent {
private final BindingResultUtils bindingResultUtils;
@Autowired
public FooService(BindingResultUtils bindingResultUtils) {
this.bindingResultUtils = bindingResultUtils;
}
}
```
#### Documents
```java
/**
* Removes a specific error which defined in BindingResult.
*/
void removeError(BindingResult bindingResult, String field);
/**
* Remove a chunk of errors which defined in BindingResult.
*/
void removeErrors(BindingResult bindingResult, String... fields);
/**
* Clear all errors defined in BindingResult.
*/
void clearError(BindingResult bindingResult);
/**
* Checks which error has defined in BindingResult by error field.
*/
boolean hasError(BindingResult bindingResult, String field);
/**
* Get all errors which its field name equals to 'field'.
*/
List getErrorsByField(BindingResult bindingResult, String field);
/**
* Provides stream wrapper of method: getErrorsByField()
*/
Stream errorsByField(BindingResult bindingResult, String field);
```