A sample of this can be found in the unit test ProcessorTestBean and is annotated as follows.
@PreAssignmentProcessor(processor = ConvertEmptyOrBlankStringsToDefault.class, paramString = "-1")
@CsvBindByName(column = "id")
private int beanId;
| Modifier and Type | Field and Description |
|---|---|
| pack-priv String |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public String | processString(String value)
Implements com. Method that contains the code that will transform a string into the value that will be validated and converted into the bean field. |
| public void | setParameterString(String value)
Implements com. This allows the validator extending |
| defaultValue | back to summary |
|---|---|
| pack-priv String defaultValue | |
| ConvertEmptyOrBlankStringsToDefault | back to summary |
|---|---|
| public ConvertEmptyOrBlankStringsToDefault() Default constructor | |
| processString | back to summary |
|---|---|
| public String processString(String value) Implements com. Doc from com. Method that contains the code that will transform a string into the value that will be validated and converted into the bean field.
| |
| setParameterString | back to summary |
|---|---|
| public void setParameterString(String value) Implements com. Doc from com. This allows the validator extending The data could be a default value or whatever the custom processor requires to convert the data. If the processor needs multiple parameters, then you will need to combine them into a single string using some sort of delimiter, say a comma, and parse them out using some library that allows you to parse such strings 😁. If the processor does not need a value then just create an empty method like the ConvertEmptyOrBlankStringsToNull processor used by the BeanFieldProcessorTest.
| |