Advanced ZenUML — creation in the parameter list

XiaoPeng
ZenUML
Published in
2 min readJul 27, 2019

--

How is A.method(new B()) parsed and rendered in ZenUML?

Parser

The following is the parse tree:

Note that new B() IS parsed as a creation expression. However, B is NOT considered as a participant.

Why are we treating it differently in the parse tree and the participant API?

In the parse tree it is easier to match new B() with the creation expression than treating it differently (such as match any non-special character). It is also helpful if in the future we want to apply styles on this expression.

In the meanwhile, we do not want to treat B as a participant (for the moment), as it is difficult to move the rendering of this expression to before calling A.method().

Render

In the render, however, we render the creation expression in the parameter list as a normal parameter (with getText() ).

--

--