Do not attempt to construct invalid QNames
[netconf.git] / restconf / sal-rest-connector / src / main / java / org / opendaylight / restconf / rest / services / 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.rest.services.impl;
9
10 import com.google.common.base.Preconditions;
11 import java.util.Date;
12 import org.opendaylight.yangtools.yang.model.api.Module;
13 import org.opendaylight.yangtools.yang.model.api.ModuleImport;
14
15 /**
16  * Fake {@link ModuleImport} implementation used to attach corrent prefix mapping to fake RPCs.
17  *
18  * @author Robert Varga
19  */
20 final class FakeModuleImport implements ModuleImport {
21     private final Module module;
22
23     FakeModuleImport(final Module module) {
24         this.module = Preconditions.checkNotNull(module);
25     }
26
27     @Override
28     public String getModuleName() {
29         return module.getName();
30     }
31
32     @Override
33     public Date getRevision() {
34         return module.getRevision();
35     }
36
37     @Override
38     public String getPrefix() {
39         return module.getName();
40     }
41 }