JMX 属性命名约定
我注意到 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论