I have a Spring MVC controller. And I have in the method 50 parameters. All of the parameters have very specific name, for example: FOO[]. I don't want write 50 parameters in the method signature like this:
@RequestMapping(value = "/test", method = RequestMethod.POST)
@ResponseBody
public String test(
@RequestParam(value = "FOO[]") String foo,
@RequestParam(value = "BAR[]") String bar,
// Other 48 parameters
)
{
return "test";
}
I want to map all the parameters on the one object, I mean, I want to write a simple bean class with getter/setter and use it like method parameter. But how can I set custom names to my class fields?
e.g.:
class FooBar {
@SomeAnnotation_for_binding_the_field_to_my_field_FOO[]
private String foo;
private String bar;
// Other 48 fields
// getters/setters
}