本文整理匯總了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();
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}