简体   繁体   中英

Why do getNewValue() and getOldValue() are deprecated in ListEvent class in Glazed Lists?

I would like to observe list changes in EventList with ListEvent in Glazed Lists.

Surprisingly, methods getNewValue() also also as getOldValue() are deprecated without no any compos explanation.

Why?

How to know, which elements are added or removed then?

It's not ideal because deprecation is reserved for old code/approaches which are being retired. In this instance it would have better to annotate as "experimental" because what the developer is trying to say is "be careful, this is new and may change. Don't rely on it yet."

See the description in the docs (I've emphasised the key line):

In the future, ListEvent will provide even more information about the list changes to be more self-contained:

for deletes, it will provide the deleted element with getOldValue() for inserts, it will provide the inserted element with getNewValue() for updates, it will provide the old and new element with getOldValue() and getNewValue() The methods are currently marked as deprecated and should not be used yet, because the implementation is a work in progress .

I don't think Javadoc has any annotation for experimental code, so the developer has chosen to use deprecation to warn users of the library.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM