コード例 #1
0
 /**
  * INTERNAL: When using the DOM Platform, this method is responsible for marshalling null values
  * for the XML Composite Object Mapping.
  *
  * @param record
  * @param object
  * @param field
  * @return true if this method caused any objects to be marshaled, else false.
  */
 public boolean compositeObjectMarshal(
     AbstractMarshalRecord record, Object object, Field field, CoreAbstractSession session) {
   if (marshalNullRepresentation == XMLNullRepresentationType.XSI_NIL) {
     record.put(field, XMLRecord.NIL);
     return true;
   } else {
     // EMPTY_NODE - Write out empty element - Required
     if (marshalNullRepresentation == XMLNullRepresentationType.EMPTY_NODE) {
       Node element = XPathEngine.getInstance().createUnownedElement(record.getDOM(), field);
       record.put(field, element);
       return true;
     } else {
       // ABSENT_NODE - Write out nothing - Optional
       return false;
     }
   }
 }
コード例 #2
0
 /** INTERNAL */
 public void directMarshal(Field field, AbstractMarshalRecord record, Object object) {
   Object fieldValue = null;
   if (marshalNullRepresentation == XMLNullRepresentationType.EMPTY_NODE) {
     fieldValue = Constants.EMPTY_STRING;
   } else {
     if (!field.getLastXPathFragment().isAttribute()) {
       if (marshalNullRepresentation == XMLNullRepresentationType.XSI_NIL) {
         fieldValue = XMLRecord.NIL;
       }
     }
   }
   record.put(field, fieldValue);
 }
コード例 #3
0
 @Override
 public List<Namespace> addExtraNamespacesToNamespaceResolver(
     Descriptor desc,
     AbstractMarshalRecord marshalRecord,
     CoreAbstractSession session,
     boolean allowOverride,
     boolean ignoreEqualResolvers) {
   if (rootXPathNode.getNonAttributeChildren() == null) {
     return null;
   } else {
     return marshalRecord.addExtraNamespacesToNamespaceResolver(
         desc, session, allowOverride, ignoreEqualResolvers);
   }
 }