I can't figure out how to map this exactly. I need the one to be String and the other one to be object, so I can't unfortunately make it easier for myself.
I have a RqgisterRequest class:
public class RegisterRequest {
private String firstName;
private String lastName;
private String email;
private String password;
private Set<String> roles;
Here is my register method with Instance
@PostMapping("/register")
public HttpEntity authenticate(@Valid @RequestBody RegisterRequest registerRequest) {
// create new user account
User user = UserMapper.INSTANCE.registerRequestoUser(registerRequest);
etc..
Here is my userDTO
@Data
@NoArgsConstructor
@AllArgsConstructor
public abstract class UserDTO extends BaseDTO {
@JsonProperty("first_name")
private String firstName;
@JsonProperty("last_name")
private String lastName;
@JsonProperty("email")
private String email;
@JsonProperty("password")
private String password;
private Set<Role> roles;
private Set<Appointment> appointments;
(my user entity is the same)
Here is my UserMapper class:
User registerRequestoUser(RegisterRequest registerRequest);
And lastly the error I have when trying to run the program: Error:(20, 11) java: Can't map property "java.util.Set roles" to "java.util.Set roles". Consider to declare/implement a mapping method: "java.util.Set map(java.util.Set value)".
How should I tackle this problem?