lombok.ToString 可以在不使用 callSuper 的情况下包含超类型中的字段吗?

Ole*_*Ole 6 java lombok

我有一个 AbstractJPA 实体,并且正在使用 Lombok 为所有子类生成 toString() 方法。我希望包含超类中的 field id,但我希望这样做,以便该字段看起来id是子类的一部分。例如,不要得到这个:

AggregatedSalesOrder(super=AbstractOCIDEntity(super=Entity of type com.example.domain.models.AggregatedSalesOrder with id: null), bucketIndex=null, quantity=null)
Run Code Online (Sandbox Code Playgroud)

我会得到:

AggregatedSalesOrder(id: null, bucketIndex=null, quantity=null)
Run Code Online (Sandbox Code Playgroud)

想法?

蒂亚,奥莱

Gon*_*nan 2

我知道这会在一百年后发生,你可能甚至不再使用 Java,但现在你可以用它来装饰类@ToString(callSuper = true),它也会输出超类中的字段。希望它对某人有用。