com.github.javaparser.ast.Node.accept()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(375)

本文整理了Java中com.github.javaparser.ast.Node.accept()方法的一些代码示例,展示了Node.accept()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.accept()方法的具体详情如下:
包路径:com.github.javaparser.ast.Node
类名称:Node
方法名:accept

Node.accept介绍

暂无

代码示例

代码示例来源:origin: org.jooby/jooby-spec

  1. public List<Entry<Object, Node>> accept(final Node node, final Context ctx) {
  2. node.accept(this, ctx);
  3. return nodes;
  4. }

代码示例来源:origin: com.github.javaparser/java-symbol-solver-core

  1. /**
  2. * Should return more like a TypeApplication: a TypeDeclaration and possible typeParametersValues or array
  3. * modifiers.
  4. *
  5. * @return
  6. */
  7. private ResolvedType getTypeConcrete(Node node, boolean solveLambdas) {
  8. if (node == null) throw new IllegalArgumentException();
  9. return node.accept(typeExtractor, solveLambdas);
  10. }

代码示例来源:origin: javaparser/javasymbolsolver

  1. /**
  2. * Should return more like a TypeApplication: a TypeDeclaration and possible typeParametersValues or array
  3. * modifiers.
  4. *
  5. * @return
  6. */
  7. private ResolvedType getTypeConcrete(Node node, boolean solveLambdas) {
  8. if (node == null) throw new IllegalArgumentException();
  9. return node.accept(typeExtractor, solveLambdas);
  10. }

代码示例来源:origin: com.github.javaparser/javaparser-symbol-solver-core

  1. /**
  2. * Should return more like a TypeApplication: a TypeDeclaration and possible typeParametersValues or array
  3. * modifiers.
  4. */
  5. private ResolvedType getTypeConcrete(Node node, boolean solveLambdas) {
  6. if (node == null) throw new IllegalArgumentException();
  7. return node.accept(typeExtractor, solveLambdas);
  8. }

代码示例来源:origin: org.wisdom-framework/wisdom-source-model

  1. /**
  2. * Extract the String value of the <code>node</code>.
  3. * It removes the {@literal "}
  4. *
  5. * @param node The java node which value to convert into string
  6. * @return string version of the node value.
  7. */
  8. public static String asString(Node node){
  9. return node.accept(new StringExtractor(), "");
  10. }

代码示例来源:origin: org.jooby/jooby-spec

  1. public Set<String> accept(final Node node) {
  2. packages.add("java.lang");
  3. if (node != null) {
  4. root(node).accept(this, null);
  5. }
  6. return packages;
  7. }

代码示例来源:origin: org.jooby/jooby-spec

  1. public LocalStack accept(final Node node, final Context ctx) {
  2. this.node = node;
  3. try {
  4. root(node).accept(this, ctx);
  5. } catch (WorkDone ex) {
  6. }
  7. return vars;
  8. }

代码示例来源:origin: org.jooby/jooby-spec

  1. private LambdaExpr handler(final Expression expr, final Context ctx) {
  2. Node node = vars.getOrDefault(expr.toStringWithoutComments(), expr);
  3. return node.accept(new GenericVisitorAdapter<LambdaExpr, Context>() {
  4. @Override
  5. public LambdaExpr visit(final LambdaExpr n, final Context ctx) {
  6. return n;
  7. }
  8. }, ctx);
  9. }

代码示例来源:origin: org.jooby/jooby-spec

  1. public Map<String, Object> accept(final Node node, final Context ctx) {
  2. root(node).accept(this, ctx);
  3. return values;
  4. }

代码示例来源:origin: org.jooby/jooby-spec

  1. protected void visitNode(final Node n, final Context ctx) {
  2. if (this.node == n) {
  3. throw new WorkDone();
  4. }
  5. if (visited.add(n) && n instanceof BodyDeclaration) {
  6. LocalVariableCollector collector = new LocalVariableCollector(vars, visited);
  7. n.accept(collector, ctx);
  8. this.vars = collector.vars;
  9. }
  10. visited.add(n);
  11. }

代码示例来源:origin: org.jooby/jooby-spec

  1. public Map<String, Object> accept(final Node node, final String method, final Context ctx) {
  2. try {
  3. node.accept(this, ctx);
  4. if (!doc.containsKey("@statusCodes")) {
  5. Map<Object, Object> codes = new LinkedHashMap<>();
  6. Status status = Status.OK;
  7. if ("DELETE".equals(method)) {
  8. status = Status.NO_CONTENT;
  9. }
  10. codes.put(status.value(), status.reason());
  11. doc.put("@statusCodes", codes);
  12. }
  13. } catch (Exception x) {
  14. log.debug("Doc collector resulted in exception", x);
  15. }
  16. return doc;
  17. }

代码示例来源:origin: org.jooby/jooby-spec

  1. public List<RouteParam> accept(final Node node, final Context ctx) {
  2. if (node instanceof LambdaExpr) {
  3. ((LambdaExpr) node).getParameters().forEach(p -> {
  4. names.add(p.getId().toStringWithoutComments());
  5. });
  6. }
  7. node.accept(this, ctx);
  8. return params;
  9. }

代码示例来源:origin: org.jooby/jooby-spec

  1. public RouteResponse accept(final Node node, final Context ctx, final Type retType,
  2. final String doc, final Map<Integer, String> codes) {
  3. this.type = retType;
  4. boolean lambda = node instanceof LambdaExpr;
  5. if (lambda) {
  6. ((LambdaExpr) node).getParameters()
  7. .forEach(p -> args.add(p.getId().toStringWithoutComments()));
  8. }
  9. if (this.type == null) {
  10. node.accept(this, ctx);
  11. if (type == null && lambda) {
  12. LambdaExpr expr = (LambdaExpr) node;
  13. if (expr.getChildrenNodes().size() == 1) {
  14. type = expr.getChildrenNodes().get(0).accept(new TypeCollector(), ctx);
  15. }
  16. }
  17. }
  18. return new RouteResponseImpl(this.type == null ? Object.class : this.type, doc, codes);
  19. }

代码示例来源:origin: org.apache.uima/uimaj-v3migration-jcas

  1. updatedNode.accept(this, null);
  2. } else {
  3. super.visit(n, null);

相关文章