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

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

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

XMLCompositeDirectCollectionMapping.getNullPolicy介绍

暂无

代码示例

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

  1. public boolean isWhitespaceAware() {
  2. return !xmlCompositeDirectCollectionMapping.getNullPolicy().isNullRepresentedByEmptyNode();
  3. }

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

  1. public void endElement(XPathFragment xPathFragment, UnmarshalRecord unmarshalRecord) {
  2. XMLField xmlField = (XMLField) xmlCompositeDirectCollectionMapping.getField();
  3. if (!xmlField.getLastXPathFragment().nameIsText()) {
  4. return;
  5. }
  6. Object value = unmarshalRecord.getStringBuffer().toString();
  7. Object collection = unmarshalRecord.getContainerInstance(this);
  8. unmarshalRecord.resetStringBuffer();
  9. if (xmlCompositeDirectCollectionMapping.usesSingleNode()) {
  10. StringTokenizer stringTokenizer = new StringTokenizer((String) value);
  11. while (stringTokenizer.hasMoreTokens()) {
  12. addUnmarshalValue(unmarshalRecord, stringTokenizer.nextToken(), collection);
  13. }
  14. } else {
  15. if (value.equals(XMLConstants.EMPTY_STRING)) {
  16. if (xmlCompositeDirectCollectionMapping.getNullPolicy().isNullRepresentedByEmptyNode() ||
  17. xmlCompositeDirectCollectionMapping.getNullPolicy().isNullRepresentedByXsiNil()) {
  18. return;
  19. }
  20. }
  21. addUnmarshalValue(unmarshalRecord, value, collection);
  22. }
  23. }

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

  1. elements.addElement(element);
  2. } else {
  3. if (getNullPolicy() == null) {
  4. elements.addElement(null);
  5. } else {
  6. if (getNullPolicy().getMarshalNullRepresentation() == XMLNullRepresentationType.XSI_NIL) {
  7. elements.addElement(XMLRecord.NIL);
  8. } else if (getNullPolicy().getMarshalNullRepresentation() == XMLNullRepresentationType.ABSENT_NODE) {

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

  1. public boolean startElement(XPathFragment xPathFragment, UnmarshalRecord unmarshalRecord, Attributes atts) {
  2. XMLField xmlField = (XMLField) xmlCompositeDirectCollectionMapping.getField();
  3. if (xmlField.getLastXPathFragment().nameIsText()) {
  4. String type = atts.getValue(XMLConstants.SCHEMA_INSTANCE_URL, XMLConstants.SCHEMA_TYPE_ATTRIBUTE);
  5. if (null != type) {
  6. String namespaceURI = null;
  7. int colonIndex = type.indexOf(XMLConstants.COLON);
  8. if (colonIndex > -1) {
  9. String prefix = type.substring(0, colonIndex);
  10. namespaceURI = unmarshalRecord.resolveNamespacePrefix(prefix);
  11. type = type.substring(colonIndex + 1);
  12. }
  13. unmarshalRecord.setTypeQName(new QName(namespaceURI, type));
  14. }
  15. if (xmlCompositeDirectCollectionMapping.getNullPolicy().isNullRepresentedByXsiNil() && xmlCompositeDirectCollectionMapping.getNullPolicy().valueIsNull(atts)) {
  16. getContainerPolicy().addInto(null, unmarshalRecord.getContainerInstance(this), unmarshalRecord.getSession());
  17. }
  18. } else if (xmlField.getLastXPathFragment().isAttribute()) {
  19. if (!this.xmlCompositeDirectCollectionMapping.usesSingleNode()) {
  20. String namespaceURI = xmlField.getLastXPathFragment().getNamespaceURI();
  21. if (namespaceURI == null) {
  22. namespaceURI = XMLConstants.EMPTY_STRING;
  23. }
  24. String value = atts.getValue(namespaceURI, xmlField.getLastXPathFragment().getLocalName());
  25. Object collection = unmarshalRecord.getContainerInstance(this);
  26. addUnmarshalValue(unmarshalRecord, value, collection);
  27. }
  28. }
  29. return true;
  30. }

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

  1. elements.addElement(element);
  2. } else if(!usesSingleNode()){
  3. AbstractNullPolicy nullPolicy = getNullPolicy();
  4. if (nullPolicy == null) {
  5. elements.addElement(null);

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

  1. elements.addElement(element);
  2. } else if(!usesSingleNode()){
  3. AbstractNullPolicy nullPolicy = getNullPolicy();
  4. if (nullPolicy == null) {
  5. elements.addElement(null);

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

  1. private void addUnmarshalValue(UnmarshalRecord unmarshalRecord, Object value, Object collection) {
  2. if (null == value) {
  3. return;
  4. }
  5. if (xmlCompositeDirectCollectionMapping.getNullPolicy().isNullRepresentedByXsiNil() && xmlCompositeDirectCollectionMapping.getNullPolicy().valueIsNull(unmarshalRecord.getAttributes())) {
  6. return;
  7. }
  8. if ((!isWhitespaceAware() && XMLConstants.EMPTY_STRING.equals(value))) {
  9. return;
  10. }
  11. XMLField xmlField = (XMLField) xmlCompositeDirectCollectionMapping.getField();
  12. XMLConversionManager xmlConversionManager = (XMLConversionManager) unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager();
  13. if (unmarshalRecord.getTypeQName() != null) {
  14. Class typeClass = xmlField.getJavaClass(unmarshalRecord.getTypeQName());
  15. value = xmlConversionManager.convertObject(value, typeClass, unmarshalRecord.getTypeQName());
  16. } else {
  17. value = xmlField.convertValueBasedOnSchemaType(value, xmlConversionManager, unmarshalRecord);
  18. }
  19. if (xmlCompositeDirectCollectionMapping.hasValueConverter()) {
  20. if (xmlCompositeDirectCollectionMapping.getValueConverter() instanceof XMLConverter) {
  21. value = ((XMLConverter) xmlCompositeDirectCollectionMapping.getValueConverter()).convertDataValueToObjectValue(value, unmarshalRecord.getSession(), unmarshalRecord.getUnmarshaller());
  22. } else {
  23. value = xmlCompositeDirectCollectionMapping.getValueConverter().convertDataValueToObjectValue(value, unmarshalRecord.getSession());
  24. }
  25. }
  26. unmarshalRecord.addAttributeValue(this, value, collection);
  27. }

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

  1. Object fieldValue = domRecord.getValues(this.getField(), this.getNullPolicy());
  2. if (fieldValue == null) {
  3. if (reuseContainer) {

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

  1. Object fieldValue = domRecord.getValues(this.getField(), this.getNullPolicy());
  2. if (fieldValue == null) {
  3. if (reuseContainer) {

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

  1. Object fieldValue = domRecord.getValues(this.getField(), this.getNullPolicy());
  2. if (fieldValue == null) {
  3. if (reuseContainer) {

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

  1. if (xmlCompositeDirectCollectionMapping.getNullPolicy().getMarshalNullRepresentation() != XMLNullRepresentationType.ABSENT_NODE) {
  2. marshalRecord.openStartElement(xPathFragment, namespaceResolver);
  3. XPathFragment nextFragment = xPathFragment.getNextFragment();
  4. xmlCompositeDirectCollectionMapping.getNullPolicy().directMarshal(nextFragment, marshalRecord, object, session, namespaceResolver);

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

  1. if (mapping.getNullPolicy().isNullRepresentedByXsiNil()) {
  2. element.setNillable(true);

相关文章