title: How to use MapStruct for different data types?
body: <p>I have two types of data that I want to map:</p>
  
  <p><strong>SignUpUserDto:</strong></p>
  
  <pre><code>public class SignUpUserDto {
      private String firstName;
      private String lastName;
      private String username;
      private String email;
      private String password;
      private String title;
  }
  </code></pre>
  
  <p><strong>SignUpUser:</strong></p>
  
  <pre><code>@Entity
  public class SignUpUser {
      private Long id;
      private String firstName;
      private String lastName;
      private String username;
      private String email;
      private String password;
      private Title title;
  }
  </code></pre>
  
  <p><strong>Title:</strong></p>
  
  <pre><code>public enum Title {
      JUNIOR("junior"),
      MIDDLE("middle"),
      SENIOR("senior"),
      MANAGER("manager");
  
      private final String title;
  
      Title(final String title) {
          this.title = title;
      }
  
      public String toString() {
          return this.title;
      }
  }
  </code></pre>
  
  <ul>
  <li><p>For <strong>DTO</strong> title member is a <strong>String</strong>.</p></li>
  <li><p>For <strong>entity</strong> title member is a <strong>Title</strong>.</p></li>
  </ul>
  
  <p>How should the mapper looks like?</p>
  
  <p>Should I pass title already converted in <strong>Service</strong>?</p>
  
  <pre><code>@Mapper(componentModel = "spring")
  public interface SignUpUserMapper {
      SignUpUserMapper INSTANCE = Mappers.getMapper(SignUpUserMapper.class);
      @Mapping(target = "title", expression = "title")
      public SignUpUserDto signUpUserToSignUpUserDto(SignUpUser signUpUser, String title);
      @Mapping(target = "title", source = "title")
      public SignUpUser signUpUserDtoToSignUpUser(SignUpUserDto signUpUserDto, Title title);
  }
  </code></pre>
  
  <p>Or should I do conversion in <strong>Mapper</strong>?</p>
  
  <pre><code>@Mapper(componentModel = "spring",  imports = Title.class)
  public interface SignUpUserMapper {
      SignUpUserMapper INSTANCE = Mappers.getMapper(SignUpUserMapper.class);
      @Mapping(target = "title", expression = "java(signUpUser.getTitle().toString())")
      public SignUpUserDto signUpUserToSignUpUserDto(SignUpUser signUpUser);
      @Mapping(target = "title", source = "java(new Title(signUpUserDto.getTitle()))")
      public SignUpUser signUpUserDtoToSignUpUser(SignUpUserDto signUpUserDto);
  }
  </code></pre>