gpt4 book ai didi

org.eclipse.persistence.oxm.XMLMarshaller.getDescriptor()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-20 02:03:40 26 4
gpt4 key购买 nike

本文整理了Java中org.eclipse.persistence.oxm.XMLMarshaller.getDescriptor()方法的一些代码示例,展示了XMLMarshaller.getDescriptor()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLMarshaller.getDescriptor()方法的具体详情如下:
包路径:org.eclipse.persistence.oxm.XMLMarshaller
类名称:XMLMarshaller
方法名:getDescriptor

XMLMarshaller.getDescriptor介绍

[英]INTERNAL: Return the descriptor for the root object.
[中]内部:返回根对象的描述符。

代码示例

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

protected XMLDescriptor getDescriptor(Object object, boolean isXMLRoot) {
  if (isXMLRoot) {
    return getDescriptor((XMLRoot) object);
  } else {
    return getDescriptor(object);
  }
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

protected XMLDescriptor getDescriptor(Object object, AbstractSession session, boolean isXMLRoot) {
  if (isXMLRoot) {
    return getDescriptor((XMLRoot) object, session);
  } else {
    return getDescriptor(object, session);
  }
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

protected XMLDescriptor getDescriptor(Object object, AbstractSession session, boolean isXMLRoot) {
  if (isXMLRoot) {
    return getDescriptor((Root) object, session);
  } else {
    return getDescriptor(object, session);
  }
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

protected XMLDescriptor getDescriptor(Object object, AbstractSession session, boolean isXMLRoot) {
  if (isXMLRoot) {
    return getDescriptor((Root) object, session);
  } else {
    return getDescriptor(object, session);
  }
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * 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);
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * 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);
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * 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);
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
* 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);
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * 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);
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
* 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);
  }
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
* 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);
  }
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
* 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);
  }
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

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);

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

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);

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

session = xmlContext.getSession(((XMLRoot)object).getObject());                
  if(session != null){
    xmlDescriptor = getDescriptor(((XMLRoot)object).getObject(), session);
xmlDescriptor = getDescriptor(object.getClass(), session);

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

session = xmlContext.getSession(((XMLRoot)object).getObject());
  if(session != null){
    xmlDescriptor = getDescriptor(((XMLRoot)object).getObject(), session);
xmlDescriptor = getDescriptor(object.getClass(), session);

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

session = xmlContext.getSession(((XMLRoot)object).getObject());
  if(session != null){
    xmlDescriptor = getDescriptor(((XMLRoot)object).getObject(), session);
xmlDescriptor = getDescriptor(object.getClass(), session);

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

session = xmlContext.getSession(((XMLRoot)object).getObject());
  if(session != null){
    xmlDescriptor = getDescriptor(((XMLRoot)object).getObject(), session);
xmlDescriptor = getDescriptor(object.getClass(), session);

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

session = xmlContext.getSession(((XMLRoot)object).getObject());
  if(session != null){
    descriptor = getDescriptor(((XMLRoot)object).getObject(), session);
descriptor = getDescriptor(object, session);

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

session = context.getSession(((Root)object).getObject());
if(session != null){
  xmlDescriptor = getDescriptor(((Root)object).getObject(), session);
xmlDescriptor = getDescriptor(objectClass, session);

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com