}
public void addManager(JMManager pManager) throws JAXBException {
Class elementInterface = pManager.getElementInterface();
if (elementInterface == null) {
throw new JAXBException("The Manager must have its elementInterface set.");
}
if (managersByInterface.containsKey(elementInterface)) {
throw new JAXBException("A Manager for interface " +
elementInterface.getName() +
" is already set.");
}
Class elementClass = pManager.getElementClass();
if (elementClass == null) {
throw new JAXBException("The Manager must have its elementClass set.");
}
if (!elementInterface.isAssignableFrom(elementClass)) {
throw new JAXBException("The elementClass " + elementClass.getName() +
" is not implementing the elementInterface " +
elementInterface.getName() + ".");
}
Class handlerClass = pManager.getHandlerClass();
if (handlerClass == null) {
throw new JAXBException("The Manager must have its handlerClass set.");
}
if (!JMHandler.class.isAssignableFrom(handlerClass)) {
throw new JAXBException("The handlerClass " + handlerClass.getName() +
" is not implementing " +
JMHandler.class.getName() + ".");
}
Class marshallerClass = pManager.getMarshallerClass();
if (marshallerClass == null) {
throw new JAXBException("The Manager must have its marshallerClass set.");
}
if (!JMXmlSerializer.class.isAssignableFrom(marshallerClass)) {
throw new JAXBException("The marshallerClass " + marshallerClass.getName() +
" is not implementing " +
JMXmlSerializer.class.getName() + ".");
}
QName qName = pManager.getQName();
if (qName != null && managersByQName.containsKey(qName)) {
throw new JAXBException("A Manager for document type " + qName +
" is already set.");
}
managersByInterface.put(elementInterface, pManager);
if (qName != null) {