1.下载插件,搜uml找找就有了,安装重启idea。
2.会提示你找不到graphviz,下载msi安装。
3.提示not executable,需要配置环境变量,不是配置path,配置GRAPHVIZ_DOT=D:\Program Files\Graphviz2.38\bin\dot.exe
4.画图,参考:http://plantuml.com/class-diagram
关于工厂类OperationFactory的依赖指向,有的文章直接依赖于继承类,也就是OperationAdd这一些,个人觉着
这样并不能直观体验出继承的优点,而且继承类多了画的线也多,容易乱。
@startuml
abstract class Operation{
String numberA
String NumberB
double getResult()
}
class OperationAdd
class OperationDiv
class OperationMul
class OperationSub
class OperationFactory{
{static} Operation create()
}
class Main
Main..>OperationFactory
OperationFactory ..> Operation
Operation<|--OperationAdd
Operation<|--OperationSub
Operation<|--OperationMul
Operation<|--OperationDiv
@enduml