Class YangModelDependencyInfo
- java.lang.Object
-
- org.opendaylight.yangtools.yang.parser.rfc7950.repo.YangModelDependencyInfo
-
- Direct Known Subclasses:
YangModelDependencyInfo.ModuleDependencyInfo
,YangModelDependencyInfo.SubmoduleDependencyInfo
public abstract class YangModelDependencyInfo extends Object
Helper transfer object which holds basic and dependency information for YANG model.There are two concrete implementations of this interface:
YangModelDependencyInfo.ModuleDependencyInfo
- Dependency information for moduleYangModelDependencyInfo.SubmoduleDependencyInfo
- Dependency information for submodule
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
YangModelDependencyInfo.ModuleDependencyInfo
Dependency information for YANG module.static class
YangModelDependencyInfo.SubmoduleDependencyInfo
Dependency information for submodule, also provides name for parent module.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
static SemVer
findSemanticVersion(IRStatement statement, SourceIdentifier source)
static @NonNull YangModelDependencyInfo
forIR(IRSchemaSource source)
ExtractsYangModelDependencyInfo
from an intermediate representation root statement of a YANG model.static YangModelDependencyInfo
forYangText(YangTextSchemaSource yangText)
ExtractsYangModelDependencyInfo
from aYangTextSchemaSource
.ImmutableSet<ModuleImport>
getDependencies()
Returns immutable collection of all module imports.String
getFormattedRevision()
Returns formatted revision string.static String
getLatestRevision(IRStatement module, SourceIdentifier source)
String
getName()
Returns model name.Optional<Revision>
getRevision()
Returns revision.Optional<SemVer>
getSemanticVersion()
Returns semantic version of module.int
hashCode()
-
-
-
Method Detail
-
getDependencies
public ImmutableSet<ModuleImport> getDependencies()
Returns immutable collection of all module imports. This collection contains bothimport
statements andinclude
statements for submodules.- Returns:
- Immutable collection of imports.
-
getName
public String getName()
Returns model name.- Returns:
- model name
-
getFormattedRevision
public String getFormattedRevision()
Returns formatted revision string.- Returns:
- formatted revision string
-
getRevision
public Optional<Revision> getRevision()
Returns revision.- Returns:
- revision, potentially null
-
getSemanticVersion
public Optional<SemVer> getSemanticVersion()
Returns semantic version of module.- Returns:
- semantic version
-
forIR
public static @NonNull YangModelDependencyInfo forIR(IRSchemaSource source)
ExtractsYangModelDependencyInfo
from an intermediate representation root statement of a YANG model.- Parameters:
source
- Schema source- Returns:
YangModelDependencyInfo
- Throws:
IllegalArgumentException
- If the root statement is not a valid YANG module/submodule
-
forYangText
public static YangModelDependencyInfo forYangText(YangTextSchemaSource yangText) throws IOException, YangSyntaxErrorException
ExtractsYangModelDependencyInfo
from aYangTextSchemaSource
. This parsing does not validate full YANG module, only parses header up to the revisions and imports.- Parameters:
yangText
-YangTextSchemaSource
- Returns:
YangModelDependencyInfo
- Throws:
YangSyntaxErrorException
- If the resource does not pass syntactic analysisIOException
- When the resource cannot be read
-
findSemanticVersion
@Beta public static SemVer findSemanticVersion(IRStatement statement, SourceIdentifier source)
-
getLatestRevision
public static String getLatestRevision(IRStatement module, SourceIdentifier source)
-
-