【问题标题】:How to express the relationship between java.time.LocalDate, DateTimeFormatter, String with UML如何用UML表达java.time.LocalDate、DateTimeFormatter、String之间的关系
【发布时间】:2018-05-06 11:48:34
【问题描述】:

在 Java 8 中,java.time.LocalDate.format(DateTimeFormatter formatter) 返回一个 String,表示带有给定 formatterLocalDate;反过来,static 方法 java.time.LocalDate.parse(CharSequence text) 返回一个 LocalData 对象。

类图对象图似乎无法表达StringLocalDate之间的关系,因为无法指明是哪种方法相互调用返回。

我的问题是:LocalDate可以调用format获取String表示等是否可以表达LocalDate、DateTimeFormatter和String之间的关系?

【问题讨论】:

    标签: uml java-time


    【解决方案1】:

    您不能在静态类图中表达动态行为。您在这里唯一可以表达的是依赖关系。所以你会从LocalDateStringDateTimeFormatter 绘制一个依赖关系。

    要显示任何调用序列,您需要创建一个序列图。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多