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

x33g5p2x  于2022-02-03 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(104)

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

XMLField.hasLastXPathFragment介绍

[英]INTERNAL:
[中]内部:

代码示例

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

/**
 * Assumes type is in the format prefix:localPart, or localPart.
 *
 * @param type
 */
public void setLeafElementType(QName type) {
  leafElementType = type;
  if (hasLastXPathFragment()) {
    getLastXPathFragment().setLeafElementType(type);
  }
}

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

/**
 * Assumes type is in the format prefix:localPart, or localPart.
 * 
 * @param type
 */
public void setLeafElementType(QName type) {
  leafElementType = type;
  if (hasLastXPathFragment()) {
    getLastXPathFragment().setLeafElementType(type);
  }
}

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

/**
 * Assumes type is in the format prefix:localPart, or localPart.
 * 
 * @param type
 */
public void setLeafElementType(QName type) {
  leafElementType = type;
  if (hasLastXPathFragment()) {
    getLastXPathFragment().setLeafElementType(type);
  }
}

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

public QName getLeafElementType() {
  if (hasLastXPathFragment()) {
    return getLastXPathFragment().getLeafElementType();
  }
  return leafElementType; 
}

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

/**
 * INTERNAL:
 * Create an empty object to be used by empty, complex or simple events.
 * A childRecord is created on the parent UnmarshalRecord.
 */
private void createEmptyObject() {
  try {
    // Instantiate a new object
    XMLField xmlFld = (XMLField)mapping.getField();
    if (xmlFld.hasLastXPathFragment()) {
      getParent().setLeafElementType(xmlFld.getLastXPathFragment().getLeafElementType());
    }
    // Create a childRecord on the parent UnmarshalRecord
    nodeValue.processChild(xPathFragment, getParent(), attributes, xmlDescriptor, mapping);
  } catch (SAXException e) {
    throw XMLMarshalException.unmarshalException(e);
  }
}

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

} else {
  XMLField xmlFld = (XMLField) this.xmlCompositeCollectionMapping.getField();
  if (xmlFld.hasLastXPathFragment()) {
    unmarshalRecord.setLeafElementType(xmlFld.getLastXPathFragment().getLeafElementType());

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

@Override
protected Object buildCompositeRow(Object attributeValue, AbstractSession session, AbstractRecord databaseRow, WriteType writeType) {
  XMLDescriptor xmlReferenceDescriptor = null;
  try{
    xmlReferenceDescriptor = (XMLDescriptor) getReferenceDescriptor(attributeValue, session);
  }catch(Exception e){
    //do nothing
  }
  XMLField xmlFld = (XMLField) getField();
  if (xmlFld.hasLastXPathFragment() && xmlFld.getLastXPathFragment().hasLeafElementType()) {
    XMLRecord xmlRec = (XMLRecord) databaseRow;
    xmlRec.setLeafElementType(xmlFld.getLastXPathFragment().getLeafElementType());
  }
  XMLRecord parent = (XMLRecord) databaseRow;
  if (xmlReferenceDescriptor != null) {
    return buildCompositeRowForDescriptor(xmlReferenceDescriptor, attributeValue, session, parent, writeType);
      } else {
    if (attributeValue instanceof Element && getKeepAsElementPolicy() == UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT) {
      return new DOMRecord((Element) attributeValue);
    }else{
      Node newNode = XPathEngine.getInstance().create((XMLField)getField(), parent.getDOM(), attributeValue, session);
      DOMRecord newRow = new DOMRecord(newNode);
      return newRow;
    }
  }
}

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

@Override
protected AbstractRecord buildCompositeRow(Object attributeValue, AbstractSession session, AbstractRecord parentRow, WriteType writeType) {
  ClassDescriptor classDesc = null;
  try{
    classDesc = getReferenceDescriptor(attributeValue, session);
  }catch(Exception e){
    //do nothing
  }
  XMLField xmlFld = (XMLField) getField();
  if (xmlFld.hasLastXPathFragment() && xmlFld.getLastXPathFragment().hasLeafElementType()) {
    XMLRecord xmlRec = (XMLRecord) parentRow;
    xmlRec.setLeafElementType(xmlFld.getLastXPathFragment().getLeafElementType());
  }
  XMLRecord parent = (XMLRecord) parentRow;
  if (classDesc != null) {
    return buildCompositeRowForDescriptor(classDesc, attributeValue, session, parent, writeType);
  } else {
    if (attributeValue instanceof Element && getKeepAsElementPolicy() == UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT) {
      return new DOMRecord((Element) attributeValue);
    }else{
      Node newNode = XPathEngine.getInstance().create((XMLField)getField(), parent.getDOM(), attributeValue, session);
      DOMRecord newRow = new DOMRecord(newNode);
      return newRow;
    }
  }
}

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

@Override
protected AbstractRecord buildCompositeRow(Object attributeValue, AbstractSession session, AbstractRecord parentRow, WriteType writeType) {
  ClassDescriptor classDesc = null;
  try{
    classDesc = getReferenceDescriptor(attributeValue, session);
  }catch(Exception e){
    //do nothing
  }
  XMLField xmlFld = (XMLField) getField();
  if (xmlFld.hasLastXPathFragment() && xmlFld.getLastXPathFragment().hasLeafElementType()) {
    XMLRecord xmlRec = (XMLRecord) parentRow;
    xmlRec.setLeafElementType(xmlFld.getLastXPathFragment().getLeafElementType());
  }
  XMLRecord parent = (XMLRecord) parentRow;
  if (classDesc != null) {
    return buildCompositeRowForDescriptor(classDesc, attributeValue, session, parent, writeType);
  } else {
    if (attributeValue instanceof Element && getKeepAsElementPolicy() == UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT) {
      return new DOMRecord((Element) attributeValue);
    }else{
      Node newNode = XPathEngine.getInstance().create((XMLField)getField(), parent.getDOM(), attributeValue, session);
      DOMRecord newRow = new DOMRecord(newNode);
      return newRow;
    }
  }
}

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

@Override
protected Object buildCompositeRow(Object attributeValue, AbstractSession session, AbstractRecord databaseRow, WriteType writeType) {
  XMLDescriptor xmlReferenceDescriptor = null;
  try{
    xmlReferenceDescriptor = (XMLDescriptor) getReferenceDescriptor(attributeValue, session);
  }catch(Exception e){
    //do nothing
  }
  XMLField xmlFld = (XMLField) getField();
  if (xmlFld.hasLastXPathFragment() && xmlFld.getLastXPathFragment().hasLeafElementType()) {
    XMLRecord xmlRec = (XMLRecord) databaseRow;
    xmlRec.setLeafElementType(xmlFld.getLastXPathFragment().getLeafElementType());
  }
  XMLRecord parent = (XMLRecord) databaseRow;
  if (xmlReferenceDescriptor != null) {
    return buildCompositeRowForDescriptor(xmlReferenceDescriptor, attributeValue, session, parent, writeType);
  } else {
    if (attributeValue instanceof Element && getKeepAsElementPolicy() == UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT) {
      return new DOMRecord((Element) attributeValue);
    }else{
      Node newNode = XPathEngine.getInstance().create((XMLField)getField(), parent.getDOM(), attributeValue, session);
      DOMRecord newRow = new DOMRecord(newNode);
      return newRow;
    }
  }
}

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

} else {
  XMLField xmlFld = (XMLField)this.xmlCompositeObjectMapping.getField();
  if (xmlFld.hasLastXPathFragment()) {
    unmarshalRecord.setLeafElementType(xmlFld.getLastXPathFragment().getLeafElementType());

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

protected AbstractRecord buildCompositeRow(Object attributeValue, AbstractSession session, AbstractRecord parentRow) {
  ClassDescriptor classDesc = null;
  try{
    classDesc = getReferenceDescriptor(attributeValue, session);
  }catch(Exception e){
    //do nothing
  }
  XMLField xmlFld = (XMLField) getField();
  if (xmlFld.hasLastXPathFragment() && xmlFld.getLastXPathFragment().hasLeafElementType()) {
    XMLRecord xmlRec = (XMLRecord) parentRow;
    xmlRec.setLeafElementType(xmlFld.getLastXPathFragment().getLeafElementType());
  }
  XMLRecord parent = (XMLRecord) parentRow;
  if (classDesc != null) {
    XMLObjectBuilder objectBuilder = (XMLObjectBuilder) classDesc.getObjectBuilder();
    boolean addXsiType = shouldAddXsiType((XMLRecord) parentRow, classDesc);
    XMLRecord child = (XMLRecord) objectBuilder.createRecordFor(attributeValue, (XMLField) getField(), parent, this);
    child.setNamespaceResolver(parent.getNamespaceResolver());
    objectBuilder.buildIntoNestedRow(child, attributeValue, session, addXsiType);
    return child;
  } else {
    if (attributeValue instanceof Element && getKeepAsElementPolicy() == UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT) {
      return new DOMRecord((Element) attributeValue);
    }else{
      Node newNode = XPathEngine.getInstance().create((XMLField)getField(), parent.getDOM(), attributeValue, session);
      DOMRecord newRow = new DOMRecord(newNode);
      return newRow;
    }
  }
}

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

if (xmlFld.hasLastXPathFragment() && xmlFld.getLastXPathFragment().hasLeafElementType()) {
  XMLRecord xmlRec = (XMLRecord) databaseRow;
  xmlRec.setLeafElementType(xmlFld.getLastXPathFragment().getLeafElementType());

相关文章