JMX 属性命名约定

发布于 2024-09-14 21:03:10 字数 627 浏览 3 评论 0原文

我注意到 JMX MBean 的约定似乎偏离了标准 Java Bean 属性模型,因为属性名称传统上以大写字母开头,即 PascalCase。

为了更清楚地解释这一点,我将从 JDK 中举一个例子(为了清楚起见,稍微删减了一些):

public interface MemoryMXBean {
    public int getObjectPendingFinalizationCount();

    public MemoryUsage getHeapMemoryUsage();

    public MemoryUsage getNonHeapMemoryUsage();

    public boolean isVerbose();

    public void setVerbose(boolean value);

}

并且公开的 Memory MXBean 具有属性 V erbose、H eapMemoryUsage 等.. 对于每个公开的 MBean 也是如此,并且在定义自己的 MBean 时您会收到相同的行为。

有谁知道这个约定/实施细节的起源? 我浏览了 JMX 规范,只发现了对属性名称区分大小写的传递引用,没有提到明确的约定。

I've noticed that the convention for JMX MBeans appears to deviate from the standard Java Bean property model in that the names for attributes will traditionally start with a capital letter, i.e. PascalCase.

To explain this a bit more clearly, I'll take an example from the JDK (chopped down a bit for clarity) :

public interface MemoryMXBean {
    public int getObjectPendingFinalizationCount();

    public MemoryUsage getHeapMemoryUsage();

    public MemoryUsage getNonHeapMemoryUsage();

    public boolean isVerbose();

    public void setVerbose(boolean value);

}

And the Memory MXBean exposed has attributes V erbose, H eapMemoryUsage etc..
This is also the case for every MBean exposed, and you receive the same behaviour when defining your own MBeans.

Does anyone know the origins of this convention / implementation detail?
I glanced through the JMX spec and only found a passing referencing to case sensitivity of attribute names, with no clear convention mentioned.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文