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


Java ConstructorDeclaration.getParameters方法代码示例

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


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

示例1: visit

import org.walkmod.javalang.ast.body.ConstructorDeclaration; //导入方法依赖的package包/类
public void visit(ConstructorDeclaration n, A arg) {
    if (n.getJavaDoc() != null) {
        n.getJavaDoc().accept(this, arg);
    }
    if (n.getAnnotations() != null) {
        for (AnnotationExpr a : n.getAnnotations()) {
            a.accept(this, arg);
        }
    }
    if (n.getTypeParameters() != null) {
        for (TypeParameter t : n.getTypeParameters()) {
            t.accept(this, arg);
        }
    }
    if (n.getParameters() != null) {
        for (Parameter p : n.getParameters()) {
            p.accept(this, arg);
        }
    }
    if (n.getThrows() != null) {
        for (ClassOrInterfaceType name : n.getThrows()) {
            name.accept(this, arg);
        }
    }
    n.getBlock().accept(this, arg);
}
 
开发者ID:rpau,项目名称:javalang,代码行数:27,代码来源:VoidVisitorAdapter.java

示例2: compare

import org.walkmod.javalang.ast.body.ConstructorDeclaration; //导入方法依赖的package包/类
@Override
public int compare(ConstructorDeclaration o1, ConstructorDeclaration o2) {
    if (o1.getName().equals(o2.getName())) {
        List<Parameter> params1 = o1.getParameters();
        List<Parameter> params2 = o2.getParameters();
        if ((params1 == null || params1.size() == 0) && (params2 == null || params2.size() == 0)) {
            return 0;
        } else if (params1 != null && params2 != null) {
            if (params1.size() == params2.size()) {
                Iterator<Parameter> itprms = o1.getParameters().iterator();
                Iterator<Parameter> itprms2 = o2.getParameters().iterator();
                boolean equalParams = false;
                while (itprms.hasNext() && itprms2.hasNext() && !equalParams) {
                    equalParams = itprms.next().getType().toString().equals(itprms2.next().getType().toString());
                }
                if (equalParams)
                    return 0;
                else
                    return new Integer(params1.size()).compareTo(params2.size());
            } else {
                return new Integer(params1.size()).compareTo(params2.size());
            }
        }
    }
    return o1.getName().compareTo(o2.getName());
}
 
开发者ID:rpau,项目名称:javalang,代码行数:27,代码来源:ConstructorDeclarationComparator.java

示例3: pushConstructor

import org.walkmod.javalang.ast.body.ConstructorDeclaration; //导入方法依赖的package包/类
private void pushConstructor(SymbolType st, SymbolTable table, ConstructorDeclaration md) throws Exception {
    Type type = new ClassOrInterfaceType(md.getName());
    SymbolType resolvedType = ASTSymbolTypeResolver.getInstance().valueOf(type);
    type.setSymbolData(resolvedType);

    List<Parameter> params = md.getParameters();
    List<TypeParameter> tps = md.getTypeParameters();

    SymbolType[] args = null;
    boolean hasDynamicArgs = false;
    if (params != null) {
        args = new SymbolType[params.size()];
        for (int i = 0; i < args.length; i++) {

            args[i] = ASTSymbolTypeResolver.getInstance().valueOf(params.get(i).getType(), tps);

            params.get(i).getType().setSymbolData(args[i]);
            if (i == args.length - 1) {
                hasDynamicArgs = params.get(i).isVarArgs();
            }
        }
    }
    List<SymbolAction> actions = null;
    if (actionProvider != null) {
        actions = actionProvider.getActions(md);
    }
    MethodSymbol method = new MethodSymbol(md.getName(), resolvedType, md, st, args, false, hasDynamicArgs,
            (java.lang.reflect.Constructor<?>) null, actions);

    Scope scope = new Scope(method);
    method.setInnerScope(scope);
    table.pushScope(scope);
    md.accept(expressionTypeAnalyzer, null);
    table.popScope(true);

    method.setReferencedConstructor(md.getSymbolData().getConstructor());

    table.pushSymbol(method);
}
 
开发者ID:rpau,项目名称:javalang-compiler,代码行数:40,代码来源:LoadMethodDeclarationsAction.java

示例4: visit

import org.walkmod.javalang.ast.body.ConstructorDeclaration; //导入方法依赖的package包/类
public R visit(ConstructorDeclaration n, A arg) {
    if (n.getJavaDoc() != null) {
        n.getJavaDoc().accept(this, arg);
    }
    if (n.getAnnotations() != null) {
        for (AnnotationExpr a : n.getAnnotations()) {
            a.accept(this, arg);
        }
    }
    if (n.getTypeParameters() != null) {
        for (TypeParameter t : n.getTypeParameters()) {
            t.accept(this, arg);
        }
    }
    if (n.getParameters() != null) {
        for (Parameter p : n.getParameters()) {
            p.accept(this, arg);
        }
    }
    if (n.getThrows() != null) {
        for (ClassOrInterfaceType name : n.getThrows()) {
            name.accept(this, arg);
        }
    }
    n.getBlock().accept(this, arg);
    return null;
}
 
开发者ID:rpau,项目名称:javalang,代码行数:28,代码来源:GenericVisitorAdapter.java

示例5: visit

import org.walkmod.javalang.ast.body.ConstructorDeclaration; //导入方法依赖的package包/类
public Node visit(ConstructorDeclaration n, A arg) {
    if (n.getJavaDoc() != null) {
        n.setJavaDoc((JavadocComment) n.getJavaDoc().accept(this, arg));
    }
    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);
    }
    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);
    }
    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);
    }
    List<ClassOrInterfaceType> throwz = n.getThrows();
    if (throwz != null) {
        for (int i = 0; i < throwz.size(); i++) {
            throwz.set(i, (ClassOrInterfaceType) throwz.get(i).accept(this, arg));
        }
        removeNulls(throwz);
    }
    n.setBlock((BlockStmt) n.getBlock().accept(this, arg));
    return n;
}
 
开发者ID:rpau,项目名称:javalang,代码行数:36,代码来源:ModifierVisitorAdapter.java

示例6: visit

import org.walkmod.javalang.ast.body.ConstructorDeclaration; //导入方法依赖的package包/类
public void visit(ConstructorDeclaration n, Object arg) {

        Node comment = n.getJavaDoc();
        if (comment != null) {
            printPreviousComments(comment, arg);
        }

        printJavadoc((JavadocComment) comment, arg);

        printPreviousComments(n, arg);

        printMemberAnnotations(n.getAnnotations(), arg);
        printModifiers(n.getModifiers());
        printTypeParameters(n.getTypeParameters(), arg);
        if (n.getTypeParameters() != null) {
            printer.print(" ");
        }
        printer.print(n.getName());
        printer.print("(");
        if (n.getParameters() != null) {
            for (Iterator<Parameter> i = n.getParameters().iterator(); i.hasNext();) {
                Parameter p = i.next();
                p.accept(this, arg);
                if (i.hasNext()) {
                    printer.print(", ");
                }
            }
        }
        printer.print(")");
        if (n.getThrows() != null) {
            printer.print(" throws ");
            for (Iterator<ClassOrInterfaceType> i = n.getThrows().iterator(); i.hasNext();) {
                ClassOrInterfaceType name = i.next();
                name.accept(this, arg);
                if (i.hasNext()) {
                    printer.print(", ");
                }
            }
        }
        printer.print(" ");
        n.getBlock().accept(this, arg);
    }
 
开发者ID:rpau,项目名称:javalang,代码行数:43,代码来源:DumpVisitor.java


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