gpt4 book ai didi

org.eclipse.persistence.oxm.mappings.XMLObjectReferenceMapping.getSourceToTargetKeyFieldAssociations()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 08:04:40 27 4
gpt4 key购买 nike

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

XMLObjectReferenceMapping.getSourceToTargetKeyFieldAssociations介绍

[英]INTERNAL: Return a list of source-target xmlfield pairs.
[中]内部:返回源-目标xmlfield对的列表。

代码示例

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

/**    
 * INTERNAL:
 * Retrieve the target object's primary key value that is mapped to a given
 * source xpath (in the source-target key field association list).
 * 
 * @param sourceObject
 * @param xmlFld
 * @param session
 * @return null if the target object is null, the reference class is null, or
 * a primary key field name does not exist on the reference descriptor that
 * matches the target field name - otherwise, return the associated primary 
 * key value   
 */
public Object buildFieldValue(Object targetObject, XMLField xmlFld, AbstractSession session) {
  if (targetObject == null || getReferenceClass() == null) {
    return null;
  }
  ClassDescriptor descriptor = getReferenceDescriptor();
  ObjectBuilder objectBuilder = descriptor.getObjectBuilder();
  Vector pks = objectBuilder.extractPrimaryKeyFromObject(targetObject, session);
  int idx = descriptor.getPrimaryKeyFields().indexOf(getSourceToTargetKeyFieldAssociations().get(xmlFld));
  if (idx == -1) {
    return null;
  }
  return pks.get(idx);
}

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

while (keyIt.hasNext()) {
  XMLField keyFld = (XMLField) keyIt.next();
  XMLField tgtFld = (XMLField) getSourceToTargetKeyFieldAssociations().get(keyFld);
  int idx = pkFieldNames.indexOf(tgtFld.getXPath());
  if (idx == -1) {

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

int idx = 0;
if(!(null == referenceClass || ClassConstants.OBJECT == getReferenceClass())) {
  idx = descriptor.getPrimaryKeyFields().indexOf(getSourceToTargetKeyFieldAssociations().get(xmlFld));
  if (idx == -1) {
    return null;

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

int idx = 0;
if(!(null == referenceClass || ClassConstants.OBJECT == getReferenceClass())) {
  idx = descriptor.getPrimaryKeyFields().indexOf(getSourceToTargetKeyFieldAssociations().get(xmlFld));
  if (idx == -1) {
    return null;

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

record.reference(reference);
XMLField tgtFld = (XMLField) getSourceToTargetKeyFieldAssociations().get(xmlField);
int idx = pkFieldNames.indexOf(tgtFld.getXPath());
Vector primaryKeys = reference.getPrimaryKeys();

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

while (keyIt.hasNext()) {
  XMLField keyFld = (XMLField) keyIt.next();
  XMLField tgtFld = (XMLField) getSourceToTargetKeyFieldAssociations().get(keyFld);
  Object value;
  int idx = 0;

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

while (keyIt.hasNext()) {
  XMLField keyFld = (XMLField) keyIt.next();
  XMLField tgtFld = (XMLField) getSourceToTargetKeyFieldAssociations().get(keyFld);
  Object value;
  int idx = 0;

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

Map<XMLField, XMLField> associations = mapping.getSourceToTargetKeyFieldAssociations();
for (XMLField srcField : associations.keySet()) {
  XMLField tgtField = associations.get(srcField);

代码示例来源: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/org.eclipse.persistence.core

primaryKeys = (CacheId) reference.getPrimaryKey();
XMLField tgtFld = (XMLField) getSourceToTargetKeyFieldAssociations().get(xmlField);
int idx = pkFieldNames.indexOf(tgtFld.getQualifiedName());

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

primaryKeys = (CacheId) reference.getPrimaryKey();
XMLField tgtFld = (XMLField) getSourceToTargetKeyFieldAssociations().get(xmlField);
int idx = pkFieldNames.indexOf(tgtFld.getQualifiedName());

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