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


Java JCTree.JCModifiers方法代碼示例

本文整理匯總了Java中com.sun.tools.javac.tree.JCTree.JCModifiers方法的典型用法代碼示例。如果您正苦於以下問題:Java JCTree.JCModifiers方法的具體用法?Java JCTree.JCModifiers怎麽用?Java JCTree.JCModifiers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.sun.tools.javac.tree.JCTree的用法示例。


在下文中一共展示了JCTree.JCModifiers方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: visitClass

import com.sun.tools.javac.tree.JCTree; //導入方法依賴的package包/類
@Override
public Void visitClass(ClassTree node, Void aVoid) {
    String className = node.getSimpleName().toString();
    if (className.isEmpty()) {
        className = "$" + ++anonymousClassCounter;
    }

    ModifiersTree modifiers = node.getModifiers();
    final boolean processingInterface;
    if (modifiers instanceof JCTree.JCModifiers) {
        processingInterface = (((JCTree.JCModifiers) modifiers).flags & Flags.INTERFACE) != 0;
    } else {
        processingInterface = modifiers.toString().contains("interface");
    }
    classNames.push(className);
    this.processingInterface.push(processingInterface);

    try {
        return withDefaultNotNullAnnotations(modifiers,
                                             className + " class",
                                             () -> super.visitClass(node, aVoid));
    } finally {
        classNames.pop();
        this.processingInterface.pop();
    }
}
 
開發者ID:denis-zhdanov,項目名稱:traute,代碼行數:27,代碼來源:InstrumentationApplianceFinder.java

示例2: isClass

import com.sun.tools.javac.tree.JCTree; //導入方法依賴的package包/類
/**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,代碼行數:8,代碼來源:TreeUtilities.java

示例3: isInterface

import com.sun.tools.javac.tree.JCTree; //導入方法依賴的package包/類
/**Checks whether the given tree represents an interface.
 * @deprecated since 0.67, <code>Tree.getKind() == Kind.INTERFACE</code> should be used instead.
 */
@Deprecated
public boolean isInterface(ClassTree tree) {
    final long flags = ((JCTree.JCModifiers) tree.getModifiers()).flags;
    return (flags & Flags.INTERFACE) != 0 && (flags & Flags.ANNOTATION) == 0;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:TreeUtilities.java

示例4: isEnum

import com.sun.tools.javac.tree.JCTree; //導入方法依賴的package包/類
/**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,代碼行數:8,代碼來源:TreeUtilities.java

示例5: isEnumConstant

import com.sun.tools.javac.tree.JCTree; //導入方法依賴的package包/類
/**
 * 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,代碼行數:7,代碼來源:TreeUtilities.java

示例6: isAnnotation

import com.sun.tools.javac.tree.JCTree; //導入方法依賴的package包/類
/**Checks whether the given tree represents an annotation.
 * @deprecated since 0.67, <code>Tree.getKind() == Kind.ANNOTATION_TYPE</code> should be used instead.
 */
@Deprecated
public boolean isAnnotation(ClassTree tree) {
    return (((JCTree.JCModifiers)tree.getModifiers()).flags & Flags.ANNOTATION) != 0;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:8,代碼來源:TreeUtilities.java


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