Java中的公共接口和已发布接口有什么区别? [英] What's the difference between public interfaces and published interfaces in Java?

查看:137
本文介绍了Java中的公共接口和已发布接口有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已阅读这两页

  • http://martinfowler.com/ieeeSoftware/published.pdf
  • http://lambda-the-ultimate.org/node/1400

但我仍然没有区分已发布和公开的方法。 Java中的一个例子会有所帮助。提前致谢。

but I still don't get the difference between a published and public method. An example in Java would be helpful. Thanks in advance.

推荐答案

公开

用Java编写的公共接口:

Public interfaces written in Java:

    interface MyInterface { ... }

    public interface MyInterface { ... }

    class MyClass() {
        void anotherInterface() { ... }
        public void someOtherInterface() { ... }
    }

所有这些都是公开的,因为它们不仅可用于内部对象。

All of them are public because they are not only available for internal objects.

已发布

已发布界面的状态不是Java的一部分语言,它是一些人可能称之为应用程序架构的一部分。它处于更高的抽象层次。

The status of published interface is not part of the Java language, it is part of what some may call application architecture. It is in a higher level of abstraction.

现在,两者之间的关系:

Now, the relationship between the two:


  • 每个已发布的界面都是公共界面。

  • 并非每个公共界面都是已发布的界面。

注意:这个概念不仅仅适用于Java接口,也可能是类,方法等。

Note: The concept does not apply literally to only Java interfaces, it could also be class, methods etc.

To深入挖掘:公共与已发布的
接口

这篇关于Java中的公共接口和已发布接口有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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