当前位置: 首页>>代码示例>>Java>>正文


Java MethodDeclaration.astModifiers方法代码示例

本文整理汇总了Java中lombok.ast.MethodDeclaration.astModifiers方法的典型用法代码示例。如果您正苦于以下问题:Java MethodDeclaration.astModifiers方法的具体用法?Java MethodDeclaration.astModifiers怎么用?Java MethodDeclaration.astModifiers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lombok.ast.MethodDeclaration的用法示例。


在下文中一共展示了MethodDeclaration.astModifiers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: printMissingMethod

import lombok.ast.MethodDeclaration; //导入方法依赖的package包/类
private void printMissingMethod(MethodDeclaration node) {
    // Ignore constructor
    if (null == node.astReturnTypeReference()) {
        return;
    }

    // Only public/protected methods
    Modifiers modifiers = node.astModifiers();
    if (null == modifiers ||
            (!modifiers.isPublic() && !modifiers.isProtected())) {
        return;
    }

    JavaParser.ResolvedMethod resolvedMethod = NodeUtils.parseResolvedMethod(mContext, node);
    if (null == resolvedMethod) {
        return;
    }

    JavaParser.ResolvedClass resolvedClass = resolvedMethod.getContainingClass();
    if (null == resolvedClass || !isInAndroidSdk(resolvedClass)) {
        return;
    }

    if (isRemoved(node)) {
        appendMethod(removedMethods, resolvedClass.getName(), resolvedMethod.getSignature());
    }
    if (isHide(node)) {
        appendMethod(hideMethods, resolvedClass.getName(), resolvedMethod.getSignature());
    }
}
 
开发者ID:squirrel-explorer,项目名称:eagleeye-android,代码行数:31,代码来源:MissingApiCheckAstVisitor.java

示例2: createMethodDeclaration

import lombok.ast.MethodDeclaration; //导入方法依赖的package包/类
public Node createMethodDeclaration(Node modifiers, Node typeParameters, Node resultType, Node name,
		Node params, List<org.parboiled.Node<Node>> dims, Node throwsHead, List<Node> throwsTail, Node body) {
	
	MethodDeclaration decl = new MethodDeclaration();
	
	if (params instanceof TemporaryNode.MethodParameters) {
		for (Node param : ((TemporaryNode.MethodParameters)params).parameters) {
			decl.rawParameters().addToEnd(param);
		}
	} else DanglingNodes.addDanglingNode(decl, params);
	
	decl.astMethodName(createIdentifierIfNeeded(name, currentPos())).rawBody(body);
	if (modifiers != null) decl.astModifiers(createModifiersIfNeeded(modifiers, currentPos()));
	int extraDims = dims == null ? 0 : dims.size();
	Node returnType = resultType;
	if (extraDims > 0 && returnType instanceof TypeReference) {
		((TypeReference)returnType).astArrayDimensions(((TypeReference)returnType).astArrayDimensions() + extraDims);
	}
	decl.rawReturnTypeReference(returnType);
	if (typeParameters instanceof TemporaryNode.OrphanedTypeVariables) {
		TemporaryNode.OrphanedTypeVariables otv = (TemporaryNode.OrphanedTypeVariables)typeParameters;
		if (otv.variables != null) for (Node typeParameter : otv.variables) {
			if (typeParameter != null) decl.rawTypeVariables().addToEnd(typeParameter);
		}
	}
	
	for (org.parboiled.Node<Node> dim : dims) {
		for (org.parboiled.Node<Node> dimSub : dim.getChildren()) {
			source.registerStructure(decl, dimSub);
		}
	}
	
	if (throwsHead != null) decl.rawThrownTypeReferences().addToEnd(throwsHead);
	if (throwsTail != null) for (Node n : throwsTail) if (n != null) decl.rawThrownTypeReferences().addToEnd(n);
	return posify(decl);
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:37,代码来源:StructuresActions.java

示例3: checkAbstractMembersOnlyInAbstractTypes

import lombok.ast.MethodDeclaration; //导入方法依赖的package包/类
public void checkAbstractMembersOnlyInAbstractTypes(MethodDeclaration md) {
	Modifiers modifiers = md.astModifiers();
	if (modifiers == null) return;
	if (!modifiers.isAbstract()) return;
	TypeDeclaration parent = md.upUpToTypeDeclaration();
	if (parent != null) {
		Modifiers modifiersOfParent = parent.astModifiers();
		if (modifiersOfParent != null && modifiersOfParent.isAbstract()) return;
		md.addMessage(error(MODIFIERS_ABSTRACT_NOT_ALLOWED, "Abstract methods are only allowed in interfaces and abstract classes"));
	}
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:12,代码来源:StructuralChecks.java


注:本文中的lombok.ast.MethodDeclaration.astModifiers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。