UML图中的私有嵌套Java类 [英] Private nested Java class in UML diagram

查看:243
本文介绍了UML图中的私有嵌套Java类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于UML的问题。我有一个类,它只包含一个带有私有访问修饰符的内部类 - 无法从其他任何地方访问...通常为了呈现内部类关系,我可以使用像这里的(+)关系( InnerOddIterator ):

I have a question regarding UML. I have a class which simply contains an inner class with the private access modifier - cannot be accessed from anywhere else... Normally in order to present an inner class relation I can use a (+) relation like here (InnerOddIterator):

(取自 http://www.uml-diagrams.org/nested-classifier.html

我还没有找到任何关于怎么可以的信息明确强调这个课程是私立的。你知道这种方法是否存在吗?如果是的话,我会很感激你在这里给我一些链接吗?

I have not found anywhere any information about how can clearly emphasize that this class is private. Do you know if such a method exist at all? If yes I'll be grateful you give me some link here or something?

为了保持清晰,示例代码:

Just to keep things clear, a sample code:

public class DataStrucure {
     // fields, methods, etc
     private class InnerOddIterator{
          // ... 
     };
}


推荐答案

从UML的角度来看。如果classifier(Class也)嵌套在其他类中,则嵌套类扮演命名空间的角色。在这种情况下,嵌套类在上下文命名空间中隐藏(私有)。这意味着,您的图表隐式定义了私有内部类定义。

From UML point of view. If classifier (Class also) is nested in other class, nesting class plays role of namespace. In this case nested classes are hidden (private) in context namespace. it means, your diagram implicitly defines private inner class definition.

这里是UML上层结构部分结构化分类器定义的一部分:

一个类充当其范围内定义的各种分类器的命名空间,包括类。
分类器的嵌套将分类器的可见性限制在范围内。包含类的名称空间,用于
信息隐藏的原因。嵌套分类器与包含类中的任何其他分类器一样使用。

"A class acts as the namespace for various kinds of classifiers defined within its scope, including classes. Nesting of classifiers limits the visibility of the classifier to within the scope of the namespace of the containing class and is used for reasons of information hiding. Nested classifiers are used like any other classifier in the containing class."

这篇关于UML图中的私有嵌套Java类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆