protected XMLDescriptor getDescriptor(XMLRoot object, AbstractSession session) throws XMLMarshalException { XMLDescriptor descriptor = null; try { if(null == session) { return null; } descriptor = (XMLDescriptor) session.getDescriptor(((XMLRoot) object).getObject()); } catch (XMLMarshalException marshalException) { if ((descriptor == null) && isSimpleXMLRoot((XMLRoot) object)) { return null; } throw marshalException; } if (descriptor == null) { throw XMLMarshalException.descriptorNotFoundInProject(object.getClass().getName()); } return descriptor; }
protected XMLDescriptor getDescriptor(XMLRoot object) throws XMLMarshalException { XMLDescriptor descriptor = null; try { AbstractSession session = xmlContext.getSession(((XMLRoot) object).getObject()); if(null == session) { return null; } descriptor = (XMLDescriptor) session.getDescriptor(((XMLRoot) object).getObject()); } catch (XMLMarshalException marshalException) { if ((descriptor == null) && isSimpleXMLRoot((XMLRoot) object)) { return null; } throw marshalException; } if (descriptor == null) { throw XMLMarshalException.descriptorNotFoundInProject(object.getClass().getName()); } return descriptor; }
/** * Convert the given object to XML and update the given marshal record with * that XML Document. * @param object the object to marshal * @param marshalRecord the marshalRecord to marshal the object to */ public void marshal(Object object, MarshalRecord marshalRecord) { boolean isXMLRoot = (object instanceof XMLRoot); AbstractSession session = null; XMLDescriptor xmlDescriptor = null; if(isXMLRoot){ try{ session = xmlContext.getSession(((XMLRoot)object).getObject()); if(session != null){ xmlDescriptor = getDescriptor(((XMLRoot)object).getObject(), session); } }catch (XMLMarshalException marshalException) { if (!isSimpleXMLRoot((XMLRoot) object)) { throw marshalException; } } }else{ session = xmlContext.getSession(object); xmlDescriptor = getDescriptor(object, session); } marshal(object, marshalRecord, session, xmlDescriptor, isXMLRoot); }
if (!isSimpleXMLRoot((XMLRoot) object)) { throw marshalException;
if (!isSimpleXMLRoot((XMLRoot) object)) { throw marshalException;
if (!isSimpleXMLRoot((XMLRoot) object)) { throw marshalException;
if (!isSimpleXMLRoot((Root) object)) { throw marshalException;
if (!isSimpleXMLRoot((Root) object)) { throw marshalException;
if (!isSimpleXMLRoot((XMLRoot) object)) { throw marshalException;
if (!isSimpleXMLRoot((XMLRoot) object)) { throw marshalException;
if (!isSimpleXMLRoot((Root) object)) { throw marshalException;
if (!isSimpleXMLRoot((Root) object)) { throw marshalException;