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

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

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

XMLCompositeDirectCollectionMapping.setAttributeAccessor介绍

暂无

代码示例

代码示例来源: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

xmlMapping.setAttributeElementClass(theClass);
xmlMapping.setField(xmlField);
xmlMapping.setAttributeAccessor(temporaryAccessor);
this.choiceElementMappings.put(xmlField, xmlMapping);
this.choiceElementMappingsByClass.put(theClass, 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);
     }
   }        
}

相关文章