2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.mdsal.dom.store.inmemory.tree;
10 import org.opendaylight.mdsal.dom.store.inmemory.DataChangeListenerRegistration;
12 import org.opendaylight.mdsal.dom.spi.RegistrationTreeNode;
13 import com.google.common.base.Optional;
14 import com.google.common.base.Preconditions;
15 import java.util.Collection;
16 import org.opendaylight.yangtools.concepts.Identifiable;
17 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
18 import org.opendaylight.yangtools.yang.data.api.schema.tree.StoreTreeNode;
21 * This is a single node within the listener tree. Note that the data returned from
22 * and instance of this class is guaranteed to have any relevance or consistency
23 * only as long as the {@link ListenerWalker} instance through which it is reached remains
26 * @author Robert Varga
28 * @deprecated Use {@link RegistrationTreeNode} instead.
31 public class ListenerNode implements StoreTreeNode<ListenerNode>, Identifiable<PathArgument> {
32 final RegistrationTreeNode<DataChangeListenerRegistration<?>> delegate;
34 ListenerNode(final RegistrationTreeNode<DataChangeListenerRegistration<?>> delegate) {
35 this.delegate = Preconditions.checkNotNull(delegate);
39 public PathArgument getIdentifier() {
40 return delegate.getIdentifier();
44 public Optional<ListenerNode> getChild(final PathArgument child) {
45 final RegistrationTreeNode<DataChangeListenerRegistration<?>> c = delegate.getExactChild(child);
47 return Optional.absent();
50 return Optional.of(new ListenerNode(c));
54 * Return the list of current listeners. This collection is guaranteed
55 * to be immutable only while the walker, through which this node is
56 * reachable remains unclosed.
58 * @return the list of current listeners
60 public Collection<DataChangeListenerRegistration<?>> getListeners() {
61 return delegate.getRegistrations();
65 public int hashCode() {
66 return delegate.hashCode();
70 public boolean equals(final Object obj) {
71 return delegate.equals(obj);
75 public String toString() {
76 return delegate.toString();