protected XMLDescriptor getDescriptor(Object object, boolean isXMLRoot) { if (isXMLRoot) { return getDescriptor((XMLRoot) object); } else { return getDescriptor(object); } }
protected XMLDescriptor getDescriptor(Object object, AbstractSession session, boolean isXMLRoot) { if (isXMLRoot) { return getDescriptor((XMLRoot) object, session); } else { return getDescriptor(object, session); } }
protected XMLDescriptor getDescriptor(Object object, AbstractSession session, boolean isXMLRoot) { if (isXMLRoot) { return getDescriptor((Root) object, session); } else { return getDescriptor(object, session); } }
protected XMLDescriptor getDescriptor(Object object, AbstractSession session, boolean isXMLRoot) { if (isXMLRoot) { return getDescriptor((Root) object, session); } else { return getDescriptor(object, session); } }
/** * 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 */ protected void marshal(Object object, AbstractSession session, MarshalRecord marshalRecord) { boolean isXMLRoot = (object instanceof Root); marshal(object, marshalRecord, session, getDescriptor(object, isXMLRoot), isXMLRoot); }
/** * 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 */ protected void marshal(Object object, AbstractSession session, MarshalRecord marshalRecord) { boolean isXMLRoot = (object instanceof XMLRoot); marshal(object, marshalRecord, session, getDescriptor(object, isXMLRoot), isXMLRoot); }
/** * 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 */ protected void marshal(Object object, AbstractSession session, MarshalRecord marshalRecord) { boolean isXMLRoot = (object instanceof Root); marshal(object, marshalRecord, session, getDescriptor(object, isXMLRoot), isXMLRoot); }
/** * PUBLIC: * Convert the given object to an XML Document * @param object the object to marshal * @return the document which the specified object has been marshalled to * @throws XMLMarshalException if an error occurred during marshalling */ public Document objectToXML(Object object) throws XMLMarshalException { boolean isXMLRoot = (object instanceof XMLRoot); XMLDescriptor xmlDescriptor = getDescriptor(object, isXMLRoot); return objectToXML(object, xmlDescriptor, isXMLRoot); }
/** * 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); }
/** * Validate the given object. * @param object A single object to validate * @return true if this is a valid object, otherwise false */ public boolean validate(Object object) throws XMLMarshalException { if (object == null) { throw XMLMarshalException.nullArgumentException(); } try { // Create a new XML Record using the object's class name (not fully qualified) as the root String name = ((XMLDescriptor)xmlContext.getSession(object).getDescriptor(object)).getDefaultRootElement(); if (name == null) { String qualifiedName = object.getClass().getName(); int idx = qualifiedName.lastIndexOf('.'); name = qualifiedName.substring(idx + 1); } XMLDescriptor descriptor = marshaller.getDescriptor(object); XMLRoot root = new XMLRoot(); root.setObject(object); root.setLocalName(name); XMLPlatform xmlPlatform = XMLPlatformFactory.getInstance().getXMLPlatform(); Document doc = xmlPlatform.createDocument(); marshaller.marshal(root, doc); return xmlPlatform.validate(doc.getDocumentElement(), descriptor, getErrorHandler()); } catch (XMLPlatformException e) { throw XMLMarshalException.validateException(e); } }
/** * Validate the given object. * @param object A single object to validate * @return true if this is a valid object, otherwise false */ public boolean validate(Object object) throws XMLMarshalException { if (object == null) { throw XMLMarshalException.nullArgumentException(); } try { // Create a new XML Record using the object's class name (not fully qualified) as the root String name = ((XMLDescriptor)xmlContext.getSession(object).getDescriptor(object)).getDefaultRootElement(); if (name == null) { String qualifiedName = object.getClass().getName(); int idx = qualifiedName.lastIndexOf('.'); name = qualifiedName.substring(idx + 1); } XMLDescriptor descriptor = marshaller.getDescriptor(object); Root root = new Root(); root.setObject(object); root.setLocalName(name); XMLPlatform xmlPlatform = XMLPlatformFactory.getInstance().getXMLPlatform(); Document doc = xmlPlatform.createDocument(); marshaller.marshal(root, doc); return xmlPlatform.validate(doc.getDocumentElement(), descriptor, getErrorHandler()); } catch (XMLPlatformException e) { throw XMLMarshalException.validateException(e); } }
/** * Validate the given object. * @param object A single object to validate * @return true if this is a valid object, otherwise false */ public boolean validate(Object object) throws XMLMarshalException { if (object == null) { throw XMLMarshalException.nullArgumentException(); } try { // Create a new XML Record using the object's class name (not fully qualified) as the root String name = ((XMLDescriptor)xmlContext.getSession(object).getDescriptor(object)).getDefaultRootElement(); if (name == null) { String qualifiedName = object.getClass().getName(); int idx = qualifiedName.lastIndexOf('.'); name = qualifiedName.substring(idx + 1); } XMLDescriptor descriptor = marshaller.getDescriptor(object); Root root = new Root(); root.setObject(object); root.setLocalName(name); XMLPlatform xmlPlatform = XMLPlatformFactory.getInstance().getXMLPlatform(); Document doc = xmlPlatform.createDocument(); marshaller.marshal(root, doc); return xmlPlatform.validate(doc.getDocumentElement(), descriptor, getErrorHandler()); } catch (XMLPlatformException e) { throw XMLMarshalException.validateException(e); } }
session = context.getSession(((Root)object).getObject()); if(session != null){ descriptor = getDescriptor(((Root)object).getObject(), session); Class objectClass = object.getClass(); session = context.getSession(objectClass); descriptor = getDescriptor(objectClass, session);
session = context.getSession(((Root)object).getObject()); if(session != null){ descriptor = getDescriptor(((Root)object).getObject(), session); Class objectClass = object.getClass(); session = context.getSession(objectClass); descriptor = getDescriptor(objectClass, session);
session = xmlContext.getSession(((XMLRoot)object).getObject()); if(session != null){ xmlDescriptor = getDescriptor(((XMLRoot)object).getObject(), session); xmlDescriptor = getDescriptor(object.getClass(), session);
session = xmlContext.getSession(((XMLRoot)object).getObject()); if(session != null){ xmlDescriptor = getDescriptor(((XMLRoot)object).getObject(), session); xmlDescriptor = getDescriptor(object.getClass(), session);
session = xmlContext.getSession(((XMLRoot)object).getObject()); if(session != null){ xmlDescriptor = getDescriptor(((XMLRoot)object).getObject(), session); xmlDescriptor = getDescriptor(object.getClass(), session);
session = xmlContext.getSession(((XMLRoot)object).getObject()); if(session != null){ xmlDescriptor = getDescriptor(((XMLRoot)object).getObject(), session); xmlDescriptor = getDescriptor(object.getClass(), session);
session = xmlContext.getSession(((XMLRoot)object).getObject()); if(session != null){ descriptor = getDescriptor(((XMLRoot)object).getObject(), session); descriptor = getDescriptor(object, session);
session = context.getSession(((Root)object).getObject()); if(session != null){ xmlDescriptor = getDescriptor(((Root)object).getObject(), session); xmlDescriptor = getDescriptor(objectClass, session);