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


Java ConstructorDeclaration.getAnnotations方法代码示例

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


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

示例1: visit

import com.github.javaparser.ast.body.ConstructorDeclaration; //导入方法依赖的package包/类
@Override public void visit(final ConstructorDeclaration n, final A arg) {
	visitComment(n.getComment(), arg);
	if (n.getJavaDoc() != null) {
		n.getJavaDoc().accept(this, arg);
	}
	if (n.getAnnotations() != null) {
		for (final AnnotationExpr a : n.getAnnotations()) {
			a.accept(this, arg);
		}
	}
	if (n.getTypeParameters() != null) {
		for (final TypeParameter t : n.getTypeParameters()) {
			t.accept(this, arg);
		}
	}
	if (n.getParameters() != null) {
		for (final Parameter p : n.getParameters()) {
			p.accept(this, arg);
		}
	}
	if (n.getThrows() != null) {
		for (final NameExpr name : n.getThrows()) {
			name.accept(this, arg);
		}
	}
	n.getBlock().accept(this, arg);
}
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:28,代码来源:VoidVisitorAdapter.java

示例2: visit

import com.github.javaparser.ast.body.ConstructorDeclaration; //导入方法依赖的package包/类
@Override public void visit(final ConstructorDeclaration n, final A arg) {
    jw.write(n); 
    visitComment(n.getComment(), arg);
    if (n.getJavaDoc() != null) {
        n.getJavaDoc().accept(this, arg);
    }
    if (n.getAnnotations() != null) {
        for (final AnnotationExpr a : n.getAnnotations()) {
            a.accept(this, arg);
        }
    }
    if (n.getTypeParameters() != null) {
        for (final TypeParameter t : n.getTypeParameters()) {
            t.accept(this, arg);
        }
    }
    if (n.getParameters() != null) {
        for (final Parameter p : n.getParameters()) {
            p.accept(this, arg);
        }
    }
    if (n.getThrows() != null) {
        for (final NameExpr name : n.getThrows()) {
            name.accept(this, arg);
        }
    }
    n.getBlock().accept(this, arg);
}
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:29,代码来源:JsonVisitorAdapter.java

示例3: visit

import com.github.javaparser.ast.body.ConstructorDeclaration; //导入方法依赖的package包/类
@Override public Node visit(final ConstructorDeclaration n, final A arg) {
	if (n.getJavaDoc() != null) {
		n.setJavaDoc((JavadocComment) n.getJavaDoc().accept(this, arg));
	}
	final List<AnnotationExpr> annotations = n.getAnnotations();
	if (annotations != null) {
		for (int i = 0; i < annotations.size(); i++) {
			annotations.set(i, (AnnotationExpr) annotations.get(i).accept(this, arg));
		}
		removeNulls(annotations);
	}
	final List<TypeParameter> typeParameters = n.getTypeParameters();
	if (typeParameters != null) {
		for (int i = 0; i < typeParameters.size(); i++) {
			typeParameters.set(i, (TypeParameter) typeParameters.get(i).accept(this, arg));
		}
		removeNulls(typeParameters);
	}
	final List<Parameter> parameters = n.getParameters();
	if (parameters != null) {
		for (int i = 0; i < parameters.size(); i++) {
			parameters.set(i, (Parameter) parameters.get(i).accept(this, arg));
		}
		removeNulls(parameters);
	}
	final List<NameExpr> throwz = n.getThrows();
	if (throwz != null) {
		for (int i = 0; i < throwz.size(); i++) {
			throwz.set(i, (NameExpr) throwz.get(i).accept(this, arg));
		}
		removeNulls(throwz);
	}
	n.setBlock((BlockStmt) n.getBlock().accept(this, arg));
	return n;
}
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:36,代码来源:ModifierVisitorAdapter.java

示例4: visit

import com.github.javaparser.ast.body.ConstructorDeclaration; //导入方法依赖的package包/类
@Override public Node visit(final ConstructorDeclaration n, final A arg) {
	visitComment(n, arg);
	final List<AnnotationExpr> annotations = n.getAnnotations();
	if (annotations != null) {
		for (int i = 0; i < annotations.size(); i++) {
			annotations.set(i, (AnnotationExpr) annotations.get(i).accept(this, arg));
		}
		removeNulls(annotations);
	}
	final List<TypeParameter> typeParameters = n.getTypeParameters();
	if (typeParameters != null) {
		for (int i = 0; i < typeParameters.size(); i++) {
			typeParameters.set(i, (TypeParameter) typeParameters.get(i).accept(this, arg));
		}
		removeNulls(typeParameters);
	}
	final List<Parameter> parameters = n.getParameters();
	if (parameters != null) {
		for (int i = 0; i < parameters.size(); i++) {
			parameters.set(i, (Parameter) parameters.get(i).accept(this, arg));
		}
		removeNulls(parameters);
	}
	final List<ReferenceType> throwz = n.getThrows();
	if (throwz != null) {
		for (int i = 0; i < throwz.size(); i++) {
			throwz.set(i, (ReferenceType) throwz.get(i).accept(this, arg));
		}
		removeNulls(throwz);
	}
	n.setBody((BlockStmt) n.getBody().accept(this, arg));
	return n;
}
 
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:34,代码来源:ModifierVisitorAdapter.java

示例5: buildConstructorAST

import com.github.javaparser.ast.body.ConstructorDeclaration; //导入方法依赖的package包/类
public void buildConstructorAST(ConstructorDeclaration constDec){
	try{
        
        this.text = printAndExtractText(constDec);
        
        // Get all thrown Exceptions
        for(ReferenceType type: constDec.getThrows()){
        	this.exceptions.add(type.toString());
        }
        
        this.name = constDec.getName();
        Node parent = constDec.getParentNode();
        if (parent instanceof ClassOrInterfaceDeclaration){
            this.className = ((ClassOrInterfaceDeclaration) parent).getName();
        }
        this.modifier = constDec.getModifiers();
        this.returnType = this.className;

        this.paramTypes = getParamTypes(constDec);            
        // Get Annotations
        for(AnnotationExpr annotExpr: constDec.getAnnotations()){
        	this.annotations.add(annotExpr.getName().toString());
        }
        
        // If JavaDocs present, extract them
        if (constDec.getJavaDoc() != null){
            this.javaDoc = cleanDocumentation(constDec.getJavaDoc().getContent());
        }
        
        this.comments = extractContainedComments(constDec);
        
        // These are in-line comments just before the method definitition
        if (constDec.getComment() != null){
        	if (this.comments == null){
        		this.comments = "";
        	}
        	this.comments += constDec.getComment().getContent(); 
        }
        
        // Recursively loop through child nodes and make a dictionary
        this.parseBody(constDec.getBlock());
        
        this.extractHighLevelConcepts();

    } catch (Exception ex){
        ex.printStackTrace();
    }

}
 
开发者ID:shashanksingh28,项目名称:code-similarity,代码行数:50,代码来源:ASTEnhanced.java


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