當前位置: 首頁>>代碼示例>>Java>>正文


Java Flags.ENUM屬性代碼示例

本文整理匯總了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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:24,代碼來源:PackageGenerator.java

示例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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:7,代碼來源:TreeFactory.java

示例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;
}
 
開發者ID:tranleduy2000,項目名稱:javaide,代碼行數:10,代碼來源:JCTree.java

示例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;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:10,代碼來源:ClassDocImpl.java

示例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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:27,代碼來源:T6889255.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:5,代碼來源:PositionEstimator.java

示例7: isEnumerator

private boolean isEnumerator(VariableTree tree) {
    return (((JCModifiers)tree.getModifiers()).flags & Flags.ENUM) != 0;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:3,代碼來源:Reformatter.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:7,代碼來源:TreeUtilities.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:7,代碼來源:TreeUtilities.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:6,代碼來源:TreeUtilities.java

示例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;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:9,代碼來源:FieldDocImpl.java


注:本文中的com.sun.tools.javac.code.Flags.ENUM屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。