I’ve been reading through Programming Clojure, and I’ve been having some trouble understanding Stuarts primary Java Interop example. He extends DefaultHandler, and creates a startElement method, and then passes that handler to an XML parser. What I don’t understand, is what exactly is happening. Does his implementation of startElement override the one defined in DefaultHandler? I’m confused. I have no experience with Java, and little with object orientation.
Thanks!
I don’t own the book, but I found the code and it looks like you’re right. Here is the function (for others to see):
You’re right about what it does. The proxy statement makes a new class, the equivilent of this Java code:
So the proxy statement defines that class, and gives you an instance, which is now held in print-element-handler.