本文整理匯總了Java中com.sun.tools.javac.code.Flags.ENUM屬性的典型用法代碼示例。如果您正苦於以下問題:Java Flags.ENUM屬性的具體用法?Java Flags.ENUM怎麽用?Java Flags.ENUM使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.sun.tools.javac.code.Flags
的用法示例。
在下文中一共展示了Flags.ENUM屬性的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: processConstants
ListBuffer<JCTree> processConstants(Element constNode, HashMap<String, Integer> scope) {
String baseName = constNode.getAttribute("basename");
int count = 1;
try {
count = Integer.parseInt(constNode.getAttribute("count"));
} catch (Exception e) {} // nothing to do, will use count = 1
long declFlags = Flags.PUBLIC | Flags.STATIC | Flags.FINAL | Flags.ENUM;
ListBuffer<JCTree> fields = new ListBuffer<>();
for (int i = 0; i < count; i++) {
String declName = baseName +
((count == 1) ? "" : getUniqIndex(scope, baseName));
JCVariableDecl constDecl = make.VarDef(
make.Modifiers(declFlags),
names.fromString(declName),
null, // no need for type in enum decl
null); // no init
fields.append(constDecl);
}
return fields;
}
示例2: Enum
public ClassTree Enum(ModifiersTree modifiers,
CharSequence simpleName,
List<? extends Tree> implementsClauses,
List<? extends Tree> memberDecls) {
long flags = getBitFlags(modifiers.getFlags()) | Flags.ENUM;
return Class(flags, (com.sun.tools.javac.util.List<JCAnnotation>) modifiers.getAnnotations(), simpleName, Collections.<TypeParameterTree>emptyList(), null, implementsClauses, memberDecls);
}
示例3: getKind
public Kind getKind() {
if ((mods.flags & Flags.ANNOTATION) != 0)
return Kind.ANNOTATION_TYPE;
else if ((mods.flags & Flags.INTERFACE) != 0)
return Kind.INTERFACE;
else if ((mods.flags & Flags.ENUM) != 0)
return Kind.ENUM;
else
return Kind.CLASS;
}
示例4: isEnum
/**
* Return true if this is an enumeration.
* (For legacy doclets, return false.)
*/
@Override
public boolean isEnum() {
return (getFlags() & Flags.ENUM) != 0
&&
!env.legacyDoclet;
}
示例5: getExpectedName
String getExpectedName(VarSymbol v, int i) {
// special cases:
// synthetic method
if (((v.owner.owner.flags() & Flags.ENUM) != 0)
&& v.owner.name.toString().equals("valueOf"))
return "name";
// interfaces don't have saved names
// -- no Code attribute for the LocalVariableTable attribute
if ((v.owner.owner.flags() & Flags.INTERFACE) != 0)
return "arg" + (i - 1);
// abstract methods don't have saved names
// -- no Code attribute for the LocalVariableTable attribute
if ((v.owner.flags() & Flags.ABSTRACT) != 0)
return "arg" + (i - 1);
// bridge methods use argN. No LVT for them anymore
if ((v.owner.flags() & Flags.BRIDGE) != 0)
return "arg" + (i - 1);
// The rest of this method assumes the local conventions in the test program
Type t = v.type;
String s;
if (t.hasTag(TypeTag.CLASS))
s = ((ClassType) t).tsym.name.toString();
else
s = t.toString();
return String.valueOf(Character.toLowerCase(s.charAt(0))) + i;
}
示例6: isEnum
private boolean isEnum(Tree tree) {
if (tree instanceof FieldGroupTree) return ((FieldGroupTree) tree).isEnum();
if (tree instanceof VariableTree) return (((JCVariableDecl) tree).getModifiers().flags & Flags.ENUM) != 0;
return false;
}
示例7: isEnumerator
private boolean isEnumerator(VariableTree tree) {
return (((JCModifiers)tree.getModifiers()).flags & Flags.ENUM) != 0;
}
示例8: isClass
/**Checks whether the given tree represents a class.
* @deprecated since 0.67, <code>Tree.getKind() == Kind.CLASS</code> should be used instead.
*/
@Deprecated
public boolean isClass(ClassTree tree) {
return (((JCTree.JCModifiers)tree.getModifiers()).flags & (Flags.INTERFACE | Flags.ENUM | Flags.ANNOTATION)) == 0;
}
示例9: isEnum
/**Checks whether the given tree represents an enum.
* @deprecated since 0.67, <code>Tree.getKind() == Kind.ENUM</code> should be used instead.
*/
@Deprecated
public boolean isEnum(ClassTree tree) {
return (((JCTree.JCModifiers)tree.getModifiers()).flags & Flags.ENUM) != 0;
}
示例10: isEnumConstant
/**
* Checks wheteher given variable tree represents an enum constant.
*/
public boolean isEnumConstant(VariableTree tree) {
return (((JCTree.JCModifiers) tree.getModifiers()).flags & Flags.ENUM) != 0;
}
示例11: isEnumConstant
/**
* Is this Doc item an enum constant?
* (For legacy doclets, return false.)
*/
@Override
public boolean isEnumConstant() {
return (getFlags() & Flags.ENUM) != 0 &&
!env.legacyDoclet;
}