简体   繁体   中英

Hide Scala generated case class methods in the IntelliJ UML Diagram?

I have defined a case class SimpleChangeLog like so:

case class SimpleChangeLog(
  createdAt: Instant,
  createdBy: Member,
  updatedAt: Instant,
  updatedBy: Member,
)

Since it is a case class, Scala generates additional methods like apply and tupled behind the scenes automatically. This is great, because I don't have to see them and instead I can focus on the actual domain that SimpleChangeLog describes!

The only issue is when I want to visualize this using IntelliJ's UML Diagrams:

SimpleChangeLog 的 UML 图,以普通视图显示所有隐藏的案例类方法

Suddenly all of those automatically generated "hidden" methods are in plain view and not in a good way. They pollute the diagram with noise that is irrelevant to the actual SimpleChangeLog model.

How can I get IntelliJ's UML diagram to show my case class properties like createdBy but hide the automatically generated ones like tupled ?

I am fairly certain that this feature is not available as of IntelliJ IDEA 2022.1.1, built May 10, 2022

The only workaround I am aware of – which no doubt is impossible in most cases – is to use trait or class in place of a case class .

There is a ticket open on the IntelliJ Scala Plugin for adding this functionality.

If you too would like to see this feature added to IntelliJ, you can vote on that ticket.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM