2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.yangtools.yang.model.ri.stmt.impl.eff;
10 import com.google.common.collect.ImmutableList;
11 import java.util.Optional;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.eclipse.jdt.annotation.Nullable;
14 import org.opendaylight.yangtools.yang.common.Revision;
15 import org.opendaylight.yangtools.yang.model.api.ModuleImport;
16 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
17 import org.opendaylight.yangtools.yang.model.api.stmt.ImportEffectiveStatement;
18 import org.opendaylight.yangtools.yang.model.api.stmt.ImportStatement;
19 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
20 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
21 import org.opendaylight.yangtools.yang.model.spi.meta.EffectiveStatementMixins.DocumentedNodeMixin;
23 public final class ImportEffectiveStatementImpl extends WithSubstatements<String, ImportStatement>
24 implements ImportEffectiveStatement, ModuleImport, DocumentedNodeMixin<String, ImportStatement> {
25 private final @Nullable Revision revision;
27 public ImportEffectiveStatementImpl(final ImportStatement declared,
28 final ImmutableList<? extends EffectiveStatement<?, ?>> substatements,
29 final @NonNull SourceIdentifier importedSource) {
30 super(declared, substatements);
31 revision = importedSource.getRevision().orElse(null);
35 public Optional<Revision> getRevision() {
36 return Optional.ofNullable(revision);
40 public String getPrefix() {
41 return getDeclared().getPrefix().argument();
45 public ImportEffectiveStatement asEffectiveStatement() {