shuzijun / plantuml-parser

Convert the Java(or kotlin) source code to Plantuml
https://plugins.jetbrains.com/plugin/15524-plantuml-parser
Apache License 2.0
114 stars 27 forks source link

Displaying default constructors #21

Open cathylee12 opened 1 year ago

cathylee12 commented 1 year ago

I would like to display the default constructors in the diagram, as well, for the consistency. If you agree, I can try to add the feature.

shuzijun commented 1 year ago

Is there an example to illustrate this function? Currently, constructors are supported.

cathylee12 commented 1 year ago

Yes, so for example, in ExampleConstructor class, if I don't explicitly declare public ExampleConstructor(), <\> ExampleConstructor() does not show up in the diagram.

cathylee12 commented 1 year ago

I compared with two different source code, one with the declaration of the constructor and one without it.

package example;

public class ExampleClass {

}
package example;

public class ExampleClassWithConstructor {

  public ExampleClassWithConstructor() {
  }

}

The diagram output is like this.

@startuml
class example.ExampleClass {
}
class example.ExampleClassWithConstructor {
+ <<Create>> ExampleClassWithConstructor()
}
@enduml

Here is the link describing a default constructor. https://www.scaler.com/topics/default-constructor-in-java/

shuzijun commented 1 year ago

Ok, but please make it optional. eg: https://github.com/shuzijun/plantuml-parser/blob/422af2d91c620aabaed076b3d512add43ababb28/plantuml-parser-core/src/main/java/com/shuzijun/plantumlparser/core/ParserConfig.java#LL34C21-L34C37