Skip navigation links
javax.ide.extension
Class DeferredElementVisitorHook
java.lang.Object
javax.ide.extension.ElementVisitor
javax.ide.extension.ExtensionHook
javax.ide.extension.DeferredElementVisitorHook
-
public class DeferredElementVisitorHook
- extends ExtensionHook
DeferredElementVisitorHook is a specialized hook handler class that helps clients with existing custom hook handlers convert to a lazier, pull based model. If DeferredElementVisitorHook is registered as the hook handler for an element, it will record the XML data for all instances of that element encountered during extension.xml processing. At a later time, when that data is needed, the client would retrieve the DeferredElementVisitorHook instance from the ExtensionRegistry and call attachElementVisitor() passing an ElementVisitor implementation. Before attachElementVisitor() returns, all of the recorded XML data will be replayed to the attached ElementVisitor instance visitor methods (start/end). DeferredElementVisitor attempts to replicate the original parsing context (such as scope data and locators), such that the attached ElementVisitor would have access to the same information it would have if it had been registered as the hook handler. Once an ElementVisitor is attached, if additional instances of the element are encountered during extension.xml processing, they will be directly passed to the attached ElementVisitor's start/end method with no buffering.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DeferredElementVisitorHook
public DeferredElementVisitorHook()
start
public void start(ElementStartContext context)
- Description copied from class:
ElementVisitor
- Visit the start tag of an xml element.
This implementation does nothing.
-
- Overrides:
start
in class ElementVisitor
-
- Parameters:
context
- information about the xml start tag.
end
public void end(ElementEndContext context)
- Description copied from class:
ElementVisitor
- Visit the end tag of an xml element.
This implementation does nothing.
-
- Overrides:
end
in class ElementVisitor
-
- Parameters:
context
- information about the xml end tag.
attachElementVisitor
public void attachElementVisitor(ElementVisitor elementVisitor)
- When the XML data associated with the hook handler instance needs to be processed, call this method passing an ElementVisitor implementation. Before attachElementVisitor() returns, all of the recorded XML data will be replayed to the given ElementVisitor instance visitor methods (start/end). Once this method has been called, any additional XML data processed by the DeferredElementVisitorHookHandler will be immediately passed through to the attached ElementVisitor with no buffering. It is illegal to call this method more than once passing in different ElementVisitor instances.
-
- Parameters:
elementVisitor
-
isElementVisitorAttached
public boolean isElementVisitorAttached()
- Returns true if an ElementVisitor is attached
-
- Returns:
- See Also:
attachElementVisitor(ElementVisitor)
getAttachedElementVisitor
public ElementVisitor getAttachedElementVisitor()
- Returns the attached ElementVisitor.
-
- Returns:
- null if visitor is not attached.
Skip navigation links
Copyright © 1997, 2012, Oracle. All rights reserved.