Reputation: 933
I want to write an annotation with members in PlantUML. Specifically, I want to describe this Java code in PlantUML:
public @interface Foo {
String bar();
String baz();
}
I tried to write it in PlantUML, but it causes syntax error:
@startuml
annotation Foo {
String bar()
String baz()
}
@enduml
However, it's working when I omit the members:
@startuml
annotation Foo
@enduml
What should I do? Thanks.
Upvotes: 2
Views: 1870
Reputation: 933
It's possible to write annotations with members now: http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuKhCoyilIIp9pCzJSClFLwZcKW22u9AYpBnqXQJ48WrDL84ge40jbqDgNWfGCm00
According to the comment, it's available starting at version V1.2020.2.
Upvotes: 1
Reputation: 14630
In PlantUML, annotations can not have members (hence the syntax error).
To display a UML diagram for your code, you will need to use another solution, like adding the annotation as a separate entity:
@startuml
annotation interface
class Foo {
String bar();
String baz();
}
interface -- Foo
@enduml
Or include the annotation in the class name definition:
@startuml
class "@interface Foo" as Foo {
String bar();
String baz();
}
@enduml
Upvotes: 0