title: MapStruct - How to set different null strategy for different mapping methods?
body: <p>I want to have a single <code>Mapper</code> class with both <code>create</code> and <code>update</code> methods. The generated code for create method is fine, but in case of update, I want to set the properties in the target, only if they are not null in the source.</p>
  
  <p>How do I do it with <code>mapStruct</code>? </p>
  
  <p>The confusion arises because the <code>nullValueMappingStrategy</code> is being defined at <code>Mapper</code> or <code>Mapping</code> level.</p>
  
  <p>If I set that value at <code>Mapper</code> level, it will be applied to all methods, including create and update.</p>
  
  <pre><code>@Mapper // If I define null strategy here, it will be applied to all methods
  public interface AmcPkgMapper {
  
      AmcPkgMapper MAPPER = Mappers.getMapper(AmcPkgMapper.class);
  
      AmcPackage create(AmcPackageRequest amcPackageRequest);
  
      // How to define the null strategy here??
      void update(AmcPackageRequest amcPackageRequest, @MappingTarget  AmcPackage amcPackage);
  
  }
  </code></pre>
  
  <p>And if I set it on the method with <code>Mapping</code>, then it expects me to define a <code>target</code> object, for which I probably need a wrapper object and somehow map all the internal properties inside that.</p>
  
  <pre><code>@Mapping(target = "amcPackage", nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
  void update(AmcPackageRequest amcPackageRequest, @MappingTarget AmcPackageWrapper amcPackageWrapper);
  </code></pre>
  
  <p>With the above method, the generated code looks as below, which isn't going inside <code>amcPackage</code> to set all properties.</p>
  
  <pre><code>@Override
  public void update(AmcPackageRequest amcPackageRequest, AmcPackageWrapper amcPackageWrapper) {
      if ( amcPackageRequest == null ) {
          return;
      }
  // nothing is mapped actually!!
  }
  </code></pre>
  
  <p>Is there a simple way to do it without creating separate mapper classes for create and update?</p>