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

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

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

XMLCompositeDirectCollectionMapping.setAttributeElementClass介绍

暂无

代码示例

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

/**
 * PUBLIC:
 * Set the class each element in the object's
 * collection should be converted to, before the collection
 * is inserted into the object.
 * This is optional - if left null, the elements will be added
 * to the object's collection unconverted.
 */
@Override
public void setAttributeElementClass(Class attributeElementClass) {
  super.setAttributeElementClass(attributeElementClass);
  this.collectionContentType = attributeElementClass;
}

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

/**
 * PUBLIC:
 * Set the class each element in the object's
 * collection should be converted to, before the collection
 * is inserted into the object.
 * This is optional - if left null, the elements will be added
 * to the object's collection unconverted.
 */
@Override
public void setAttributeElementClass(Class attributeElementClass) {
  super.setAttributeElementClass(attributeElementClass);
  this.collectionContentType = attributeElementClass;
}

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

代码示例来源: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: com.haulmont.thirdparty/eclipselink

private DatabaseMapping buildXMLCompositeDirectCollectionMapping(String mappingUri) {
  XMLCompositeDirectCollectionMapping mapping = new XMLCompositeDirectCollectionMapping();
  mapping.setAttributeName(getName());
  String xpath = getQualifiedXPath(mappingUri, true);
  mapping.setXPath(xpath);
  mapping.setAttributeElementClass(getType().getInstanceClass());
  if (getXsdType() != null) {
    ((XMLField)mapping.getField()).setSchemaType(getXsdType());
  } 
  if (getType().equals(SDOConstants.SDO_STRINGS)) {
    mapping.setUsesSingleNode(true);
  }
  
  if (getType().getInstanceClass() != null) {
    if (shouldAddInstanceClassConverter()) {
      InstanceClassConverter converter = new InstanceClassConverter();
      converter.setCustomClass(getType().getInstanceClass());
      mapping.setValueConverter(converter);
    }
  }
  return mapping;
}

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

private DatabaseMapping buildXMLCompositeDirectCollectionMapping(String mappingUri) {
  XMLCompositeDirectCollectionMapping mapping = new XMLCompositeDirectCollectionMapping();
  mapping.setAttributeName(getName());
  String xpath = getQualifiedXPath(mappingUri, true);
  mapping.setXPath(xpath);
  mapping.setAttributeElementClass(getType().getInstanceClass());
  if (getXsdType() != null) {
    ((XMLField)mapping.getField()).setSchemaType(getXsdType());
  }
  if (getType().equals(SDOConstants.SDO_STRINGS)) {
    mapping.setUsesSingleNode(true);
  }
  if (getType().getInstanceClass() != null) {
    if (shouldAddInstanceClassConverter()) {
      InstanceClassConverter converter = new InstanceClassConverter();
      converter.setCustomClass(getType().getInstanceClass());
      mapping.setValueConverter(converter);
    }
  }
  return mapping;
}

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

protected ClassDescriptor buildInterfacePolicyDescriptor() {
  XMLDescriptor descriptor = new XMLDescriptor();
  descriptor.setJavaClass(InterfacePolicy.class);
  descriptor.setDefaultRootElement("interfaces");
  XMLCompositeDirectCollectionMapping parentInterfacesMapping = new XMLCompositeDirectCollectionMapping();
  parentInterfacesMapping.setAttributeElementClass(Class.class);
  parentInterfacesMapping.setAttributeName("parentInterfaces");
  parentInterfacesMapping.setGetMethodName("getParentInterfaces");
  parentInterfacesMapping.setSetMethodName("setParentInterfaces");
  parentInterfacesMapping.setXPath(getPrimaryNamespaceXPath() + "interface/text()");
  descriptor.addMapping(parentInterfacesMapping);
  XMLDirectMapping implementorDescriptorMapping = new XMLDirectMapping();
  implementorDescriptorMapping.setAttributeName("implementorDescriptor");
  implementorDescriptorMapping.setGetMethodName("getImplementorDescriptor");
  implementorDescriptorMapping.setSetMethodName("setImplementorDescriptor");
  implementorDescriptorMapping.setXPath(getPrimaryNamespaceXPath() + "implementor-descriptor/text()");
  descriptor.addMapping(implementorDescriptorMapping);
  return descriptor;
}

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

protected ClassDescriptor buildInterfacePolicyDescriptor() {
  XMLDescriptor descriptor = new XMLDescriptor();
  descriptor.setJavaClass(InterfacePolicy.class);
  descriptor.setDefaultRootElement("interfaces");
  XMLCompositeDirectCollectionMapping parentInterfacesMapping = new XMLCompositeDirectCollectionMapping();
  parentInterfacesMapping.setAttributeElementClass(Class.class);
  parentInterfacesMapping.setAttributeName("parentInterfaces");
  parentInterfacesMapping.setGetMethodName("getParentInterfaces");
  parentInterfacesMapping.setSetMethodName("setParentInterfaces");
  parentInterfacesMapping.setXPath(getPrimaryNamespaceXPath() + "interface/text()");
  descriptor.addMapping(parentInterfacesMapping);
  XMLDirectMapping implementorDescriptorMapping = new XMLDirectMapping();
  implementorDescriptorMapping.setAttributeName("implementorDescriptor");
  implementorDescriptorMapping.setGetMethodName("getImplementorDescriptor");
  implementorDescriptorMapping.setSetMethodName("setImplementorDescriptor");
  implementorDescriptorMapping.setXPath(getPrimaryNamespaceXPath() + "implementor-descriptor/text()");
  descriptor.addMapping(implementorDescriptorMapping);
  return descriptor;
}

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

protected ClassDescriptor buildInterfacePolicyDescriptor() {
  XMLDescriptor descriptor = new XMLDescriptor();
  descriptor.setJavaClass(InterfacePolicy.class);
  descriptor.setDefaultRootElement("interfaces");
  XMLCompositeDirectCollectionMapping parentInterfacesMapping = new XMLCompositeDirectCollectionMapping();
  parentInterfacesMapping.setAttributeElementClass(Class.class);
  parentInterfacesMapping.setAttributeName("parentInterfaces");
  parentInterfacesMapping.setGetMethodName("getParentInterfaces");
  parentInterfacesMapping.setSetMethodName("setParentInterfaces");
  parentInterfacesMapping.setXPath(getPrimaryNamespaceXPath() + "interface/text()");
  descriptor.addMapping(parentInterfacesMapping);
  XMLDirectMapping implementorDescriptorMapping = new XMLDirectMapping();
  implementorDescriptorMapping.setAttributeName("implementorDescriptor");
  implementorDescriptorMapping.setGetMethodName("getImplementorDescriptor");
  implementorDescriptorMapping.setSetMethodName("setImplementorDescriptor");
  implementorDescriptorMapping.setXPath(getPrimaryNamespaceXPath() + "implementor-descriptor/text()");
  descriptor.addMapping(implementorDescriptorMapping);
  return descriptor;
}

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

schemaTypeMapping.setSetMethodName("setSchemaTypes");
schemaTypeMapping.useCollectionClass(ArrayList.class);
schemaTypeMapping.setAttributeElementClass(QName.class);
schemaTypeMapping.setXPath(getPrimaryNamespaceXPath() + "schema-type/text()");
descriptor.addMapping(schemaTypeMapping);

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

schemaTypeMapping.setSetMethodName("setSchemaTypes");
schemaTypeMapping.useCollectionClass(ArrayList.class);
schemaTypeMapping.setAttributeElementClass(QName.class);
schemaTypeMapping.setXPath(getPrimaryNamespaceXPath() + "schema-type/text()");
descriptor.addMapping(schemaTypeMapping);

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

schemaTypeMapping.setSetMethodName("setSchemaTypes");
schemaTypeMapping.useCollectionClass(ArrayList.class);
schemaTypeMapping.setAttributeElementClass(QName.class);
schemaTypeMapping.setXPath(getPrimaryNamespaceXPath() + "schema-type/text()");
descriptor.addMapping(schemaTypeMapping);

相关文章