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