Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » getOldValue call on Notification from validationOccurred returns null
getOldValue call on Notification from validationOccurred returns null [message #908237] Wed, 05 September 2012 01:59 Go to next message
Al B is currently offline Al BFriend
Messages: 47
Registered: June 2012
Member
Why does the getOldValue call on Notification from the validationOccurred() method return null as opposed to old value?


public void validationOccurred(ValidationEvent event) {
for (Object target : event.getValidationTargets()) {
if (target instanceof Notification) {
Notification notification = (Notification) target;
notification.getOldValue() // is always null
notification.getNewValue() // returns the new value

[Updated on: Wed, 05 September 2012 01:59]

Report message to a moderator

Re: getOldValue call on Notification from validationOccurred returns null [message #908279 is a reply to message #908237] Wed, 05 September 2012 04:38 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
AJ,

Depending on the type of notification it may well be null. I.e., if all
you did was add things to lists then no notification will have an old
value. You can set a breakpoint in ENotificationImpl's constructors to
see how they're being created and whether they're being passed the
appropriate values; the ones created by the generated models should all
be correct, but if the extended validation framework has created some
itself, those could have overlooked something...


On 05/09/2012 3:59 AM, AJ Ben wrote:
> Why does the getOldValue call on Notification from the
> validationOccurred() method return null as opposed to old value?
>
>
> public void validationOccurred(ValidationEvent event) {
> for (Object target : event.getValidationTargets()) {
> if (target instanceof Notification) {
> Notification notification = (Notification) target;
> notification.getOldValue() // is always null
> notification.getNewValue() // return the new value


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: getOldValue call on Notification from validationOccurred returns null [message #908308 is a reply to message #908279] Wed, 05 September 2012 06:13 Go to previous message
Al B is currently offline Al BFriend
Messages: 47
Registered: June 2012
Member
Thanks Ed.

Setting the breakpoint in ENotificationImpl's constructors unveiled the reason.
Previous Topic:[CDO] Editing lazy loaded objects
Next Topic:Running Ecore2Java task without headless Eclipse
Goto Forum:
  


Current Time: Fri Apr 26 01:09:50 GMT 2024

Powered by FUDForum. Page generated in 0.02109 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top