JavaBean 属性命名约定在哪里定义? [英] Where is the JavaBean property naming convention defined?

查看:33
本文介绍了JavaBean 属性命名约定在哪里定义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Spring Framework API 文档说:

使用的约定是返回Class的不带大写的短名称,根据JavaBeans的属性命名规则:所以,com.myapp.Product变成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.

我查看了 Suns 的网站以找到定义,但没有找到.我想知道开头有多个大写字符的名称的规则.如果第二个字符也是大写,那么第一个字符也是大写是规则吗?

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 模板中使用.示例:类:SomeName --> 对象: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屋!

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