是否有注释忽略映射将在 child class 中覆盖的特定抽象方法?

Is there an annotation to ignore mapping a specific abstract method that will be overridden in a child class?

我希望在 classes 层次结构中的许多方法上使用 mapstruct,但我需要一些更高级别的抽象方法不会被 mapstruct 自动映射,因为它们将具有完整的实现在 child class 中。有没有我在 mapstruct 文档中遗漏的注释?

//I did not place @Mapper here because there are no methods to create maps for in this class
public abstract class SuperParentMapper {

  //declaration I want mapstruct to ignore
  public abstract Hoopdy hangdyToHoopdy(Hangdy hangdy);

}

@Mapper(componentModel = "cdi")
public abstract class NextParentMapper extends SuperParentMapper {

  //declaration I also want mapstruct to ignore
  @Override
  public abstract Hoopdy hangdyToHoopdy(Hangdy hangdy);

  //There are some other methods in here that I do need mapstruct to implement

}

@Mapper(componentModel = "cdi")
public abstract class DatChildMapper extends NextParentMapper {

  @Override
  public Hoopdy hangdyToHoopdy(Hangdy hangdy){
    //actual implementation
  }

  //There are some other methods in here that I do need mapstruct to implement

}

我希望 child class(es) 成为实际的实现,但似乎 mapstruct 正在尝试为这些 parent class 自动创建代码es。我确定我遗漏了一些明显的东西,但我似乎无法仅使用 child 实现。在提到之前,我确实需要这些 parent classes 来拥有抽象方法,这样我就可以交出 parents 并从中访问这些方法。

对于可能会犯与我相同错误的任何人,请不要将@Mapper 放在中间层父 class 上。这就是问题所在。当我把它取出来时它生成得很好。