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 Deprecated 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
forResource(Class<?> refClass, String resourceName)
Deprecated, for removal: This API element is subject to removal in a future version.This method was used by testing framework and was deemed to be potentially useful to the outside world.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
-
forResource
@Deprecated(forRemoval=true) public static YangModelDependencyInfo forResource(Class<?> refClass, String resourceName) throws IOException, YangSyntaxErrorException
Deprecated, for removal: This API element is subject to removal in a future version.This method was used by testing framework and was deemed to be potentially useful to the outside world. With Java Platform Module System, though, the resource loading rules have changed to the point where we no longer can guarantee it working correctly, as the results depend on the resource path. Users are advised to useforYangText(YangTextSchemaSource)
.ExtractsYangModelDependencyInfo
from input stream containing a YANG model. This parsing does not validate full YANG module, only parses header up to the revisions and imports.- Parameters:
refClass
- Base search classresourceName
- resource name, relative to refClass- Returns:
YangModelDependencyInfo
- Throws:
YangSyntaxErrorException
- If the resource does not pass syntactic analysisIOException
- When the resource cannot be readIllegalArgumentException
- If input stream is not valid YANG stream
-
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)
-
-