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

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

本文整理了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

  1. /**
  2. * PUBLIC:
  3. * Set the class each element in the object's
  4. * collection should be converted to, before the collection
  5. * is inserted into the object.
  6. * This is optional - if left null, the elements will be added
  7. * to the object's collection unconverted.
  8. */
  9. @Override
  10. public void setAttributeElementClass(Class attributeElementClass) {
  11. super.setAttributeElementClass(attributeElementClass);
  12. this.collectionContentType = attributeElementClass;
  13. }

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

  1. /**
  2. * PUBLIC:
  3. * Set the class each element in the object's
  4. * collection should be converted to, before the collection
  5. * is inserted into the object.
  6. * This is optional - if left null, the elements will be added
  7. * to the object's collection unconverted.
  8. */
  9. @Override
  10. public void setAttributeElementClass(Class attributeElementClass) {
  11. super.setAttributeElementClass(attributeElementClass);
  12. this.collectionContentType = attributeElementClass;
  13. }

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

  1. /**
  2. * PUBLIC:
  3. * Allows the user to indicate that this mapping should also allow for mixed content in addition to
  4. * any of the elements in the choice. The grouping element parameter is used in the case that there is
  5. * a common grouping element to all the other elements in this choice. If so, that grouping element can
  6. * be specified here to allow the mixed content to be written/detected inside the wrapper element.
  7. * @since EclipseLink 2.3.1
  8. */
  9. public void setMixedContent(String groupingElement) {
  10. isMixedContent = true;
  11. String xpath = groupingElement;
  12. if(groupingElement.length() == 0) {
  13. xpath = "text()";
  14. } else {
  15. xpath += "/" + "text()";
  16. }
  17. XMLField field = new XMLField(xpath);
  18. XMLCompositeDirectCollectionMapping xmlMapping = new XMLCompositeDirectCollectionMapping();
  19. Class theClass = ClassConstants.STRING;
  20. xmlMapping.setAttributeElementClass(theClass);
  21. xmlMapping.setField(field);
  22. xmlMapping.setAttributeAccessor(temporaryAccessor);
  23. this.mixedContentMapping = xmlMapping;
  24. this.choiceElementMappings.put(field, xmlMapping);
  25. }

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

  1. /**
  2. * PUBLIC:
  3. * Allows the user to indicate that this mapping should also allow for mixed content in addition to
  4. * any of the elements in the choice. The grouping element parameter is used in the case that there is
  5. * a common grouping element to all the other elements in this choice. If so, that grouping element can
  6. * be specified here to allow the mixed content to be written/detected inside the wrapper element.
  7. * @since EclipseLink 2.3.1
  8. */
  9. public void setMixedContent(String groupingElement) {
  10. isMixedContent = true;
  11. String xpath = groupingElement;
  12. if(groupingElement.length() == 0) {
  13. xpath = "text()";
  14. } else {
  15. xpath += "/" + "text()";
  16. }
  17. XMLField field = new XMLField(xpath);
  18. XMLCompositeDirectCollectionMapping xmlMapping = new XMLCompositeDirectCollectionMapping();
  19. Class theClass = ClassConstants.STRING;
  20. xmlMapping.setAttributeElementClass(theClass);
  21. xmlMapping.setField(field);
  22. xmlMapping.setAttributeAccessor(temporaryAccessor);
  23. this.mixedContentMapping = xmlMapping;
  24. this.choiceElementMappings.put(field, xmlMapping);
  25. }

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

  1. private void addChoiceElementMapping(XMLField xmlField, Class theClass){
  2. if (xmlField.getLastXPathFragment().nameIsText()) {
  3. XMLCompositeDirectCollectionMapping xmlMapping = new XMLCompositeDirectCollectionMapping();
  4. xmlMapping.setAttributeElementClass(theClass);
  5. xmlMapping.setField(xmlField);
  6. xmlMapping.setAttributeAccessor(temporaryAccessor);
  7. this.choiceElementMappings.put(xmlField, xmlMapping);
  8. } else {
  9. XMLCompositeCollectionMapping xmlMapping = new XMLCompositeCollectionMapping();
  10. if(!theClass.equals(ClassConstants.OBJECT)){
  11. xmlMapping.setReferenceClass(theClass);
  12. }
  13. xmlMapping.setField(xmlField);
  14. xmlMapping.setAttributeAccessor(temporaryAccessor);
  15. this.choiceElementMappings.put(xmlField, xmlMapping);
  16. }
  17. }

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

  1. xmlMapping.setAttributeElementClass(theClass);
  2. xmlMapping.setField(xmlField);
  3. xmlMapping.setAttributeAccessor(temporaryAccessor);

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

  1. private void addChoiceElementMapping(XMLField xmlField, String className){
  2. if (xmlField.getLastXPathFragment().nameIsText()) {
  3. XMLCompositeDirectCollectionMapping xmlMapping = new XMLCompositeDirectCollectionMapping();
  4. Class theClass = XMLConversionManager.getDefaultXMLManager().convertClassNameToClass(className);
  5. xmlMapping.setAttributeElementClass(theClass);
  6. xmlMapping.setField(xmlField);
  7. xmlMapping.setAttributeAccessor(temporaryAccessor);
  8. this.choiceElementMappings.put(xmlField, xmlMapping);
  9. } else {
  10. XMLCompositeCollectionMapping xmlMapping = new XMLCompositeCollectionMapping();
  11. if(!className.equals("java.lang.Object")){
  12. xmlMapping.setReferenceClassName(className);
  13. }
  14. xmlMapping.setField(xmlField);
  15. xmlMapping.setAttributeAccessor(temporaryAccessor);
  16. this.choiceElementMappings.put(xmlField, xmlMapping);
  17. }
  18. }

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

  1. private void addChoiceElementMapping(XMLField xmlField, Class theClass){
  2. if (xmlField.getLastXPathFragment().nameIsText() || xmlField.getLastXPathFragment().isAttribute()) {
  3. XMLCompositeDirectCollectionMapping xmlMapping = new XMLCompositeDirectCollectionMapping();
  4. xmlMapping.setAttributeElementClass(theClass);
  5. xmlMapping.setField(xmlField);
  6. xmlMapping.setAttributeAccessor(temporaryAccessor);
  7. this.choiceElementMappings.put(xmlField, xmlMapping);
  8. this.choiceElementMappingsByClass.put(theClass, xmlMapping);
  9. } else {
  10. if(isBinaryType(theClass)) {
  11. XMLBinaryDataCollectionMapping xmlMapping = new XMLBinaryDataCollectionMapping();
  12. xmlMapping.setField(xmlField);
  13. xmlMapping.setAttributeElementClass(theClass);
  14. xmlMapping.setAttributeAccessor(temporaryAccessor);
  15. this.fieldsToConverters.put(xmlField, xmlMapping.getValueConverter());
  16. this.choiceElementMappings.put(xmlField, xmlMapping);
  17. this.choiceElementMappingsByClass.put(theClass, xmlMapping);
  18. } else {
  19. XMLCompositeCollectionMapping xmlMapping = new XMLCompositeCollectionMapping();
  20. if(!theClass.equals(ClassConstants.OBJECT)){
  21. xmlMapping.setReferenceClass(theClass);
  22. }
  23. xmlMapping.setField(xmlField);
  24. xmlMapping.setAttributeAccessor(temporaryAccessor);
  25. this.choiceElementMappings.put(xmlField, xmlMapping);
  26. this.choiceElementMappingsByClass.put(theClass, xmlMapping);
  27. }
  28. }
  29. }

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

  1. private DatabaseMapping buildXMLCompositeDirectCollectionMapping(String mappingUri) {
  2. XMLCompositeDirectCollectionMapping mapping = new XMLCompositeDirectCollectionMapping();
  3. mapping.setAttributeName(getName());
  4. String xpath = getQualifiedXPath(mappingUri, true);
  5. mapping.setXPath(xpath);
  6. mapping.setAttributeElementClass(getType().getInstanceClass());
  7. if (getXsdType() != null) {
  8. ((XMLField)mapping.getField()).setSchemaType(getXsdType());
  9. }
  10. if (getType().equals(SDOConstants.SDO_STRINGS)) {
  11. mapping.setUsesSingleNode(true);
  12. }
  13. if (getType().getInstanceClass() != null) {
  14. if (shouldAddInstanceClassConverter()) {
  15. InstanceClassConverter converter = new InstanceClassConverter();
  16. converter.setCustomClass(getType().getInstanceClass());
  17. mapping.setValueConverter(converter);
  18. }
  19. }
  20. return mapping;
  21. }

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

  1. private DatabaseMapping buildXMLCompositeDirectCollectionMapping(String mappingUri) {
  2. XMLCompositeDirectCollectionMapping mapping = new XMLCompositeDirectCollectionMapping();
  3. mapping.setAttributeName(getName());
  4. String xpath = getQualifiedXPath(mappingUri, true);
  5. mapping.setXPath(xpath);
  6. mapping.setAttributeElementClass(getType().getInstanceClass());
  7. if (getXsdType() != null) {
  8. ((XMLField)mapping.getField()).setSchemaType(getXsdType());
  9. }
  10. if (getType().equals(SDOConstants.SDO_STRINGS)) {
  11. mapping.setUsesSingleNode(true);
  12. }
  13. if (getType().getInstanceClass() != null) {
  14. if (shouldAddInstanceClassConverter()) {
  15. InstanceClassConverter converter = new InstanceClassConverter();
  16. converter.setCustomClass(getType().getInstanceClass());
  17. mapping.setValueConverter(converter);
  18. }
  19. }
  20. return mapping;
  21. }

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

  1. protected ClassDescriptor buildInterfacePolicyDescriptor() {
  2. XMLDescriptor descriptor = new XMLDescriptor();
  3. descriptor.setJavaClass(InterfacePolicy.class);
  4. descriptor.setDefaultRootElement("interfaces");
  5. XMLCompositeDirectCollectionMapping parentInterfacesMapping = new XMLCompositeDirectCollectionMapping();
  6. parentInterfacesMapping.setAttributeElementClass(Class.class);
  7. parentInterfacesMapping.setAttributeName("parentInterfaces");
  8. parentInterfacesMapping.setGetMethodName("getParentInterfaces");
  9. parentInterfacesMapping.setSetMethodName("setParentInterfaces");
  10. parentInterfacesMapping.setXPath(getPrimaryNamespaceXPath() + "interface/text()");
  11. descriptor.addMapping(parentInterfacesMapping);
  12. XMLDirectMapping implementorDescriptorMapping = new XMLDirectMapping();
  13. implementorDescriptorMapping.setAttributeName("implementorDescriptor");
  14. implementorDescriptorMapping.setGetMethodName("getImplementorDescriptor");
  15. implementorDescriptorMapping.setSetMethodName("setImplementorDescriptor");
  16. implementorDescriptorMapping.setXPath(getPrimaryNamespaceXPath() + "implementor-descriptor/text()");
  17. descriptor.addMapping(implementorDescriptorMapping);
  18. return descriptor;
  19. }

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

  1. protected ClassDescriptor buildInterfacePolicyDescriptor() {
  2. XMLDescriptor descriptor = new XMLDescriptor();
  3. descriptor.setJavaClass(InterfacePolicy.class);
  4. descriptor.setDefaultRootElement("interfaces");
  5. XMLCompositeDirectCollectionMapping parentInterfacesMapping = new XMLCompositeDirectCollectionMapping();
  6. parentInterfacesMapping.setAttributeElementClass(Class.class);
  7. parentInterfacesMapping.setAttributeName("parentInterfaces");
  8. parentInterfacesMapping.setGetMethodName("getParentInterfaces");
  9. parentInterfacesMapping.setSetMethodName("setParentInterfaces");
  10. parentInterfacesMapping.setXPath(getPrimaryNamespaceXPath() + "interface/text()");
  11. descriptor.addMapping(parentInterfacesMapping);
  12. XMLDirectMapping implementorDescriptorMapping = new XMLDirectMapping();
  13. implementorDescriptorMapping.setAttributeName("implementorDescriptor");
  14. implementorDescriptorMapping.setGetMethodName("getImplementorDescriptor");
  15. implementorDescriptorMapping.setSetMethodName("setImplementorDescriptor");
  16. implementorDescriptorMapping.setXPath(getPrimaryNamespaceXPath() + "implementor-descriptor/text()");
  17. descriptor.addMapping(implementorDescriptorMapping);
  18. return descriptor;
  19. }

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

  1. protected ClassDescriptor buildInterfacePolicyDescriptor() {
  2. XMLDescriptor descriptor = new XMLDescriptor();
  3. descriptor.setJavaClass(InterfacePolicy.class);
  4. descriptor.setDefaultRootElement("interfaces");
  5. XMLCompositeDirectCollectionMapping parentInterfacesMapping = new XMLCompositeDirectCollectionMapping();
  6. parentInterfacesMapping.setAttributeElementClass(Class.class);
  7. parentInterfacesMapping.setAttributeName("parentInterfaces");
  8. parentInterfacesMapping.setGetMethodName("getParentInterfaces");
  9. parentInterfacesMapping.setSetMethodName("setParentInterfaces");
  10. parentInterfacesMapping.setXPath(getPrimaryNamespaceXPath() + "interface/text()");
  11. descriptor.addMapping(parentInterfacesMapping);
  12. XMLDirectMapping implementorDescriptorMapping = new XMLDirectMapping();
  13. implementorDescriptorMapping.setAttributeName("implementorDescriptor");
  14. implementorDescriptorMapping.setGetMethodName("getImplementorDescriptor");
  15. implementorDescriptorMapping.setSetMethodName("setImplementorDescriptor");
  16. implementorDescriptorMapping.setXPath(getPrimaryNamespaceXPath() + "implementor-descriptor/text()");
  17. descriptor.addMapping(implementorDescriptorMapping);
  18. return descriptor;
  19. }

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

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

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

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

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

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

相关文章