观察者模式不易观察的样板代码登记
2016-08-23
0 0 0
暂无评分
其他
如何获取积分?
Easy Observing is a library switch simplifies the use of the observer pattern (listener pattern) and eliminates the need for boilerplate code.
Key features
- Easy add/removal of observers and without creating add/remove methods.
- Notify specific (listener)methods of all observer with only one line of code!
- Because you don't have to use these features, it is very easy to rewrite your code to use this library.
Example class with a Observable member:
``` public class BeingObserved { public interface Listener{ public void onClick(BeingObserved sender, String somedata); public void onRelease(); }
//Define listeners as an Observable called "BeingObserved"
@Observable(name="BeingObserved")
private final ObserverHandler<Listener> listeners = new DefaultObserverHandler<Listener>(Listener.class);
public void notifyOnClick(){
//notify all the observer by specifying the method na
代码
模式
登记
观察
样板
观察者
相关源码推荐
基于matlab的车牌识别
0
0
暂无评分
爱心 打火机与公主裙
0
0
暂无评分
英伟达nccl
0
0
暂无评分
萝丽8通道接收机代码
0
0
暂无评分
阿斯顿的说法是
0
0
暂无评分
暂无评论