Class SimpleSchemaContext
- java.lang.Object
-
- org.opendaylight.yangtools.yang.model.spi.AbstractSchemaContext
-
- org.opendaylight.yangtools.yang.model.spi.SimpleSchemaContext
-
- All Implemented Interfaces:
Immutable
,MutationBehaviour<Immutable>
,AnnotationSchemaNodeAware
,AnnotationSchemaNodeAwareSchemaContext
,ActionNodeContainer
,AddedByUsesAware
,AugmentationTarget
,ContainerLike
,CopyableNode
,DataNodeContainer
,DataSchemaNode
,DocumentedNode
,DocumentedNode.WithStatus
,MustConstraintAware
,NotificationNodeContainer
,SchemaContext
,SchemaNode
,WhenConditionAware
- Direct Known Subclasses:
EffectiveSchemaContext
@Beta public class SimpleSchemaContext extends AbstractSchemaContext implements AnnotationSchemaNodeAwareSchemaContext
Simple subclass ofAbstractSchemaContext
which performs some amount of indexing to speed up common SchemaContext operations. This implementation assumes input modules are consistent and does not perform any extensive analysis to ensure the resulting object complies to SchemaContext interface.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.opendaylight.yangtools.yang.model.api.DocumentedNode
DocumentedNode.WithStatus
-
-
Field Summary
-
Fields inherited from class org.opendaylight.yangtools.yang.model.spi.AbstractSchemaContext
NAME_REVISION_COMPARATOR, REVISION_COMPARATOR
-
Fields inherited from interface org.opendaylight.yangtools.yang.model.api.SchemaContext
NAME
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SimpleSchemaContext(Collection<? extends @NonNull Module> modules)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected MoreObjects.ToStringHelper
addToStringAttributes(MoreObjects.ToStringHelper toStringHelper)
Optional<AnnotationSchemaNode>
findAnnotation(QName qname)
Find an annotation based on its QName.static SimpleSchemaContext
forModules(Collection<? extends Module> modules)
Create a new instance from specified modules.protected Map<QNameModule,Module>
getModuleMap()
Returns the namespace+revision-to-module mapping.Set<Module>
getModules()
Returns modules which are part of the schema context.protected SetMultimap<XMLNamespace,Module>
getNamespaceToModules()
Returns the namespace-to-module mapping.protected SetMultimap<String,Module>
getNameToModules()
Returns the module name-to-module mapping.String
toString()
-
Methods inherited from class org.opendaylight.yangtools.yang.model.spi.AbstractSchemaContext
createModuleSet, dataChildByName, findModule, findModule, findModules, findModules, getChildNodes, getDataDefinitions, getDerivedIdentities, getExtensions, getGroupings, getNotifications, getOperations, getTypeDefinitions, getUnknownSchemaNodes
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.opendaylight.yangtools.yang.model.api.DataNodeContainer
dataChildByName, findDataChildByName, findDataChildByName, findDataTreeChild, findDataTreeChild, getChildNodes, getDataChildByName, getGroupings, getTypeDefinitions
-
Methods inherited from interface org.opendaylight.yangtools.yang.model.api.DataSchemaNode
isConfiguration
-
Methods inherited from interface org.opendaylight.yangtools.yang.model.api.DocumentedNode
getUnknownSchemaNodes
-
Methods inherited from interface org.opendaylight.yangtools.yang.model.api.NotificationNodeContainer
getNotifications
-
Methods inherited from interface org.opendaylight.yangtools.yang.model.api.SchemaContext
effectiveConfig, findAction, findDataTreeChild, findModule, findModule, findModule, findModule, findModule, findModule, findModule, findModules, findModules, findNotification, getActions, getAvailableAugmentations, getDataDefinitions, getDerivedIdentities, getDescription, getExtensions, getMustConstraints, getOperations, getQName, getReference, getStatus, getUses, getWhenCondition, isAddedByUses, isAugmenting
-
-
-
-
Constructor Detail
-
SimpleSchemaContext
protected SimpleSchemaContext(Collection<? extends @NonNull Module> modules)
-
-
Method Detail
-
forModules
public static SimpleSchemaContext forModules(Collection<? extends Module> modules)
Create a new instance from specified modules. Note that no module validation is done and hence the consistency of the resulting SchemaContext is completely in hands of the caller.
-
getModules
public final Set<Module> getModules()
Description copied from interface:SchemaContext
Returns modules which are part of the schema context. Returned set is required to have its iteration ordered by module revision, so that if modules are filtered byModuleLike.getName()
orQNameModuleAware.getNamespace()
, modules having the same attribute are encountered newest revision first.- Specified by:
getModules
in interfaceSchemaContext
- Returns:
- set of the modules which belong to the schema context
-
findAnnotation
public final Optional<AnnotationSchemaNode> findAnnotation(QName qname)
Description copied from interface:AnnotationSchemaNodeAware
Find an annotation based on its QName.- Specified by:
findAnnotation
in interfaceAnnotationSchemaNodeAware
- Parameters:
qname
- Annotation name- Returns:
- AnnotationSchemaNode if found
-
getModuleMap
protected Map<QNameModule,Module> getModuleMap()
Description copied from class:AbstractSchemaContext
Returns the namespace+revision-to-module mapping.- Specified by:
getModuleMap
in classAbstractSchemaContext
- Returns:
- Map of modules where key is Module's QNameModule.
-
getNamespaceToModules
protected final SetMultimap<XMLNamespace,Module> getNamespaceToModules()
Description copied from class:AbstractSchemaContext
Returns the namespace-to-module mapping.- Specified by:
getNamespaceToModules
in classAbstractSchemaContext
- Returns:
- Map of modules where key is namespace
-
getNameToModules
protected final SetMultimap<String,Module> getNameToModules()
Description copied from class:AbstractSchemaContext
Returns the module name-to-module mapping.- Specified by:
getNameToModules
in classAbstractSchemaContext
- Returns:
- Map of modules where key is name of module
-
addToStringAttributes
protected MoreObjects.ToStringHelper addToStringAttributes(MoreObjects.ToStringHelper toStringHelper)
-
-