Mass-migrate to java.util.Optional
[mdsal.git] / binding2 / mdsal-binding2-api / src / main / java / org / opendaylight / mdsal / binding / javav2 / api / MountPointService.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies s.r.o. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.mdsal.binding.javav2.api;
10
11 import com.google.common.annotations.Beta;
12 import java.util.Optional;
13 import org.opendaylight.mdsal.binding.javav2.spec.base.InstanceIdentifier;
14 import org.opendaylight.yangtools.concepts.ListenerRegistration;
15
16 /**
17  *  A {@link BindingService} providing access to mount point.
18  */
19 @Beta
20 public interface MountPointService extends BindingService {
21
22     /**
23      * Returns optional of mount point at given path represented by instance identifier.
24      * @param mountPoint mount point instance identifier
25      * @return optional of mount point
26      */
27     Optional<MountPoint> getMountPoint(InstanceIdentifier<?> mountPoint);
28
29     /**
30      * Register a {@link MountPointListener} instance. Once registered, the listener will start
31      * receiving changes on the selected path.
32      *
33      * @param path given path to listen to changes
34      * @param listener {@link MountPointListener} that is being registered
35      * @param <T> listener type
36      * @return Listener registration object, which may be used to unregister
37      *         your listener using {@link ListenerRegistration#close()} to stop
38      *         delivery of mount point change events.
39      */
40     <T extends MountPointListener> ListenerRegistration<T> registerListener(InstanceIdentifier<?> path, T listener);
41 }