Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] [MOXy] post-processing after unmarshalling

Hi Polly,

1. You would want to use the getObject() method to get back your Object. getOriginalObject is used for events like postClone or postMerge where you may want access to the original object. OXM doesn't use any cloning so that OriginalObject wouldn't be set.

2. I believe you would just need to set the event-listener element in your deployment XML.

3. In ORM projects, there's a lot of different descriptor events that get called, but in OXM, currently, only the postBuild event gets raised. The XMLMarshalListener API provides pre and post marshal events, but those would be raised for every object (similar to JAXB event listeners) and not on a per-descriptor basis.

-Matt

polly.c.chang wrote:
Hi Matt,

This looks great!  I just need a few more clarifications:

1.  In DescriptorEvent, do I use getObject() or getOriginalObject() to get
the object with the unmarshalled data?

2.  It looks like it's possible to use this in the project.xml file using
the <events xsi:type="event-policy"/>  element.  Is that right?  I can see
by the schema to put the name of the event listener class in the
"event-listener" element, but should I also set "post-build-method" element?

3.  Just out of curiosity in case I need this later, do you have another
event callback for marshalling?

Thanks!
--Polly


Matt MacIvor wrote:
  
Hi Polly,

You can add a DescriptorEventListener on a given XMLDescriptor's event 
manager (descriptor.getEventManager().addListener(listener)).

For moxy, the only event that's invoked on DescriptorEventListeners is 
the postBuild event, which will be invoked after an object is finished 
being built. From your email, it sounds like that event callback should 
do the trick though.

Hope this helps,

-Matt

polly.c.chang wrote:

    
Hi,

Is there a way for EclipseLink to call a handler to do post-processing
      
work
  
after unmarshalling a certain class?  I found some information in the
documentation about the XMLUnmarshalListener, but it seems to listen to
unmarshal events for everything.  Is there something else that I can
      
attach
  
to just one class or one XMLDescriptor?

Thanks,
Polly


 

      
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


    
  

Back to the top