JavaBean属性命名约定在哪里定义? [英] Where is the JavaBean property naming convention defined?
问题描述
Spring Framework API doc说:
使用的约定是返回非大写的短名称Class,根据JavaBeans属性命名规则:所以,com.myapp.Product成为产品; com.myapp.MyProduct成为myProduct; com.myapp.UKProduct成为UKProduct。
The convention used is to return the uncapitalized short name of the Class, according to JavaBeans property naming rules: So, com.myapp.Product becomes product; com.myapp.MyProduct becomes myProduct; com.myapp.UKProduct becomes UKProduct.
我看了太阳网站找到了一个定义,但没找到。我想知道在开头有一个以上大写字符的名字的规则。如果第二个字符也是大写的话,第一个字符是大写的规则是吗?
I looked at Suns website to find a definition, but didn't find one. I wonder about a rule for names with more than one upper case character at the beginning. Is the rule that the first character is upper case if the second character is upper case too?
背景是,我想自动生成变量名以便在HTML中使用模板取决于对象的类型。示例:class:SomeName - > object:someName。
The background is, that I want to generate variable names automatically for use in HTML templates depending on the type of the object. Example: class: SomeName --> object: someName.
推荐答案
http://download.oracle.com/otndocs/jcp/7224-javabeans-1.01-fr- spec-oth-JSpec /
http://www.oracle.com/technetwork/java/javase/tech/index-jsp-138795.html
此外,直接链接到(PDF)规范。
链接文档中的第8.8节标题为推断名称的大写并简要概述了属性名称的推导方式。
Section 8.8 in the linked document is entitled "Capitalization of inferred names" and briefly outlines how names of properties are derived.
这篇关于JavaBean属性命名约定在哪里定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!