gpt4 book ai didi

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

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

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

XMLMarshaller.getXMLContext介绍

[英]Return the instance of XMLContext that was used to create this instance of XMLMarshaller.
[中]返回用于创建此XMLMarshaller实例的XMLContext实例。

代码示例

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

private Object wrapEnumeration(Object object, Class enumerationClass) {
  Class generatedClass = this.getClassToGeneratedClasses().get(enumerationClass.getName());
  if (generatedClass != null && WrappedValue.class.isAssignableFrom(generatedClass)) {
    ClassDescriptor desc = xmlMarshaller.getXMLContext().getSession(generatedClass).getDescriptor(generatedClass);
    Object newObject = desc.getInstantiationPolicy().buildNewInstance();
    ((WrappedValue) newObject).setValue(object);
    object = newObject;
  }
  return object;
}

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

private Object wrapEnumeration(Object object, Class enumerationClass) {
  Class generatedClass = this.getClassToGeneratedClasses().get(enumerationClass.getName());
  if (generatedClass != null && WrappedValue.class.isAssignableFrom(generatedClass)) {
    ClassDescriptor desc = xmlMarshaller.getXMLContext().getSession(generatedClass).getDescriptor(generatedClass);
    Object newObject = desc.getInstantiationPolicy().buildNewInstance();
    ((WrappedValue) newObject).setValue(object);
    object = newObject;
  }
  return object;
}

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

public XMLMarshaller getXmlMarshaller() {
  XMLMarshaller marshaller = xmlMarshallerMap.get(Thread.currentThread());
  
  if (marshaller == null) {
    marshaller = getXmlContext().createMarshaller();
    marshaller.setMarshalListener(new SDOMarshalListener(marshaller, (SDOTypeHelper) aHelperContext.getTypeHelper()));
    xmlMarshallerMap.put(Thread.currentThread(), marshaller);
  }
  
  XMLContext context = getXmlContext();
  if (marshaller.getXMLContext() != context) { 
    marshaller.setXMLContext(context);
  }
  return marshaller;
}

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

public XMLMarshaller getXmlMarshaller() {
  XMLMarshaller marshaller = xmlMarshallerMap.get(Thread.currentThread());
  if (marshaller == null) {
    marshaller = getXmlContext().createMarshaller();
    marshaller.setMarshalListener(new SDOMarshalListener(marshaller, (SDOTypeHelper) aHelperContext.getTypeHelper()));
    xmlMarshallerMap.put(Thread.currentThread(), marshaller);
  }
  XMLContext context = getXmlContext();
  if (marshaller.getXMLContext() != context) {
    marshaller.setXMLContext(context);
  }
  return marshaller;
}

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

Descriptor desc = (Descriptor) xmlBinder.getMarshaller().getXMLContext().getSession().getClassDescriptor(updatedObj);

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

Descriptor desc = (Descriptor) xmlBinder.getMarshaller().getXMLContext().getSession().getClassDescriptor(updatedObj);

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

ClassDescriptor desc = xmlMarshaller.getXMLContext().getSession(generatedClass).getDescriptor(generatedClass);
  Object newObject = desc.getInstantiationPolicy().buildNewInstance();
  ((WrappedValue) newObject).setValue(object);
} else if (generatedClass != null) {
  ClassDescriptor desc = xmlMarshaller.getXMLContext().getSession(generatedClass).getDescriptor(generatedClass);
  Object newObject = desc.getInstantiationPolicy().buildNewInstance();
  ((ManyValue) newObject).setItem(object);

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

ClassDescriptor desc = xmlMarshaller.getXMLContext().getSession(generatedClass).getDescriptor(generatedClass);
  Object newObject = desc.getInstantiationPolicy().buildNewInstance();
  ((WrappedValue) newObject).setValue(object);
} else if (generatedClass != null) {
  ClassDescriptor desc = xmlMarshaller.getXMLContext().getSession(generatedClass).getDescriptor(generatedClass);
  Object newObject = desc.getInstantiationPolicy().buildNewInstance();
  ((ManyValue) newObject).setItem(object);

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

ClassDescriptor desc = xmlMarshaller.getXMLContext().getSession(generatedClass).getDescriptor(generatedClass);
  Object newObject = desc.getInstantiationPolicy().buildNewInstance();
  ((WrappedValue) newObject).setValue(objectValue);
Class theClass = qNameToGeneratedClasses.get(qname);
if (theClass != null && WrappedValue.class.isAssignableFrom(theClass)) {
  ClassDescriptor desc = xmlMarshaller.getXMLContext().getSession(theClass).getDescriptor(theClass);
  Object newObject = desc.getInstantiationPolicy().buildNewInstance();
  ((WrappedValue) newObject).setValue(objectValue);
ClassDescriptor desc = xmlMarshaller.getXMLContext().getSession(generatedClass).getDescriptor(generatedClass);
Object newObject = desc.getInstantiationPolicy().buildNewInstance();
((ManyValue) newObject).setItem(objectValue);

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

ClassDescriptor desc = xmlMarshaller.getXMLContext().getSession(generatedClass).getDescriptor(generatedClass);
  Object newObject = desc.getInstantiationPolicy().buildNewInstance();
  ((WrappedValue) newObject).setValue(objectValue);
Class theClass = qNameToGeneratedClasses.get(qname);
if (theClass != null && WrappedValue.class.isAssignableFrom(theClass)) {
  ClassDescriptor desc = xmlMarshaller.getXMLContext().getSession(theClass).getDescriptor(theClass);
  Object newObject = desc.getInstantiationPolicy().buildNewInstance();
  ((WrappedValue) newObject).setValue(objectValue);
ClassDescriptor desc = xmlMarshaller.getXMLContext().getSession(generatedClass).getDescriptor(generatedClass);
Object newObject = desc.getInstantiationPolicy().buildNewInstance();
((ManyValue) newObject).setItem(objectValue);

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

@Override
public boolean marshalSingleValue(XPathFragment xPathFragment, MarshalRecord marshalRecord, Object object, Object value, AbstractSession session, NamespaceResolver namespaceResolver, MarshalContext marshalContext) {
  Object fieldValue = xmlCollectionReferenceMapping.buildFieldValue(value, xmlField, session);
  if (fieldValue == null) {
    if(null != value) {
      XMLField f2 = (XMLField) xmlCollectionReferenceMapping.getSourceToTargetKeyFieldAssociations().get(xmlField);
      fieldValue = marshalRecord.getMarshaller().getXMLContext().getValueByXPath(value, f2.getXPath(), f2.getNamespaceResolver(), Object.class);
    }
    if(null == fieldValue) {
      return false;
    }
  }
  QName schemaType = getSchemaType(xmlField, fieldValue, session);
  String stringValue = getValueToWrite(schemaType, fieldValue, (XMLConversionManager) session.getDatasourcePlatform().getConversionManager(), namespaceResolver);
  if (stringValue != null) {
    if (xPathFragment.isAttribute()) {
      marshalRecord.attribute(xPathFragment, namespaceResolver, stringValue);
      marshalRecord.closeStartElement();
    } else {
      marshalRecord.closeStartElement();
      marshalRecord.characters(stringValue);
    }
    return true;
  }
  return false;
}

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

public boolean marshalSingleValue(XPathFragment xPathFragment, MarshalRecord marshalRecord, Object object, Object targetObject, AbstractSession session, NamespaceResolver namespaceResolver, MarshalContext marshalContext) {
  Object fieldValue = xmlObjectReferenceMapping.buildFieldValue(targetObject, xmlField, session);
  if (fieldValue == null) {
    if(null != targetObject) {
      XMLField fkField = (XMLField) xmlObjectReferenceMapping.getSourceToTargetKeyFieldAssociations().get(xmlField);
      fieldValue = marshalRecord.getMarshaller().getXMLContext().getValueByXPath(targetObject, fkField.getXPath(), fkField.getNamespaceResolver(), Object.class);
    }
    if(null == fieldValue) {
      return false;
    }
  }
  QName schemaType = getSchemaType(xmlField, fieldValue, session);
  String stringValue = getValueToWrite(schemaType, fieldValue, (XMLConversionManager) session.getDatasourcePlatform().getConversionManager(),namespaceResolver);
  XPathFragment groupingFragment = marshalRecord.openStartGroupingElements(namespaceResolver);
  if (xPathFragment.isAttribute()) {
    marshalRecord.attribute(xPathFragment, namespaceResolver, stringValue);
    marshalRecord.closeStartGroupingElements(groupingFragment);
  } else {
    marshalRecord.closeStartGroupingElements(groupingFragment);
    marshalRecord.characters(stringValue);
  }
  return true;
}

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

if(null != objectValue) {
  XMLField fkField = (XMLField) xmlCollectionReferenceMapping.getSourceToTargetKeyFieldAssociations().get(xmlField);
  fieldValue = marshalRecord.getMarshaller().getXMLContext().getValueByXPath(objectValue, fkField.getXPath(), fkField.getNamespaceResolver(), Object.class);

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

} else {
  try {
    childSession = marshaller.getXMLContext().getSession(value);
  } catch (XMLMarshalException e) {               
    marshalSimpleValue(xmlRootFragment, marshalRecord, originalValue, object, value, session, namespaceResolver);

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

Session childSession = null;
try {
  childSession = marshaller.getXMLContext().getSession(objectValue);
} catch (XMLMarshalException e) {
  marshalSimpleValue(xmlRootFragment, marshalRecord, originalValue, object, objectValue, session, namespaceResolver);

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