[英]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. 我想在上釉列表中的ListEvent
中观察EventList
列表更改。
Surprisingly, methods getNewValue()
also also as getOldValue()
are deprecated without no any compos explanation. 令人惊讶的是,不推荐使用方法getNewValue()
以及getOldValue()
,而没有任何组合说明。
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: 将来,ListEvent将提供有关列表更改的更多信息,使其更加独立:
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 . 对于删除,它将为删除的元素提供getOldValue()进行插入,将为插入的元素提供getNewValue()进行更新,它将为新旧元素提供getOldValue()和getNewValue() 方法当前已标记已弃用,因此不宜使用,因为实施工作仍在进行中 。
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. 我认为Javadoc对实验代码没有任何注释,因此开发人员选择使用弃用来警告该库的用户。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.