BaseAttributeFilter.java 文件源码

java
阅读 21 收藏 0 点赞 0 评论 0

项目:lazycat 作者:
/**
 * <p>
 * Test whether notification enabled for this event. Return true if:
 * </p>
 * <ul>
 * <li>This is an attribute change notification</li>
 * <li>Either the set of accepted names is empty (implying that all
 * attribute names are of interest) or the set of accepted names includes
 * the name of the attribute in this notification</li>
 * </ul>
 */
@Override
public boolean isNotificationEnabled(Notification notification) {

    if (notification == null)
        return (false);
    if (!(notification instanceof AttributeChangeNotification))
        return (false);
    AttributeChangeNotification acn = (AttributeChangeNotification) notification;
    if (!AttributeChangeNotification.ATTRIBUTE_CHANGE.equals(acn.getType()))
        return (false);
    synchronized (names) {
        if (names.size() < 1)
            return (true);
        else
            return (names.contains(acn.getAttributeName()));
    }

}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号