在AS中利用plantuml
插件创建puml文件
@startuml
scale 1.5
skinparam class {
backgroundColor lightskyblue
FontColor green
' fontsize 30
' attributeFontSize 20
ArrowColor Olive
bordercolor DarkSlateGray
backgroundColor<<test>> YellowGreen
}
skinparam title {
borderRoundCorner 15
bordercolor red
borderThickness 2
backgroundColor Aqua-CadetBlue
}
skinparam roundcorner 10
'skinparam monochrome true
'skinparam classFontColor red
'skinparam classFontSize 10
skinparam backgroundColor #EEEBDC
skinparam handwritten true
title UML类图实例
abstract class Animal <<动物>> {
+life(有生命)
--
//新陈代谢
+ void metabolism(Water water, OxygenGas o)
//繁殖
+ void breed()
}
class Water
class OxygenGas
class Brid{
//羽毛
- feather
//翅膀
- Wing[] wings
--
//下蛋
+layEggs()
}
class Wing
class WildGoose<<大雁>>{
--
//下蛋
+layEggs()
+fly()
}
interface Flight{
fly()
}
class Duck{
+layEggs()
}
class Penguin<<企鹅>>{
+layEggs()
}
class Climate<<气候>>
class GooseGroup{
- WildGoose[] wildGooseArr
}
class DonaldDuck<<唐老鸭>>{
+ speak()
}
Animal .left.> Water : 依赖
Animal .left.> OxygenGas : 依赖
Brid -up-|> Animal : 继承
Brid "1"*-right-> "2" Wing : 组合
WildGoose -up-|> Brid
WildGoose .down.|> Flight : 实现接口
Duck -up-|> Brid
Penguin -up-|> Brid
Penguin -right-> Climate : 关联关系
DonaldDuck --up|> Duck
WildGoose o--> GooseGroup : 聚合
skinparam NoteFontSize 20
note "A 为抽象类 \nI 为接口 \nC为类" as N1
@enduml