Convert to using requireNonNull()
[netconf.git] / restconf / restconf-nb-rfc8040 / src / main / java / org / opendaylight / restconf / nb / rfc8040 / services / simple / impl / FakeModuleImport.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.services.simple.impl;
9
10 import static java.util.Objects.requireNonNull;
11
12 import java.util.Optional;
13 import org.opendaylight.yangtools.concepts.SemVer;
14 import org.opendaylight.yangtools.yang.common.Revision;
15 import org.opendaylight.yangtools.yang.model.api.Module;
16 import org.opendaylight.yangtools.yang.model.api.ModuleImport;
17
18 /**
19  * Fake {@link ModuleImport} implementation used to attach corrent prefix mapping to fake RPCs.
20  *
21  * @author Robert Varga
22  */
23 final class FakeModuleImport implements ModuleImport {
24     private final Module module;
25
26     FakeModuleImport(final Module module) {
27         this.module = requireNonNull(module);
28     }
29
30     @Override
31     public String getModuleName() {
32         return module.getName();
33     }
34
35     @Override
36     public Optional<Revision> getRevision() {
37         return module.getRevision();
38     }
39
40     @Override
41     public String getPrefix() {
42         return module.getName();
43     }
44
45     @Override
46     public Optional<String> getDescription() {
47         return module.getDescription();
48     }
49
50     @Override
51     public Optional<String> getReference() {
52         return module.getReference();
53     }
54
55     @Override
56     public Optional<SemVer> getSemanticVersion() {
57         return module.getSemanticVersion();
58     }
59 }