lunes, 25 de noviembre de 2019

Class Relationship UML (PlantUML)

Class Relationship UML (PlantUML)

UML   Unified Model Language

https://plantuml.com/es/class-diagram

PlantUML uses Graphviz as library to get work.

 Relations

@startuml

Class01 <|-- Class02:extends
Class03 <|.. Class04:implements
@enduml

@startuml

ClassA <-- ClassB:Association
ClassC <|-- ClassD:Inheritance
ClassE <|.. ClassF:"Realization/\nImplementation"
ClassG <.. ClassH:"Dependency"
ClassI o-- ClassJ:"Aggregation"
ClassK *-- ClassL:"Composition"
@enduml



@startuml

ClassE <|.. ClassF:"Implementation"
ClassA --> ClassB:"Association"
ClassC ..> ClassD:"Dependency"
ClassG <.. ClassH:"Dependency"
ClassI ..|>  ClassJ:"Implementation"

@enduml



@startuml

ClassA #-- ClassB
ClassC x-- ClassD
ClassE }-- ClassF
ClassG +-- ClassH
ClassI ^-- ClassJ
ClassParent --> ClassParent
@enduml


@startuml

Bank <--  Account:"registrer"

OrderItem "0..*" --> "1" Item:refers
_OrderItem "0..*" <-- "1" _Item:describes
Class OrderItem_ {
 List<Item> item
}
@enduml



Aggregation


@startuml

Group "1" o--> "0..*" Person
Class ClassGroup {
     // Aggregation
    List<ClassPerson> person
    addPerson( Person person)
    { person.add( person); }
}
@enduml



 Composition


@startuml
House "1" *--> "has 1..*" Room
Class ClassHouse {
     // Composition
    List<ClassRoom> room
    addRoom()
    { room.add( new ClassRoom()) ; }
}

class Car
Driver - Car : drives >
Car *-- Wheel : have 4 >
Car -- Person : < owns

@enduml




Practical Example of Log4J2 Architecture

@startuml
interface Configuration
interface "Filter"
interface " Filter"
interface "  Filter"

interface Logger
interface Appender

interface Layout
interface StrLookup
interface LogEvent


class StrSubstitutor

class LoggerContext

interface Logger
class LoggerConfig


LoggerContext "1" -> "1" Configuration:has active
LoggerContext "1" o--> "0..*" Logger:contains

Logger "0..*" -> "1" LoggerConfig:asociates
Configuration "1" -> "1" StrSubstitutor:references

Configuration "1" o--> "1..*" LoggerConfig:contains
Configuration "1" o-up-> "0..*" "  Filter":contains

StrSubstitutor "1" o-up-> "1..*" StrLookup:"evaluate variables"
LoggerConfig "0..*" -right-> "0..*" Appender:contains
LoggerConfig "1" o--> "0..*" Filter:contains

Appender "1" o--> "0..*" " Filter":contains
Appender - Layout:asociates
Appender --> LogEvent:deliver

LogEvent <-down- Layout:format

Filter --() LogEvent:filters
" Filter" --() LogEvent:filters
"  Filter" -() LogEvent:filters


enum StandardLevel {
ALL
TRACE
DEBUG
INFO
WARN
ERROR
FATAL
OFF
}

@enduml


An Activity example

@startuml

:Application to be logged;
startpartition Configuration

fork

:Log4J2 Events;
partition Filter {
:status="FATAL"]
}
fork againpartition Properties {
:filename=target/test.log]
}
:App LogEvent;
partition "Filter 1 (type, level)" {
}
partition "Filter ...N (type, level)" {
}

end forkpartition Appenders {
 note :Appender1 type, name..\n  Layout..\n  Filter..\nAppender..N type, name..\n  Layout..\n  Filter..
}

forkpartition "logger Root: level" {
note right: refers to appender
:appenderRef 1->;
:"appenderRef ..N"->;
}

fork againpartition "logger1 name, level" {
:appenderRef 1->;
:appenderRef ..N"->;
}
fork againpartition "logger..N name, level"{
:appenderRef 1->;
:appenderRef ..N"->;

}
end forkstop@enduml



eot

No hay comentarios:

Publicar un comentario