Java Code Examples for com.github.javaparser.ast.type.ReferenceType#accept()
The following examples show how to use
com.github.javaparser.ast.type.ReferenceType#accept() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PrettyPrintVisitor.java From stategen with GNU Affero General Public License v3.0 | 5 votes |
@Override public void visit(final IntersectionType n, final Void arg) { printJavaComment(n.getComment(), arg); printAnnotations(n.getAnnotations(), false, arg); boolean isFirst = true; for (ReferenceType element : n.getElements()) { if (isFirst) { isFirst = false; } else { printer.print(" & "); } element.accept(this, arg); } }
Example 2
Source File: PrettyPrintVisitor.java From stategen with GNU Affero General Public License v3.0 | 5 votes |
@Override public void visit(final UnionType n, final Void arg) { printJavaComment(n.getComment(), arg); printAnnotations(n.getAnnotations(), true, arg); boolean isFirst = true; for (ReferenceType element : n.getElements()) { if (isFirst) { isFirst = false; } else { printer.print(" | "); } element.accept(this, arg); } }
Example 3
Source File: PrettyPrintVisitor.java From stategen with GNU Affero General Public License v3.0 | 5 votes |
@Override public void visit(final ConstructorDeclaration n, final Void arg) { printJavaComment(n.getComment(), arg); printMemberAnnotations(n.getAnnotations(), arg); printModifiers(n.getModifiers()); printTypeParameters(n.getTypeParameters(), arg); if (n.isGeneric()) { printer.print(" "); } n.getName().accept(this, arg); printer.print("("); if (!n.getParameters().isEmpty()) { 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(")"); if (!isNullOrEmpty(n.getThrownExceptions())) { printer.print(" throws "); for (final Iterator<ReferenceType<?>> i = n.getThrownExceptions().iterator(); i.hasNext(); ) { final ReferenceType name = i.next(); name.accept(this, arg); if (i.hasNext()) { printer.print(", "); } } } printer.print(" "); n.getBody().accept(this, arg); }
Example 4
Source File: PrettyPrintVisitor.java From stategen with GNU Affero General Public License v3.0 | 4 votes |
@Override public void visit(final MethodDeclaration n, final Void arg) { printOrphanCommentsBeforeThisChildNode(n); printJavaComment(n.getComment(), arg); printMemberAnnotations(n.getAnnotations(), arg); printModifiers(n.getModifiers()); printTypeParameters(n.getTypeParameters(), arg); if (!isNullOrEmpty(n.getTypeParameters())) { printer.print(" "); } n.getType().accept(this, arg); printer.print(" "); n.getName().accept(this, arg); 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(")"); if (!isNullOrEmpty(n.getThrownExceptions())) { printer.print(" throws "); for (final Iterator<ReferenceType<?>> i = n.getThrownExceptions().iterator(); i.hasNext(); ) { final ReferenceType name = i.next(); name.accept(this, arg); if (i.hasNext()) { printer.print(", "); } } } if (!n.getBody().isPresent()) { printer.print(";"); } else { printer.print(" "); n.getBody().get().accept(this, arg); } }