Configures the SubclassMappings of several subclasses.

TIP: When using java 8 or later, you can omit the @SubclassMappings Wrapper annotation and directly specify several @SubclassMapping annotations on one method.

These two examples are equal.


 // before java 8
 @Mapper
 public interface MyMapper {
     @SubclassMappings({
         @SubclassMapping(source = FirstSub.class, target = FirstTargetSub.class),
         @SubclassMapping(source = SecondSub.class, target = SecondTargetSub.class)
     })
     ParentTarget toParentTarget(Parent parent);
 }
 

 // java 8 and later
 @Mapper
 public interface MyMapper {
     @SubclassMapping(source = First.class, target = FirstTargetSub.class),
     @SubclassMapping(source = SecondSub.class, target = SecondTargetSub.class)
     ParentTarget toParentTarget(Parent parent);
 }
 
Since:
1.5
Author:
Ben Zegveld
  • Required Element Summary

    Required Elements

    The subclassMappings that should be applied.

  • Element Details

    • value

      The subclassMappings that should be applied.

      Returns:
      the subclassMappings to apply.