Welcome to PlantUML Q&A, where you can ask questions and receive answers from other members of the community.

You can also submit new features request and vote for them.

How can nested classes/interfaces be represented?

0 votes

It's sometimes necessary to nest public interfaces inside other already public interfaces, but PlantUML will not include these in the generated diagrams; there also seems to be no way to do this manually. In my trivial example below, the Door interface will not be included as part of the UML diagram that's generated for the Car interface.

Is this simply impossible, or has it simply not been included as part of the most "common" or "frequent" use cases? I'd appreciate help on this. If it's impossible, can it be turned into a feature request?

__________

Example:

public interface Car {
    public interface Door {
        // Car.Door methods...
    }
    // Car methods ...
}

__________

Currently, my class/iface diagrams give the mistaken impression that nested classes/interfaces don't really exist in the project, but I need them to show up.

 

Also, is there a way to cause PlantUML to generate a single diagram with all the classes/interfaces of a whole project that actually works, especially without having to explicitly add stements to javadocs? The content I've come across produces results for single classes/ifaces separately, etc. and is not enough for what I need.

asked Feb 27 by anonymous
edited Feb 28

1 Answer

0 votes

I think that the right way to represent this is the following:



@startuml
interface Car {
    // Car methods ...
}
interface Car.Door {
    // Car.Door methods...
}
Car +-- Car.Door
@enduml


Does it sound good to you ?
BTW, I've got the feeling that you are using some plugin here. Eclipse? IntelliJ ? NetBeans ?

answered Feb 28 by plantuml (118,230 points)
It looks like the suggested diagram is what's used in most cases I've come across, so I'll rely on it for now. Also, you're correct in that I'm using a plugin; it's the Eclipse version. Any comments on processing a whole project into a single diagram?
I've created two request on Eclipse Plugin side.
See
https://github.com/hallvard/plantuml/issues/17
https://github.com/hallvard/plantuml/issues/18

About processing a whole project, I think it may be risky, because the diagram could be very large. PlantUML have sometimes issues with large diagrams.
Support This Project Offer 250 Mo! Follow PlantUML on Twitter
...