「VisualStudioCode/PlantUML」の版間の差分
提供: 初心者エンジニアの簡易メモ
(→PlantUMLのプラグイン) |
(→クラス図) |
||
行57: | 行57: | ||
@enduml | @enduml | ||
</pre> | </pre> | ||
+ | |||
+ | ==シーケンス図== | ||
+ | <pre> | ||
+ | @startuml | ||
+ | actor ユーザー | ||
+ | ユーザー -> "a HomeController" : access | ||
+ | activate "a HomeController" | ||
+ | "a HomeController" -->> ユーザー : rendering 検索ビュー | ||
+ | deactivate "a HomeController" | ||
+ | |||
+ | ユーザー -> "an ArticleSearchResultController" : キーワードを入力して送信 | ||
+ | activate "an ArticleSearchResultController" | ||
+ | "an ArticleSearchResultController" -> "an ArticleSearcher" : search(keyword) | ||
+ | |||
+ | activate "an ArticleSearcher" | ||
+ | "an ArticleSearcher" -> "an ArticleSearcher" : validates | ||
+ | "an ArticleSearcher" -->> "an ArticleSearchResultController" : IllegalArgumentException | ||
+ | |||
+ | "an ArticleSearchResultController" -> "a HomeController" : redirect | ||
+ | note bottom : 「キーワードを入力してください」メッセージ | ||
+ | |||
+ | "an ArticleSearcher" -> "an Article Class" : query | ||
+ | activate "an Article Class" | ||
+ | "an Article Class" -->> "an ArticleSearcher" : return Article::ActiveRecordRelation | ||
+ | deactivate "an Article Class" | ||
+ | "an ArticleSearcher" -->> "an ArticleSearchResultController" : return Article::ActiveRecordRelation | ||
+ | deactivate "an ArticleSearcher" | ||
+ | |||
+ | "an ArticleSearchResultController" -> "an Article::ActiveRecordRelation" : order(publish_date: desc) | ||
+ | activate "an Article::ActiveRecordRelation" | ||
+ | deactivate "an Article::ActiveRecordRelation" | ||
+ | |||
+ | "an ArticleSearchResultController" -> "an Article::ActiveRecordRelation" : page(0) | ||
+ | activate "an Article::ActiveRecordRelation" | ||
+ | deactivate "an Article::ActiveRecordRelation" | ||
+ | |||
+ | "an ArticleSearchResultController" -->> ユーザー : rendering | ||
+ | deactivate "an ArticleSearchResultController" | ||
+ | @enduml | ||
+ | </pre> | ||
+ | |||
+ | 参考:https://zenn.dev/kitabatake/articles/006ca2947f309a074939 | ||
==関連== | ==関連== | ||
[[Android/開発環境/AndroidStudio/UMLクラス図]] [ショートカット] | [[Android/開発環境/AndroidStudio/UMLクラス図]] [ショートカット] |
2024年10月31日 (木) 16:46時点における版
PlantUMLのプラグイン
- DL(https://marketplace.visualstudio.com/items?itemName=jebbs.plantuml)
- Installボタンを押す
- codeエディタでクラス図を記述
- code上プレビューするoption+d
クラス図
クラス図基本
class.pu
@startuml class Enemy { + string type ~ string name # void SayHello() - void Attack() } @enduml
参考:https://gist.github.com/yoggy/bd68b3f1f55dbd742bea71424ca66564
クラス図関連系
relation.pu
@startuml Cat --|> Animal : 継承 Wheel "4" --* "1" Car : コンポジション Employee "many" --o "1" Company : 集約 Car -- VehicleInspection : 関連 UseCase ..|> IUseCase: 実現 Runner ..> Marathon : 依存 interface IUseCase abstract class Human @enduml
参考:https://qiita.com/opengl-8080/items/98c510b8ca060bdd2ea3
クラス図コメントなど
@startuml title タイトルです ' クラスAnimalの定義 class Animal { +int foot +void call() } note right of Animal { 基底クラス } ' クラス間の関係 Cat --|> Animal : 継承 @enduml
シーケンス図
@startuml actor ユーザー ユーザー -> "a HomeController" : access activate "a HomeController" "a HomeController" -->> ユーザー : rendering 検索ビュー deactivate "a HomeController" ユーザー -> "an ArticleSearchResultController" : キーワードを入力して送信 activate "an ArticleSearchResultController" "an ArticleSearchResultController" -> "an ArticleSearcher" : search(keyword) activate "an ArticleSearcher" "an ArticleSearcher" -> "an ArticleSearcher" : validates "an ArticleSearcher" -->> "an ArticleSearchResultController" : IllegalArgumentException "an ArticleSearchResultController" -> "a HomeController" : redirect note bottom : 「キーワードを入力してください」メッセージ "an ArticleSearcher" -> "an Article Class" : query activate "an Article Class" "an Article Class" -->> "an ArticleSearcher" : return Article::ActiveRecordRelation deactivate "an Article Class" "an ArticleSearcher" -->> "an ArticleSearchResultController" : return Article::ActiveRecordRelation deactivate "an ArticleSearcher" "an ArticleSearchResultController" -> "an Article::ActiveRecordRelation" : order(publish_date: desc) activate "an Article::ActiveRecordRelation" deactivate "an Article::ActiveRecordRelation" "an ArticleSearchResultController" -> "an Article::ActiveRecordRelation" : page(0) activate "an Article::ActiveRecordRelation" deactivate "an Article::ActiveRecordRelation" "an ArticleSearchResultController" -->> ユーザー : rendering deactivate "an ArticleSearchResultController" @enduml
参考:https://zenn.dev/kitabatake/articles/006ca2947f309a074939
関連
Android/開発環境/AndroidStudio/UMLクラス図 [ショートカット]