title: Mapstruct: How to default a target String to Empty String when the Source is Null (Both fields have the same name and type) Java / Spring
body: <p>I have two Objects Source and Target both with the same field names and types.</p>
  
  <p>If a source field is null I would like the target to be "" (Empty String)</p>
  
  <p>My Interface mapping looks like this (This is just two field, I have many)</p>
  
  <pre><code>@Mapper(componentModel = "spring", nullValueMappingStrategy = NullValueMappingStrategy.RETURN_DEFAULT)
  public interface MyMapper {
  
  @Mappings({
      @Mapping(target="medium", defaultExpression="java(\"\")"),
      @Mapping(target="origin", defaultExpression="java(\"\")")
   }) 
  public Target mapFrom(Source source)
  
  </code></pre>
  
  <p>If the Source has a value it should be copied across, if it is null in the source it should be "" in the target.</p>
  
  <p>Mapstruct-1.3.0 seems to just keep everything null.</p>
  
  <p>Any Idea? I would like default to be empty String for everything</p>