當前位置: 首頁>>代碼示例>>Java>>正文


Java MethodDeclaration.isDefault方法代碼示例

本文整理匯總了Java中com.github.javaparser.ast.body.MethodDeclaration.isDefault方法的典型用法代碼示例。如果您正苦於以下問題:Java MethodDeclaration.isDefault方法的具體用法?Java MethodDeclaration.isDefault怎麽用?Java MethodDeclaration.isDefault使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.github.javaparser.ast.body.MethodDeclaration的用法示例。


在下文中一共展示了MethodDeclaration.isDefault方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: visit

import com.github.javaparser.ast.body.MethodDeclaration; //導入方法依賴的package包/類
@Override
public void visit(final MethodDeclaration n, final Object arg) {
    printer.printLn("MethodDeclaration");
    printOrphanCommentsBeforeThisChildNode(n);

    printJavaComment(n.getComment(), arg);
    printJavadoc(n.getJavaDoc(), arg);
    printMemberAnnotations(n.getAnnotations(), arg);
    printModifiers(n.getModifiers());
    if (n.isDefault()) {
        printer.print("default ");
    }
    printTypeParameters(n.getTypeParameters(), arg);
    if (n.getTypeParameters() != null) {
        printer.print(" ");
    }

    n.getType().accept(this, arg);
    printer.print(" ");
    printer.print(n.getName());

    printer.print("(");
    if (n.getParameters() != null) {
        for (final Iterator<Parameter> i = n.getParameters().iterator(); i.hasNext(); ) {
            final Parameter p = i.next();
            p.accept(this, arg);
            if (i.hasNext()) {
                printer.print(", ");
            }
        }
    }
    printer.print(")");

    for (int i = 0; i < n.getArrayCount(); i++) {
        printer.print("[]");
    }

    if (!isNullOrEmpty(n.getThrows())) {
        printer.print(" throws ");
        for (final Iterator<NameExpr> i = n.getThrows().iterator(); i.hasNext(); ) {
            final NameExpr name = i.next();
            name.accept(this, arg);
            if (i.hasNext()) {
                printer.print(", ");
            }
        }
    }
    if (n.getBody() == null) {
        printer.print(";");
    } else {
        printer.print(" ");
        n.getBody().accept(this, arg);
    }
}
 
開發者ID:pcgomes,項目名稱:javaparser2jctree,代碼行數:55,代碼來源:ASTDumpVisitor.java

示例2: visit

import com.github.javaparser.ast.body.MethodDeclaration; //導入方法依賴的package包/類
@Override public Boolean visit(final MethodDeclaration n1, final Node arg) {
	final MethodDeclaration n2 = (MethodDeclaration) arg;

	// javadoc are checked at CompilationUnit

	if (n1.getModifiers() != n2.getModifiers()) {
		return Boolean.FALSE;
	}

	if (n1.getArrayCount() != n2.getArrayCount()) {
		return Boolean.FALSE;
	}

	if (!objEquals(n1.getName(), n2.getName())) {
		return Boolean.FALSE;
	}

	if (!nodeEquals(n1.getType(), n2.getType())) {
		return Boolean.FALSE;
	}

	if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
		return Boolean.FALSE;
	}

	if (!nodeEquals(n1.getBody(), n2.getBody())) {
		return Boolean.FALSE;
	}

	if (!nodesEquals(n1.getParameters(), n2.getParameters())) {
		return Boolean.FALSE;
	}

	if (!nodesEquals(n1.getThrows(), n2.getThrows())) {
		return Boolean.FALSE;
	}

	if (!nodesEquals(n1.getTypeParameters(), n2.getTypeParameters())) {
		return Boolean.FALSE;
	}
	if(n1.isDefault() != n2.isDefault()){
		return Boolean.FALSE;
	}
	return Boolean.TRUE;
}
 
開發者ID:plum-umd,項目名稱:java-sketch,代碼行數:46,代碼來源:EqualsVisitor.java

示例3: visit

import com.github.javaparser.ast.body.MethodDeclaration; //導入方法依賴的package包/類
@Override public void visit(final MethodDeclaration n, final Object arg) {
       printOrphanCommentsBeforeThisChildNode(n);

printJavaComment(n.getComment(), arg);
printJavadoc(n.getJavaDoc(), arg);
printMemberAnnotations(n.getAnnotations(), arg);
printModifiers(n.getModifiers());
if (n.isDefault()) {
    printer.print("default ");
}
printTypeParameters(n.getTypeParameters(), arg);
if (!isNullOrEmpty(n.getTypeParameters())) {
    printer.print(" ");
}

n.getType().accept(this, arg);
printer.print(" ");
printer.print(n.getName());

printer.print("(");
if (!isNullOrEmpty(n.getParameters())) {
    for (final Iterator<Parameter> i = n.getParameters().iterator(); i.hasNext();) {
	final Parameter p = i.next();
	p.accept(this, arg);
	if (i.hasNext()) {
	    printer.print(", ");
	}
    }
}
printer.print(")");

for (int i = 0; i < n.getArrayCount(); i++) {
    printer.print("[]");
}

if (!isNullOrEmpty(n.getThrows())) {
    printer.print(" throws ");
    for (final Iterator<ReferenceType> i = n.getThrows().iterator(); i.hasNext();) {
	final ReferenceType name = i.next();
	name.accept(this, arg);
	if (i.hasNext()) {
	    printer.print(", ");
	}
    }
}
if (n.getBody() == null) {
    printer.print(";");
} else {
    printer.print(" ");
    n.getBody().accept(this, arg);
}
   }
 
開發者ID:plum-umd,項目名稱:java-sketch,代碼行數:53,代碼來源:DumpVisitor.java

示例4: visit

import com.github.javaparser.ast.body.MethodDeclaration; //導入方法依賴的package包/類
@Override public Boolean visit(final MethodDeclaration n1, final Node arg) {
	final MethodDeclaration n2 = (MethodDeclaration) arg;

	// javadoc are checked at CompilationUnit

       if (!n1.getModifiers().equals(n2.getModifiers())) {
		return false;
	}

	if(!nodesEquals(n1.getArrayBracketPairsAfterElementType(), n2.getArrayBracketPairsAfterElementType())){
		return false;
	}

	if(!nodesEquals(n1.getArrayBracketPairsAfterParameterList(), n2.getArrayBracketPairsAfterParameterList())){
		return false;
	}

	if (!objEquals(n1.getName(), n2.getName())) {
		return false;
	}

	if (!nodeEquals(n1.getElementType(), n2.getElementType())) {
		return false;
	}

	if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
		return false;
	}

	if (!nodeEquals(n1.getBody(), n2.getBody())) {
		return false;
	}

	if (!nodesEquals(n1.getParameters(), n2.getParameters())) {
		return false;
	}

	if (!nodesEquals(n1.getThrows(), n2.getThrows())) {
		return false;
	}

	if (!nodesEquals(n1.getTypeParameters(), n2.getTypeParameters())) {
		return false;
	}
	if(n1.isDefault() != n2.isDefault()){
		return false;
	}
	return true;
}
 
開發者ID:javaparser,項目名稱:javasymbolsolver,代碼行數:50,代碼來源:EqualsVisitor.java

示例5: visit

import com.github.javaparser.ast.body.MethodDeclaration; //導入方法依賴的package包/類
@Override public void visit(final MethodDeclaration n, final Object arg) {
       printOrphanCommentsBeforeThisChildNode(n);

	printJavaComment(n.getComment(), arg);
	printJavadoc(n.getJavaDoc(), arg);
	printMemberAnnotations(n.getAnnotations(), arg);
	printModifiers(n.getModifiers());
	if (n.isDefault()) {
		printer.print("default ");
	}
	printTypeParameters(n.getTypeParameters(), arg);
	if (n.getTypeParameters() != null) {
		printer.print(" ");
	}

	n.getType().accept(this, arg);
	printer.print(" ");
	printer.print(n.getName());

	printer.print("(");
	if (n.getParameters() != null) {
		for (final Iterator<Parameter> i = n.getParameters().iterator(); i.hasNext();) {
			final Parameter p = i.next();
			p.accept(this, arg);
			if (i.hasNext()) {
				printer.print(", ");
			}
		}
	}
	printer.print(")");

	for (int i = 0; i < n.getArrayCount(); i++) {
		printer.print("[]");
	}

	if (!isNullOrEmpty(n.getThrows())) {
		printer.print(" throws ");
		for (final Iterator<NameExpr> i = n.getThrows().iterator(); i.hasNext();) {
			final NameExpr name = i.next();
			name.accept(this, arg);
			if (i.hasNext()) {
				printer.print(", ");
			}
		}
	}
	if (n.getBody() == null) {
		printer.print(";");
	} else {
		printer.print(" ");
		n.getBody().accept(this, arg);
	}
}
 
開發者ID:javaparser,項目名稱:javasymbolsolver,代碼行數:53,代碼來源:DumpVisitor.java


注:本文中的com.github.javaparser.ast.body.MethodDeclaration.isDefault方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。