Affects: \5.1.8 Feature request: I would like to be able to use MatrixVariable to directly create a Pojo ex:
@GetMapping("/employee-skills/{id}")
public ResponseEntity<EmployeeSkillDTO> getEmployeeSkill(@MatrixVariable(pathVar = "id") EmployeeSkillId employeeSkillId) {
instead of
@GetMapping("/employee-skills/{id}")
public ResponseEntity<EmployeeSkillDTO> getEmployeeSkill(@MatrixVariable(pathVar = "id") Map<String, String> id) {
final ObjectMapper mapper = new ObjectMapper(); // jackson's objectmapper
final EmployeeSkillId employeeSkillId = mapper.convertValue(id, EmployeeSkillId.class);
Comment From: snicoll
Thanks for the suggestion but @MatrixVariable
(singular) injects a single value and the Map
type, as described in the Javadoc, is used when one wants to get all variables. As such, supporting multiple variables with a non-map type is making the semantic off and certainly harder to resonate about.
As you expose, it's easy to convert the map to a pojo.