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:
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.
Related
I am trying to generate a Doxygen documentation for my Python project.
It seems like Doxygen does not provide an overall class diagram of the project including Association. It shows only inheritance for a single file.
Is there is a way I can generate an overall class diagram in doxygen?
Thanks a lot!
Doxygen does not generate class diagrams that contain "association" arrows.
These are the diagram types and my experience with them (stemming from C++):
CLASS_DIAGRAMS: Seems to be an old Doxygen option, superseded by CLASS_GRAPH, which contains more information. CLASS_DIAGRAMS often just show the class without anything else in my output, which is superfluous.
CLASS_GRAPH: This is actually an inheritance diagram, not a full class diagram (internally, it even goes by the name "inherit graph"). It doesn't show a diagram at all if a class is not a derived class or base class.
COLLABORATION_GRAPH: Shows base class, membership and template relations. Doesn't show "inherited by" or "used by" relationships. For a leaf class, the inheritance diagram (CLASS_GRAPH) is just a part of the COLLABORATION_GRAPH.
TEMPLATE_RELATIONS: Shows template relations in a similar style as inheritance, which is helpful for code using template specialization instead of inheritance, e.g. CRTP.
As you have a python project, did you try out Sphinx? sphinx.ext.inheritance_diagram comes included with the sphinx-doc distribution but also does not show other types of relations than inheritance.
A web search turned out https://pypi.org/project/sphinx-pyreverse/ which might be what you're looking for. I did not try it out myself.
I have experience with StarUML and Jumli. At my current company we have a Professional license for EA 9.2.
When I design a program, I start with creating Use Cases. Then from every Use Case, I create a Sequence Diagram. And from the Sequence Diagrams, almost every Lifeline-object will become a class (and all messages will become a method). With StarUML and Jumli this wasn't a problem.
But I cannot find a way in EA to convert the Lifeline objects into classes.
I tried to read the help from Sparx, but to me it is not really helpful. Their 'tutorial' is not a tutorial, but actually just another help file with lots of blah blah.
Can anyone tell me how to do this? Or are there any really helpful links?
It IS possible, but only in one a bit hidden way. First I'll tell you about the alternative ways:
you have a conceptual error here. Timelines in Sequence diagram are not classes, but objects. So, they can't become classes.
Of course, a tool could have a function to create a class according to an object, as VP UML has. Obviously, EA has not such feature.
On the contrary, it is not a problem to drop a class on the sequence diagram to become a timeline. But EA has some conceptual problems with it, too. You have to make it an object here. Look also this.
On the other hand, there should be no problems to drop a timeline to the object diagram, but in EA it IS a problem - the object-timeline remains the timeline even on the Object diagram. That is obviously non-convenient and ununderstandable, but it is so. Obviously, it is one of these bugs that are called "features".
The same is behaviour of the timeline if we drop it on the Class Diagram. We even can't connect this object to a class by generalization - EA considers such connection as a rules breaking one.
And finally, how you CAN connect the timeline/object to a class. Right-click the timeline on the sequence diagram or its copy object on the class diagram. Go to Advanced. Choose Instance Classifier - the first menu item. There you can choose an existent class or even create a new one. And the object/timeline will belong to this very class.
You can't reach this feature from the Project Browser. It is obviously, another "feature" of the EA.
In a spec-adherent UML tool, one can assign classes (among other things) to a lifeline. I think that is why you are having difficulty converting lifelines into classes: they aren't the same kind of thing! Try creating classes first and assigning them to lifelines.
To transform sequence model into class model right-click on the package choose "Transform Current Package" => Check DDL => Select Transform
I hope this helps.
Regards,
Nabil
What is the reason why they decided not to implement enum type in Scala ? What are benefits of current language design (defining object and extending scala.Enumeration instead of creating new enum type ) ?
I don't see any reasonable benefits of Enumeration in it's current state and tend to think it is design flaw that scala community is trying to overcome. It is not easy, but I guess this is definitely will be done in next two major scala versions. In all scala code I've seen sealed object hierarchy was given a preference.
In Scala it's possible to use the annotation #BeanProperty to automatically generate getters and setters to a field.
How can I create my own annotation that behaves like that?
I'm interested in creating annotations that changes the source code, like #BeanProperty does.
As an example, how could I create an annotation that only generated get methods?
Thanks.
Two words: compiler plugin. It is not easy, and the documentation is sparse, but that is one way to do it.
Future versions of Scala will likely have macro support, which gives you much of the same flexability.
Good day, colleagues!
I've posted this question to Eclipse community forum of UML2Tools, but that forum is almost dead, so I post my question here:
How can I create several representations of the same class in the main window of UML2Tools?
I need this because if class has many connections with other classes(aggergations, associations, inheritance), diagram becomes very confusing.
So, in this case it's convenient to create "duplicate" of target class and make new connections on the "duplicate" class, assuming that target class has connections from both "original" and "duplicate" representation of the class.
In StarUML I can do such thing by just Copy+Paste. In UML2Tools Copy+Paste creates ANOTHER class with the same attributes. This is not what I want.
It is impossible to show different views of the same class inheritance, association and dependencies with UML2 tools.