Java方法命名约定

时间:2010-10-21 23:27:03

标签: java naming-conventions javabeans

我在Bean类中有一个名为showLabels的布尔字段,我想为它提供getter和setter方法。设置器将为setShowLabels,但吸气器应为isShowingLabelsisShowLabels(听起来真的很奇怪),还是setShowLabels

1 个答案:

答案 0 :(得分:8)

isShowLabels可能听起来很奇怪,that's the convention。您始终可以将布尔值重命名为showingLabels

相关问题