java - 必须使用什么 UML 元素才能在类图上显示 JPMS 模块?

标签 java uml java-9 java-module

我试图在我的 UML 类图上显示两个 JPMS 模块以及它们内部的包和类。问题是我无法理解使用什么元素来显示模块。请帮忙。

最佳答案

在 UML 中:

组件

:见reference 1

Package is a namespace used to group together elements that are semantically related and might change together. It is a general purpose mechanism to organize elements into groups to provide better structure for system model.

reference 2 中:

Pretty much all UML elements can be grouped into packages. Thus, classes, objects, use cases, components, nodes, node instances etc. can all be organized as packages, thus enabling a manageable organization of the myriad elements that a real-world UML model entails.

组件:参见reference 3

A component is a class representing a modular part of a system with encapsulated content and whose manifestation is replaceable within its environment.

A component has its behavior defined in terms of provided interfaces and required interfaces (potentially exposed via ports).

Component serves as a type whose conformance is defined by these provided and required interfaces (encompassing both their static as well as dynamic semantics). One component may therefore be substituted by another only if the two are type conformant.


在 Java 9 中:

引用:书籍:Java 9 Modularity Revealed,Alexandru Jecan,2017 年,第 5 页

模块的特点:

Some of the characteristics of a module include the following:

  • A module must define interfaces for communication with other modules.
  • A module defines a separation between the module interface and the module implementation.
  • A module should present a set of properties that contain information.
  • Two or more modules can be nested together.
  • A module should have a clear, defined responsibility. Each function should be implemented by only one module.
  • A module must be able to be tested independently from other modules.
  • An error in a module should not propagate to other modules.


因此:
Java 9 JPMS 模块应由 UML 组件显示。我们不能使用 UML 包来建模 Java 9 模块。 UML 包用于对 Java 包建模。众所周知,Java 9 的包和模块之间存在巨大差异。

关于java - 必须使用什么 UML 元素才能在类图上显示 JPMS 模块?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48258875/

相关文章:

java - 线程 "main"java.lang.StackOverflowError actionListeners 中出现异常

java - 为什么Collection接口(interface)有equals()和hashCode()?

java - 我可以将 XInclude 与 Java 1.5 XML 属性一起使用吗?

uml - 我们可以在关联类和普通类之间进行关联吗?

c++ - 生成 C++ 代码的开源 UML 工具

java - AWS Neptune io.netty.handler.codec.CorruptedFrameException

java - 为什么未模块的 JAR 可以访问模块 JAR 的非公开包?

java - 如何使用 "-Xlog:heap*=debug" "-Xlog:gc*=debug"从 GC 正确读取日志的某些部分

java - 如何全局设置jdk.attach.allowAttachSelf = true

java - 使用 Visual Paradigm (VP UML) 类图表示 Java 中的方法重载