Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue Description

in your visitor example:

Node node = parser.parse("...");
MyVisitor visitor = new MyVisitor();

class MyVisitor extends AbstractVisitor {
    public void visit(Paragraph paragraph) {
        // Do something with paragraph (override other methods for other nodes):
        // Descend into children:

What should be printed to System out? Because I tried on a few things and when visiting both headers and paragraphs all it prints is the type folowed by curly braces like this:

INFO: Visit:(p)- Paragraph{}

I thought maybe it would print out the contents of the node? How do I get to the content of the node?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

robinstcommented, Sep 4, 2015

Thanks @pcj, that’s right. Maybe we should change the example to something more meaningful. Maybe visiting all links and printing the destination? Any other ideas?

robinstcommented, Sep 22, 2015
Read more comments on GitHub >

github_iconTop Results From Across the Web

Visitor - Refactoring.Guru
The Visitor pattern lets you execute an operation over a set of objects with different classes by having a visitor object implement several...
Read more >
Visitor Design Pattern in Java - Baeldung
A quick and practical overview of the Visitor design pattern in Java. ... First of all, the client uses a Visitor implementation and...
Read more >
Visitor Design Pattern - SourceMaking
Each visit() method accepts a single argument - a pointer or reference to an original Element derived class. Each operation to be supported...
Read more >
Visitor design pattern - GeeksforGeeks
Visitor design pattern is one of the behavioral design patterns. It is used when we have to perform an operation on a group...
Read more >
Design Patterns - Visitor Pattern - Tutorialspoint
In Visitor pattern, we use a visitor class which changes the executing algorithm of an element class. By this way, execution algorithm of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found