javax.ide.extension
Class MultiDeferredElementVisitorHook
java.lang.Object
javax.ide.extension.ElementVisitor
javax.ide.extension.ExtensionHook
javax.ide.extension.ParameterizedExtensionHook
javax.ide.extension.MultiDeferredElementVisitorHook
public class MultiDeferredElementVisitorHook
- extends ParameterizedExtensionHook
MultiDeferredElementVisitorHook is similar to DeferredElementVisitorHook
except that it supports attaching multiple ElementVisitors. A client
of this API specifies the maximum number of visitors that can be
attached. After that many visitors are attached, the recorded data
will be released, and an exception will be thrown if someone attempts
to attach another visitor.
If MultiDeferredElementVisitorHook 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 MultiDeferredElementVisitorHook 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).
MultiDeferredElementVisitor 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,
the attached ElementVisitor's start/end method will be called.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MultiDeferredElementVisitorHook
public MultiDeferredElementVisitorHook()
setHookHandlerParameters
public void setHookHandlerParameters(java.util.Map<java.lang.String,java.lang.String> parameterMap)
- Specified by:
setHookHandlerParameters
in class ParameterizedExtensionHook
setMaximumNumberOfVisitors
public void setMaximumNumberOfVisitors(int maxVisitors)
getMaximumNumberOfVisitors
public int getMaximumNumberOfVisitors()
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
-
getNumberOfAttachedVisitors
public int getNumberOfAttachedVisitors()
getAttachedVisitors
public java.util.List<ElementVisitor> getAttachedVisitors()
Copyright © 1997, 2011, Oracle. All rights reserved.