Filling a Generalization Arrow with Black fill

0 votes
asked Jan 20, 2020 in Question / help by g.edward.roberts (480 points)
@startuml
class A <<stereotype>>
class B <<metaclass>>
A --|> B
@enduml

How does one fill the arrow with black to make it look like an extend?

1 Answer

0 votes
answered Jan 23, 2020 by zimchaa (1,040 points)

I think the extension arrow type is the 'unfilled' type (i.e. https://www.uml-diagrams.org/association.html?context=class-diagrams) but there are a couple of ways you can have a filled arrow as required:

@startuml
'left to right direction
skinparam shadowing<<stereotype>> false
skinparam shadowing<<metaclass>> false

note "__Extends__ arrow: simple" as notelabel_ab
notelabel_ab .. A
notelabel_ab .. B

class A <<stereotype>>
class B <<metaclass>>
A -|> B: extends

note "__Solid__ arrow: using the label on relations" as notelabel_cd
notelabel_cd .. C
notelabel_cd .. D

class C <<stereotype>>
class D <<metaclass>>
C - D: solid >

note "__Solid__ arrow: original style arrow type" as notelabel_ef
notelabel_ef .. E
notelabel_ef .. F

class E <<stereotype>>
class F <<metaclass>>
E -> F: solid
@enduml
Arrow formatting - Class diagram
commented Jan 23, 2020 by g.edward.roberts (480 points)
edited Jan 23, 2020 by g.edward.roberts

As to URLs... you need to look at https://www.uml-diagrams.org/profile-extension.html

what you have shown is a generalization... an extension is a specialization of an association... you can see this if you look at the UML 2.5.1 standard..  Fig. 12.12 in Section 12.3.2 page 253... you will see an example of the concrete syntax of a filled arrow head (triangular much like generalization) in fig 12.16 of that same standard

from 12.3.4 "The notation for an Extension is an arrow pointing from a Stereotype to the extended Class, where the arrowhead is shown as a filled triangle. An Extension may have the same adornments as an ordinary Association, but they are typically elided and navigability arrows are never shown. If isRequired = true, the adornment {required} is shown near
the ExtensionEnd."

None of what you have shown is per the standard... the first is a generalization... the second is a feature allowed by the standard from page 201

"On a binary Association drawn as a solid line, a solid triangular arrowhead next to or in place of the name of the Association and pointing along the line in the direction of one end indicates that end to be the last in the order of the ends of the Association. The arrow indicates that the Association is to be read as associating the end away from the direction of the arrow with the end to which the arrow is pointing"

the third is not a filled triangle per the standard...

...