简体   繁体   English

为什么在釉面列表的ListEvent类中不赞成使用getNewValue()和getOldValue()?

[英]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.

相关问题 JFormattedTextField和PropertyChangeListener event.getOldValue()和event.getNewValue()返回null - JFormattedTextField and PropertyChangeListener event.getOldValue() and event.getNewValue() returning null 上釉清单 - 默认排序? - glazed lists - default sorting? BeansBinding,JGoodies Binding,JFace还是釉面列表? - BeansBinding, JGoodies Binding, JFace, or Glazed Lists? 使用Glazed列表和JXTable进行表外列排序 - Out-of-table column sorting with Glazed Lists and a JXTable 当源对象顺序属性更改时,上釉列表SortedList更新 - Glazed Lists SortedList update when source object order property changed 如何从Glazed List构建HTML表? - How do I build a HTML table from Glazed List? 为什么我们使用了已弃用的方法或 class。 我们如何决定完全删除弃用方法/类的时间范围? - Why do we have deprecated methods or class in use. How do we decide the time frame of deprecation method/class to be completely removed? 为什么我们在 Lists 类中有 TwoPlusArrayList 和 OnePlusArrayList ? - Why Do we have TwoPlusArrayList and OnePlusArrayList inside Lists class? 如何对玻璃树列表进行排序? - How to sort glazed TreeList? 为什么 Java Vector(和 Stack)类被认为已过时或已弃用? - Why is Java Vector (and Stack) class considered obsolete or deprecated?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM