Use DOMMountPointServiceHandler non-statically
[netconf.git] / restconf / restconf-nb-rfc8040 / src / main / java / org / opendaylight / restconf / nb / rfc8040 / handlers / DOMMountPointServiceHandler.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. 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 package org.opendaylight.restconf.nb.rfc8040.handlers;
9
10 import java.util.Objects;
11 import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
12
13 /**
14  * Implementation of {@link DOMMountPointServiceHandler}.
15  *
16  */
17 public final class DOMMountPointServiceHandler implements Handler<DOMMountPointService> {
18     private static final DOMMountPointServiceHandler INSTANCE = new DOMMountPointServiceHandler();
19
20     private DOMMountPointService domMountPointService;
21
22     /**
23      * Prepare mount point service for Restconf services.
24      *
25      * @param domMountPointService
26      *             mount point service
27      */
28     private DOMMountPointServiceHandler(final DOMMountPointService domMountPointService) {
29         this.domMountPointService = Objects.requireNonNull(domMountPointService);
30     }
31
32     @Deprecated
33     private DOMMountPointServiceHandler() {
34     }
35
36     @Deprecated
37     public static DOMMountPointServiceHandler instance() {
38         return INSTANCE;
39     }
40
41     public static DOMMountPointServiceHandler newInstance(DOMMountPointService domMountPointService) {
42         INSTANCE.domMountPointService = domMountPointService;
43         return INSTANCE;
44     }
45
46     @Override
47     public DOMMountPointService get() {
48         return this.domMountPointService;
49     }
50 }