puml

package
v0.12.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2023 License: AGPL-3.0 Imports: 6 Imported by: 3

Documentation

Overview

Package puml provides generators for PlantUML files from [qb]MDD models.

Index

Constants

View Source
const (
	MixAggregation    = "o--"
	MixDependency     = "..>"
	MixContainment    = "+--"
	MixImplementation = "..|>"

	DeriveUML = "/ "
	DeriveCog = "<&cog> "
)
View Source
const DefaultClassPreamble = `hide empty attributes
hide empty methods
hide circle
`
View Source
const DefaultPackagePreamble = `hide empty attributes
hide empty methods
hide circle
`

Variables

View Source
var DefaultClassDiagram = ClassDiagram{
	Preamble:         DefaultClassPreamble,
	EnumLiteralLimit: 5,
	ShowAttributes:   OwnAtts,
	MixinRelation:    MixDependency,
	DeriveSymbol:     DeriveUML,
}
View Source
var DefaultPackageDiagram = PackageDiagram{
	Preamble: DefaultPackagePreamble,
}
View Source
var PUMLTag pumlTag

Functions

func WriteClassDia

func WriteClassDia(w io.Writer, m *mdd.Model, imageFile string) error

func WritePackageDia added in v0.8.0

func WritePackageDia(w io.Writer, m *mdd.Model, imageFile string) error

Types

type Attribute

type Attribute struct{ Inline bool }

func (Attribute) Tags added in v0.12.0

func (Attribute) Tags(t mdd.Taggable) bool

type AttributeDisplay added in v0.11.5

type AttributeDisplay uint
const (
	// Classes show their own attributes
	OwnAtts AttributeDisplay = (1 << iota)

	// Classes show attributes received from mixins
	MixedAtts
)

type Class added in v0.12.0

type Class struct{ InlineAsBase bool }

func (Class) Tags added in v0.12.0

func (Class) Tags(t mdd.Taggable) bool

type ClassDiagram

type ClassDiagram struct {
	Preamble         string
	EnumLiteralLimit int
	ShowAttributes   AttributeDisplay
	MixinRelation    string
	DeriveSymbol     string
	Focus            *mdd.Package

	AtomName        func(mdd.Name) string
	EnumName        func(mdd.Name) string
	EnumLiteralName func(mdd.Name) string
	AttributeName   func(mdd.Name) string
	AssociationName func(mdd.Name) string
	AssocEndName    func(mdd.Name) string
	KeyName         func(mdd.Name) string
	// contains filtered or unexported fields
}

ClassDiagram is used to create PlantUML class diagram files from an mdd.Model. In some respects, UML is used somewhat loosely to accommodate the specific semantics of [qb]MDD.

  • Composition associations are solely used for attributes of class types. To remove clutter from a diagram it is possible to force to inline such attributes using the PUMLTag with an Attribute value.

  • mdd.Associations are never shown as aggregation or composition its always a plain association.

  • Mixed in classes are linked from the receiver as a Containment. Hopefully, this deviation from UML is noticeable enough to allow the viewer to take a closer look. In my opinion, other representations run the risk of being overlooked. This can be customized with ClassDiagram.MixinRelation.

  • Embedded attributes of class or enum types are highlighted with special symbols so that a reader is aware that the type is present as its own symbol somewhere on the diagram.

  • Keys have a special notation and a separate compartment to be able to show more than one key per class.

func (*ClassDiagram) Write

func (dia *ClassDiagram) Write(w io.Writer, m *mdd.Model, imageFile string) error

type PackageDiagram added in v0.8.0

type PackageDiagram struct {
	Preamble     string
	CoreConcepts bool
	// contains filtered or unexported fields
}

func (*PackageDiagram) Write added in v0.8.0

func (dia *PackageDiagram) Write(w io.Writer, m *mdd.Model, imageFile string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL