本文整理汇总了Java中org.eclipse.jdt.core.dom.MethodDeclaration.modifiers方法的典型用法代码示例。如果您正苦于以下问题:Java MethodDeclaration.modifiers方法的具体用法?Java MethodDeclaration.modifiers怎么用?Java MethodDeclaration.modifiers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.dom.MethodDeclaration
的用法示例。
在下文中一共展示了MethodDeclaration.modifiers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.eclipse.jdt.core.dom.MethodDeclaration; //导入方法依赖的package包/类
public boolean visit(MethodDeclaration methodDeclaration) {
// ASTNode parentNode = methodDeclaration.getParent();
// if (!(parentNode instanceof TypeDeclaration)) {
// // ignore methods from anonymous classes
// return false;
// }
String methodSignature = AstUtils.getSignatureFromMethodDeclaration(methodDeclaration);
// if
// (methodDeclaration.getName().getIdentifier().equals("execMultiLineCommands"))
// {
// System.out.println("x");
//
// }
final RastNode method = model.createMethod(methodSignature, containerStack.peek(), sourceFilePath, methodDeclaration.isConstructor(), methodDeclaration);
List<?> modifiers = methodDeclaration.modifiers();
Set<String> annotations = extractAnnotationTypes(modifiers);
boolean deprecated = annotations.contains("Deprecated") || AstUtils.containsDeprecatedTag(methodDeclaration.getJavadoc());
if (deprecated) {
method.addStereotypes(Stereotype.DEPRECATED);
}
int methodModifiers = methodDeclaration.getModifiers();
Visibility visibility = getVisibility(methodModifiers);
boolean isStatic = (methodModifiers & Modifier.STATIC) != 0;
if (!isStatic) {
method.addStereotypes(Stereotype.TYPE_MEMBER);
}
//method.setVisibility(visibility);
extractParametersAndReturnType(model, methodDeclaration, method);
Block body = methodDeclaration.getBody();
if (body == null) {
method.addStereotypes(Stereotype.ABSTRACT);
} else {
final List<String> references = new ArrayList<String>();
body.accept(new DependenciesAstVisitor(true) {
@Override
protected void onMethodAccess(ASTNode node, IMethodBinding binding) {
String methodKey = AstUtils.getKeyFromMethodBinding(binding);
references.add(methodKey);
}
});
postProcessReferences.put(method, references);
}
return true;
}
示例2: getNonnullReturnValueAnnotationIfPresent
import org.eclipse.jdt.core.dom.MethodDeclaration; //导入方法依赖的package包/类
private static Annotation getNonnullReturnValueAnnotationIfPresent(MethodDeclaration node) {
@SuppressWarnings("unchecked")
final List<IExtendedModifier> modifiers = node.modifiers();
return findNonnullAnnotation(modifiers);
}