本文整理汇总了Java中japa.parser.ast.body.ModifierSet.isStatic方法的典型用法代码示例。如果您正苦于以下问题:Java ModifierSet.isStatic方法的具体用法?Java ModifierSet.isStatic怎么用?Java ModifierSet.isStatic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类japa.parser.ast.body.ModifierSet
的用法示例。
在下文中一共展示了ModifierSet.isStatic方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getJdkModifier
import japa.parser.ast.body.ModifierSet; //导入方法依赖的package包/类
/**
* Converts a Java Parser modifier integer into a JDK {@link Modifier}
* integer.
*
* @param modifiers the Java Parser int
* @return the equivalent JDK int
*/
public static int getJdkModifier(final int modifiers) {
int result = 0;
if (ModifierSet.isAbstract(modifiers)) {
result |= Modifier.ABSTRACT;
}
if (ModifierSet.isFinal(modifiers)) {
result |= Modifier.FINAL;
}
if (ModifierSet.isNative(modifiers)) {
result |= Modifier.NATIVE;
}
if (ModifierSet.isPrivate(modifiers)) {
result |= Modifier.PRIVATE;
}
if (ModifierSet.isProtected(modifiers)) {
result |= Modifier.PROTECTED;
}
if (ModifierSet.isPublic(modifiers)) {
result |= Modifier.PUBLIC;
}
if (ModifierSet.isStatic(modifiers)) {
result |= Modifier.STATIC;
}
if (ModifierSet.isStrictfp(modifiers)) {
result |= Modifier.STRICT;
}
if (ModifierSet.isSynchronized(modifiers)) {
result |= Modifier.SYNCHRONIZED;
}
if (ModifierSet.isTransient(modifiers)) {
result |= Modifier.TRANSIENT;
}
if (ModifierSet.isVolatile(modifiers)) {
result |= Modifier.VOLATILE;
}
return result;
}
示例2: canFieldBeAnnotated
import japa.parser.ast.body.ModifierSet; //导入方法依赖的package包/类
public static boolean canFieldBeAnnotated(FieldDeclaration node) {
final TypeDeclaration dclr = (TypeDeclaration) node.getParentNode();
if (!ModifierSet.isStatic(node.getModifiers()) && dclr.getParentNode() instanceof CompilationUnit) {
//handling nested classes
return true;
}
return false;
}
示例3: visit
import japa.parser.ast.body.ModifierSet; //导入方法依赖的package包/类
@Override
public void visit(MethodDeclaration n, Scope arg) {
String name = Scope.computeMethodName(n);
if (arg.methods.containsKey(name)) {
throw new SemanticException("attempting to redefine method " + name + " on line " + n.getBeginLine());
}
// Create a sub-scope then put this method in scope.
Scope subScope = new Scope(ModifierSet.isStatic(n.getModifiers()) ?
Scope.Type.STATIC :
Scope.Type.INSTANCE);
subScope.backs.add(arg);
arg.methods.put(name, n.getType().toString());
super.visit(n, subScope);
n.setData(arg);
}
示例4: printModifiers
import japa.parser.ast.body.ModifierSet; //导入方法依赖的package包/类
private void printModifiers(int modifiers) {
if (ModifierSet.isPrivate(modifiers)) {
printer.print("private ");
}
if (ModifierSet.isProtected(modifiers)) {
printer.print("protected ");
}
if (ModifierSet.isPublic(modifiers)) {
printer.print("public ");
}
if (ModifierSet.isAbstract(modifiers)) {
printer.print("abstract ");
}
if (ModifierSet.isStatic(modifiers)) {
printer.print("static ");
}
if (ModifierSet.isFinal(modifiers)) {
printer.print("final ");
}
if (ModifierSet.isNative(modifiers)) {
printer.print("native ");
}
if (ModifierSet.isStrictfp(modifiers)) {
printer.print("strictfp ");
}
if (ModifierSet.isSynchronized(modifiers)) {
printer.print("synchronized ");
}
if (ModifierSet.isTransient(modifiers)) {
printer.print("transient ");
}
if (ModifierSet.isVolatile(modifiers)) {
printer.print("volatile ");
}
}