plantuml-parser icon indicating copy to clipboard operation
plantuml-parser copied to clipboard

Displaying default constructors

Open cathylee12 opened this issue 2 years ago • 4 comments

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.

cathylee12 avatar May 11 '23 04:05 cathylee12

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

shuzijun avatar May 11 '23 05:05 shuzijun

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

cathylee12 avatar May 11 '23 15:05 cathylee12

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/

cathylee12 avatar May 11 '23 17:05 cathylee12

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

shuzijun avatar May 12 '23 03:05 shuzijun