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

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

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

XMLCompositeDirectCollectionMapping.setField介绍

暂无

代码示例

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

/**
 * Set the Mapping field name attribute to the given XPath String
 * @param xpathString String
 */
public void setXPath(String xpathString) {
  if ((xpathString.indexOf(XMLConstants.ATTRIBUTE) == -1) && (!xpathString.endsWith(XMLConstants.TEXT))) {
    xpathString += '/' + XMLConstants.TEXT;
  }
  setField(new XMLField(xpathString));
}

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

/**
 * Set the Mapping field name attribute to the given XPath String
 * @param xpathString String
 */
public void setXPath(String xpathString) {
  if ((xpathString.indexOf(XMLConstants.ATTRIBUTE) == -1) && (!xpathString.endsWith(XMLConstants.TEXT))) {
    xpathString += '/' + XMLConstants.TEXT;
  }
  setField(new XMLField(xpathString));
}

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

/**
 * Set the Mapping field name attribute to the given XPath String
 * @param xpathString String
 */
public void setXPath(String xpathString) {
  if ((xpathString.indexOf(XMLConstants.ATTRIBUTE) == -1) && (!xpathString.endsWith(XMLConstants.TEXT))) {
    xpathString += '/' + XMLConstants.TEXT;
  }
  setField(new XMLField(xpathString));
}

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

/**
 * PUBLIC:
 * Allows the user to indicate that this mapping should also allow for mixed content in addition to
 * any of the elements in the choice. The grouping element parameter is used in the case that there is
 * a common grouping element to all the other elements in this choice. If so, that grouping element can
 * be specified here to allow the mixed content to be written/detected inside the wrapper element.
 * @since EclipseLink 2.3.1
 */
public void setMixedContent(String groupingElement) {
  isMixedContent = true;
  String xpath = groupingElement;
  if(groupingElement.length() == 0) {
    xpath = "text()";
  } else {
    xpath += "/" + "text()";
  }
  XMLField field = new XMLField(xpath);
  XMLCompositeDirectCollectionMapping xmlMapping = new XMLCompositeDirectCollectionMapping();
  Class theClass = ClassConstants.STRING;
  xmlMapping.setAttributeElementClass(theClass);
  xmlMapping.setField(field);
  xmlMapping.setAttributeAccessor(temporaryAccessor);
  this.mixedContentMapping = xmlMapping;
  this.choiceElementMappings.put(field, xmlMapping);
}

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

/**
 * PUBLIC:
 * Allows the user to indicate that this mapping should also allow for mixed content in addition to 
 * any of the elements in the choice. The grouping element parameter is used in the case that there is
 * a common grouping element to all the other elements in this choice. If so, that grouping element can
 * be specified here to allow the mixed content to be written/detected inside the wrapper element.
 * @since EclipseLink 2.3.1
 */
public void setMixedContent(String groupingElement) {
  isMixedContent = true;
  
  String xpath = groupingElement;
  if(groupingElement.length() == 0) {
    xpath = "text()";
  } else {
    xpath += "/" + "text()";
  }
  XMLField field = new XMLField(xpath);
  XMLCompositeDirectCollectionMapping xmlMapping = new XMLCompositeDirectCollectionMapping();             
  Class theClass = ClassConstants.STRING;
  xmlMapping.setAttributeElementClass(theClass);             
  xmlMapping.setField(field);             
  xmlMapping.setAttributeAccessor(temporaryAccessor);
  this.mixedContentMapping = xmlMapping;
  this.choiceElementMappings.put(field, xmlMapping);
  
}

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

private void addChoiceElementMapping(XMLField xmlField, Class theClass){

  if (xmlField.getLastXPathFragment().nameIsText()) {
    XMLCompositeDirectCollectionMapping xmlMapping = new XMLCompositeDirectCollectionMapping();            
    xmlMapping.setAttributeElementClass(theClass);
    xmlMapping.setField(xmlField);
    xmlMapping.setAttributeAccessor(temporaryAccessor);
    this.choiceElementMappings.put(xmlField, xmlMapping);                
  } else {
    XMLCompositeCollectionMapping xmlMapping = new XMLCompositeCollectionMapping();            
    if(!theClass.equals(ClassConstants.OBJECT)){
      xmlMapping.setReferenceClass(theClass);
    }
    xmlMapping.setField(xmlField);
    xmlMapping.setAttributeAccessor(temporaryAccessor);
    this.choiceElementMappings.put(xmlField, xmlMapping);                
  }        
}

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

XMLCompositeDirectCollectionMapping xmlMapping = new XMLCompositeDirectCollectionMapping();            
xmlMapping.setAttributeElementClass(theClass);
xmlMapping.setField(xmlField);
xmlMapping.setAttributeAccessor(temporaryAccessor);
this.choiceElementMappings.put(xmlField, xmlMapping);

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

private void addChoiceElementMapping(XMLField xmlField, String className){              
   if (xmlField.getLastXPathFragment().nameIsText()) {
     XMLCompositeDirectCollectionMapping xmlMapping = new XMLCompositeDirectCollectionMapping();             
     Class theClass = XMLConversionManager.getDefaultXMLManager().convertClassNameToClass(className);
     xmlMapping.setAttributeElementClass(theClass);             
     xmlMapping.setField(xmlField);             
     xmlMapping.setAttributeAccessor(temporaryAccessor);
     this.choiceElementMappings.put(xmlField, xmlMapping);                
   } else {
     XMLCompositeCollectionMapping xmlMapping = new XMLCompositeCollectionMapping();  
     if(!className.equals("java.lang.Object")){
      xmlMapping.setReferenceClassName(className);
     }      
     xmlMapping.setField(xmlField);
     xmlMapping.setAttributeAccessor(temporaryAccessor);
     this.choiceElementMappings.put(xmlField, xmlMapping);                
   }        
}

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

private void addChoiceElementMapping(XMLField xmlField, Class theClass){
  if (xmlField.getLastXPathFragment().nameIsText() || xmlField.getLastXPathFragment().isAttribute()) {
    XMLCompositeDirectCollectionMapping xmlMapping = new XMLCompositeDirectCollectionMapping();
    xmlMapping.setAttributeElementClass(theClass);
    xmlMapping.setField(xmlField);
    xmlMapping.setAttributeAccessor(temporaryAccessor);
    this.choiceElementMappings.put(xmlField, xmlMapping);
    this.choiceElementMappingsByClass.put(theClass, xmlMapping);
  } else {
    if(isBinaryType(theClass)) {
      XMLBinaryDataCollectionMapping xmlMapping = new XMLBinaryDataCollectionMapping();
      xmlMapping.setField(xmlField);
      xmlMapping.setAttributeElementClass(theClass);
      xmlMapping.setAttributeAccessor(temporaryAccessor);
      this.fieldsToConverters.put(xmlField, xmlMapping.getValueConverter());
      this.choiceElementMappings.put(xmlField, xmlMapping);
      this.choiceElementMappingsByClass.put(theClass, xmlMapping);
    } else {
      XMLCompositeCollectionMapping xmlMapping = new XMLCompositeCollectionMapping();
      if(!theClass.equals(ClassConstants.OBJECT)){
        xmlMapping.setReferenceClass(theClass);
      }
      xmlMapping.setField(xmlField);
      xmlMapping.setAttributeAccessor(temporaryAccessor);
      this.choiceElementMappings.put(xmlField, xmlMapping);
      this.choiceElementMappingsByClass.put(theClass, xmlMapping);
    }
  }
}

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

private void addChoiceElementMapping(XMLField xmlField, String className){
   if (xmlField.getLastXPathFragment().nameIsText() || xmlField.getLastXPathFragment().isAttribute()) {
     XMLCompositeDirectCollectionMapping xmlMapping = new XMLCompositeDirectCollectionMapping();
     xmlMapping.setAttributeElementClassName(className);
     xmlMapping.setField(xmlField);
     xmlMapping.setAttributeAccessor(temporaryAccessor);
     this.choiceElementMappings.put(xmlField, xmlMapping);
     this.choiceElementMappingsByClassName.put(className, xmlMapping);
   } else {
     if(isBinaryType(className)) {
       XMLBinaryDataCollectionMapping xmlMapping = new XMLBinaryDataCollectionMapping();
       xmlMapping.setField(xmlField);
       xmlMapping.setAttributeAccessor(temporaryAccessor);
       Class theClass = XMLConversionManager.getDefaultXMLManager().convertClassNameToClass(className);
       xmlMapping.setAttributeElementClass(theClass);
       this.choiceElementMappings.put(xmlField, xmlMapping);
       this.choiceElementMappingsByClassName.put(className, xmlMapping);
     } else {
       XMLCompositeCollectionMapping xmlMapping = new XMLCompositeCollectionMapping();
       if(!className.equals("java.lang.Object")){
         xmlMapping.setReferenceClassName(className);
       }
       xmlMapping.setField(xmlField);
       xmlMapping.setAttributeAccessor(temporaryAccessor);
       this.choiceElementMappings.put(xmlField, xmlMapping);
       this.choiceElementMappingsByClassName.put(className, xmlMapping);
     }
   }
}

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

private void addChoiceElementMapping(XMLField xmlField, String className){              
   if (xmlField.getLastXPathFragment().nameIsText() || xmlField.getLastXPathFragment().isAttribute()) {
     XMLCompositeDirectCollectionMapping xmlMapping = new XMLCompositeDirectCollectionMapping();             
     xmlMapping.setAttributeElementClassName(className);             
     xmlMapping.setField(xmlField);             
     xmlMapping.setAttributeAccessor(temporaryAccessor);
     this.choiceElementMappings.put(xmlField, xmlMapping);
     this.choiceElementMappingsByClassName.put(className, xmlMapping);
   } else {
     if(isBinaryType(className)) {
       XMLBinaryDataCollectionMapping xmlMapping = new XMLBinaryDataCollectionMapping();
       xmlMapping.setField(xmlField);
       xmlMapping.setAttributeAccessor(temporaryAccessor);
       Class theClass = XMLConversionManager.getDefaultXMLManager().convertClassNameToClass(className);
       xmlMapping.setAttributeElementClass(theClass);
       this.choiceElementMappings.put(xmlField, xmlMapping);
       this.choiceElementMappingsByClassName.put(className, xmlMapping);
     } else {
       XMLCompositeCollectionMapping xmlMapping = new XMLCompositeCollectionMapping();  
       if(!className.equals("java.lang.Object")){
         xmlMapping.setReferenceClassName(className);
       }      
       xmlMapping.setField(xmlField);
       xmlMapping.setAttributeAccessor(temporaryAccessor);
       this.choiceElementMappings.put(xmlField, xmlMapping);
       this.choiceElementMappingsByClassName.put(className, xmlMapping);
     }
   }        
}

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

/**
 * Build an XMLDescriptor for BatchQueryOperation.
 */
protected XMLDescriptor buildBatchQueryDescriptor() {
  XMLDescriptor descriptor = new XMLDescriptor();
  descriptor.setJavaClass(BatchQueryOperation.class);
  descriptor.setDefaultRootElement("batch-sql-query");
  XMLDirectMapping name = new XMLDirectMapping();
  name.setAttributeName("name");
  name.setXPath("name/text()");
  descriptor.addMapping(name);
  XMLCompositeDirectCollectionMapping statementsMapping = new XMLCompositeDirectCollectionMapping();
  statementsMapping.setAttributeName("batchSql");
  XMLField f1 = new XMLField("batch-statement/text()");
  f1.setIsCDATA(true);
  statementsMapping.setField(f1);
  descriptor.addMapping(statementsMapping);
  return descriptor;
}

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

/**
 * Build an XMLDescriptor for BatchQueryOperation.
 */
protected XMLDescriptor buildBatchQueryDescriptor() {
  XMLDescriptor descriptor = new XMLDescriptor();
  descriptor.setJavaClass(BatchQueryOperation.class);
  descriptor.setDefaultRootElement("batch-sql-query");
  XMLDirectMapping name = new XMLDirectMapping();
  name.setAttributeName("name");
  name.setXPath("name/text()");
  descriptor.addMapping(name);
  XMLCompositeDirectCollectionMapping statementsMapping = new XMLCompositeDirectCollectionMapping();
  statementsMapping.setAttributeName("batchSql");
  XMLField f1 = new XMLField("batch-statement/text()");
  f1.setIsCDATA(true);
  statementsMapping.setField(f1);
  descriptor.addMapping(statementsMapping);
  return descriptor;
}

相关文章