Populate model/ hierarchy
[yangtools.git] / model / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / api / QNameModuleAware.java
1 /*
2  * Copyright (c) 2013 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.yangtools.yang.model.api;
9
10 import java.util.Optional;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.yangtools.yang.common.QNameModule;
13 import org.opendaylight.yangtools.yang.common.Revision;
14 import org.opendaylight.yangtools.yang.common.XMLNamespace;
15
16 public interface QNameModuleAware {
17     /**
18      * Returns a {@link QNameModule}, which contains the namespace and the revision of the module.
19      *
20      * @return QNameModule identifier.
21      */
22     @NonNull QNameModule getQNameModule();
23
24     default @NonNull XMLNamespace getNamespace() {
25         return getQNameModule().getNamespace();
26     }
27
28     default @NonNull Optional<Revision> getRevision() {
29         return getQNameModule().getRevision();
30     }
31 }