Remove Rfc6020AbnfRule
[yangtools.git] / model / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / api / stmt / ImportStatement.java
1 /*
2  * Copyright (c) 2015 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.stmt;
9
10 import org.eclipse.jdt.annotation.NonNull;
11 import org.eclipse.jdt.annotation.Nullable;
12 import org.opendaylight.yangtools.yang.common.UnresolvedQName.Unqualified;
13 import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
14 import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
15
16 /**
17  * Declared representation of a {@code import} statement.
18  */
19 public interface ImportStatement extends DocumentedDeclaredStatement<Unqualified> {
20     @Override
21     default StatementDefinition statementDefinition() {
22         return YangStmtMapping.IMPORT;
23     }
24
25     default @NonNull PrefixStatement getPrefix() {
26         return findFirstDeclaredSubstatement(PrefixStatement.class).get();
27     }
28
29     default @Nullable RevisionDateStatement getRevisionDate() {
30         final var opt = findFirstDeclaredSubstatement(RevisionDateStatement.class);
31         return opt.isPresent() ? opt.orElseThrow() : null;
32     }
33 }