Package com.sun.xml.bind.v2.runtime
Class Coordinator
java.lang.Object
com.sun.xml.bind.v2.runtime.Coordinator
- All Implemented Interfaces:
javax.xml.bind.ValidationEventHandler,ErrorHandler
- Direct Known Subclasses:
UnmarshallingContext,XMLSerializer
public abstract class Coordinator
extends Object
implements ErrorHandler, javax.xml.bind.ValidationEventHandler
Object that coordinates the marshalling/unmarshalling.
This class takes care of the logic that allows code to obtain
UnmarshallingContext and XMLSerializer instances
during the unmarshalling/marshalling.
This is done by using a ThreadLocal. Therefore one unmarshalling/marshalling
episode has to be done from the beginning till end by the same thread.
(Note that the same Coordinator can be then used by a different thread
for an entirely different episode.)
This class also maintains the user-configured instances of XmlAdapters.
This class implements ErrorHandler and propages erros to this object
as the ValidationEventHandler, which will be implemented in a derived class.
- Author:
- Kohsuke Kawaguchi
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Coordinator<T extends javax.xml.bind.annotation.adapters.XmlAdapter>
booleancontainsAdapter(Class<T> type) final voiderror(SAXParseException exception) final voidfatalError(SAXParseException exception) final <T extends javax.xml.bind.annotation.adapters.XmlAdapter>
TgetAdapter(Class<T> key) Gets the instance of the adapter.protected abstract javax.xml.bind.ValidationEventLocatorGets the current location.protected final voidCalled whenever an execution flow exits the realm of thisCoordinator.protected final voidCalled whenever an execution flow enters the realm of thisCoordinator.final javax.xml.bind.annotation.adapters.XmlAdapterputAdapter(Class<? extends javax.xml.bind.annotation.adapters.XmlAdapter> c, javax.xml.bind.annotation.adapters.XmlAdapter a) final voidwarning(SAXParseException exception) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.xml.bind.ValidationEventHandler
handleEvent
-
Constructor Details
-
Coordinator
public Coordinator()
-
-
Method Details
-
putAdapter
public final javax.xml.bind.annotation.adapters.XmlAdapter putAdapter(Class<? extends javax.xml.bind.annotation.adapters.XmlAdapter> c, javax.xml.bind.annotation.adapters.XmlAdapter a) -
getAdapter
Gets the instance of the adapter.- Returns:
- always non-null.
-
containsAdapter
public <T extends javax.xml.bind.annotation.adapters.XmlAdapter> boolean containsAdapter(Class<T> type) -
pushCoordinator
protected final void pushCoordinator()Called whenever an execution flow enters the realm of thisCoordinator. -
popCoordinator
protected final void popCoordinator()Called whenever an execution flow exits the realm of thisCoordinator. -
_getInstance
-
getLocation
protected abstract javax.xml.bind.ValidationEventLocator getLocation()Gets the current location. Used for reporting the error source location. -
error
- Specified by:
errorin interfaceErrorHandler- Throws:
SAXException
-
warning
- Specified by:
warningin interfaceErrorHandler- Throws:
SAXException
-
fatalError
- Specified by:
fatalErrorin interfaceErrorHandler- Throws:
SAXException
-