开发者

Naming the member variable beginning with m_ conforms to javabean style?

Wondering if m_ naming 开发者_Python百科convention conforms to Javabean property style?


well, m_ comes from Microsoft standards, which is based on Hungarian Notation. So that naming pattern isn't recommended by Sun/Oracle.

That's not to say you can't use them in JavaBeans as, javabeans are all about the method signatures, not about the field names, so you can call fields whatever you like.


Well,You can name your Java bean member, using any naming convention. The name is not part of the contract that makes a class, Java Bean.

Your class needs a public contructor,all its properties should be accessible via get and set and the class needs to be serializable.

But then again, I would not suggest using the m_ naming convention. Java Beans convention are used by lots by Java tooling support and more importantly by frameworks like JSF and Web Services (for UI binding and xml marshaling respectively). So apart from confusing some Java developers, who needs to maintain your code, there is also a possibility that some tooling support might not work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜