应该将Java成员枚举类型大写吗? [英] Should Java member enum types be capitalized?
问题描述
这里的肛门问题:我们有Java枚举,这是他们自己的类,枚举是类的成员:
Anal question here: we have Java enums which are their own classes, and enums which are members of a class:
public enum reportType { ...
每次我看到它都会让我*在声明中使用,它是一个类型,类型应该大写。但是当我试图把它大写,Eclipse警告我,我不应该大写字段名。我认为Eclipse可能知道官方的Java约定比我更好,但它似乎不正确。甚至翻转Java惯例文档,但没有看到引用的这个问题。
Every time I see this it jars me* because when I see it used in a declaration, it's a type, and types should be capitalized. But when I try to capitalize it, Eclipse warns me that I shouldn't capitalize field names. I figure Eclipse probably knows the official Java conventions better than I do, but it just doesn't seem right. Even flipped through the Java conventions doc, but didn't see this issue referenced.
- 不需要双重意图
推荐答案
如果他们是自己的类,从大写开始,如果他们是成员小写。
If they are their own class start with upper case, if they are members lower case.
public enum ReportType { XML, TEXT, HTML };
public class MyClass
{
ReportType defaultReport = ReportType.XML;
}
这篇关于应该将Java成员枚举类型大写吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!