Another solution is to move that field to a separate class, where the construction process can guarantee that the correct initialization data is supplied by the user.
另外一个解决方案是把这个字段转移到一个单独的类中,这样构造过程可以保证用户可以提供正确的初始化数据。
If a new field is added to the bean, there are three more lines to add for initialization and synchronization in each direction between the GUI components and domain model.
如果向Bean中添加新字段,则需要添加另外三行代码进行初始化以及在GUI组件和域模型实现双向同步。
Consider the following code, where the intention is that the volatile field initialized is supposed to indicate that initialization has been completed.
考虑下面的代码,其意图是假定易失性字段initialized用于表明初始化已经完成了。
应用推荐