Class AbstractSchemaContext

    • Field Detail

      • REVISION_COMPARATOR

        protected static final Comparator<Module> REVISION_COMPARATOR
        A Module comparator based on Module.getRevision(), placing latest revision first. Note this comparator does not take into account module name and so two modules with different names but same revisions compare as equal.
      • NAME_REVISION_COMPARATOR

        protected static final Comparator<Module> NAME_REVISION_COMPARATOR
        A Module comparator based on Module.getName() and Module.getRevision(), ordering modules lexicographically by their name and then in order of descending revision. This comparator assumes that the combination of these two attributes is sufficient to be consistent with hashCode/equals.
    • Constructor Detail

      • AbstractSchemaContext

        public AbstractSchemaContext()
    • Method Detail

      • createModuleSet

        protected static final TreeSet<Module> createModuleSet()
        Create a TreeSet for containing Modules with the same name, such that the set is ordered by REVISION_COMPARATOR.
        Returns:
        A fresh TreeSet instance.
      • getNamespaceToModules

        protected abstract SetMultimap<URI,​Module> getNamespaceToModules()
        Returns the namespace-to-module mapping.
        Returns:
        Map of modules where key is namespace
      • getNameToModules

        protected abstract SetMultimap<String,​Module> getNameToModules()
        Returns the module name-to-module mapping.
        Returns:
        Map of modules where key is name of module
      • getModuleMap

        protected abstract Map<QNameModule,​Module> getModuleMap()
        Returns the namespace+revision-to-module mapping.
        Returns:
        Map of modules where key is Module's QNameModule.
      • getDataDefinitions

        public Set<DataSchemaNode> getDataDefinitions()
        Description copied from interface: SchemaContext
        Returns data schema node instances which represents direct subnodes (like leaf, leaf-list, list, container) in all YANG modules in the context.
        Specified by:
        getDataDefinitions in interface SchemaContext
        Returns:
        set of DataSchemaNode instances which represents YANG data nodes at the module top level
      • getOperations

        public Set<RpcDefinition> getOperations()
        Description copied from interface: SchemaContext
        Returns rpc definition instances which are defined as the direct subelements in all YANG modules in the context.
        Specified by:
        getOperations in interface SchemaContext
        Returns:
        set of RpcDefinition instances which represents nodes defined via rpc YANG keyword
      • getExtensions

        public Set<ExtensionDefinition> getExtensions()
        Description copied from interface: SchemaContext
        Returns extension definition instances which are defined as the direct subelements in all YANG modules in the context.
        Specified by:
        getExtensions in interface SchemaContext
        Returns:
        set of ExtensionDefinition instances which represents nodes defined via extension YANG keyword
      • findModule

        public Optional<Module> findModule​(String name,
                                           Optional<Revision> revision)
        Description copied from interface: SchemaContext
        Returns module instance (from the context) with specified name and an optional revision.
        Specified by:
        findModule in interface SchemaContext
        Parameters:
        name - string with the module name
        revision - date of the module revision
        Returns:
        module instance which has name and revision the same as are the values specified in parameters name and revision.
      • findModules

        public Set<Module> findModules​(URI namespace)
        Description copied from interface: SchemaContext
        Returns module instance (from the context) with concrete namespace. Returned Set is required to have its iteration order guarantee that the latest revision is encountered first.
        Specified by:
        findModules in interface SchemaContext
        Parameters:
        namespace - URI instance with specified namespace
        Returns:
        module instance which has namespace equal to the namespace or null in other cases
      • findModules

        public Set<Module> findModules​(String name)
        Description copied from interface: SchemaContext
        Returns module instances (from the context) with a concrete name. Returned Set is required to have its iteration order guarantee that the latest revision is encountered first.
        Specified by:
        findModules in interface SchemaContext
        Parameters:
        name - string with the module name
        Returns:
        set of module instances with specified name.
      • isAugmenting

        @Deprecated
        public boolean isAugmenting()
        Deprecated.
        Description copied from interface: CopyableNode
        Returns true if this node was added by augmentation, otherwise returns false.
        Specified by:
        isAugmenting in interface CopyableNode
        Returns:
        true if this node was added by augmentation, otherwise returns false
      • isAddedByUses

        @Deprecated
        public boolean isAddedByUses()
        Deprecated.
        Description copied from interface: AddedByUsesAware
        Returns true if this node was added by uses statement, otherwise returns false.
        Specified by:
        isAddedByUses in interface AddedByUsesAware
        Returns:
        true if this node was added by uses statement, otherwise returns false
      • isConfiguration

        public boolean isConfiguration()
        Description copied from interface: DataSchemaNode
        Returns true if the data represents configuration data, otherwise returns false.
        Specified by:
        isConfiguration in interface DataSchemaNode
        Returns:
        true if the data represents configuration data, otherwise returns false
      • getQName

        public QName getQName()
        Description copied from interface: SchemaNode
        Returns QName of the instance of the type SchemaNode.
        Specified by:
        getQName in interface SchemaNode
        Returns:
        QName with the name of the schema node
      • getPath

        public SchemaPath getPath()
        Description copied from interface: SchemaNode
        Returns the schema path of the instance of the type SchemaNode.
        Specified by:
        getPath in interface SchemaNode
        Returns:
        schema path of the schema node
      • getUnknownSchemaNodes

        public List<UnknownSchemaNode> getUnknownSchemaNodes()
        Description copied from interface: DocumentedNode
        Returns unknown schema nodes which belongs to this instance. Default implementation returns an empty list.
        Specified by:
        getUnknownSchemaNodes in interface DocumentedNode
        Returns:
        list of unknown schema nodes defined under this node.
      • getChildNodes

        public Set<DataSchemaNode> getChildNodes()
        Description copied from interface: DataNodeContainer
        Returns set of all child nodes defined within this DataNodeContainer. Although the return type is a collection, each node is guaranteed to be present at most once.

        Note that the nodes returned are NOT data nodes, but rather DataSchemaNodes, hence ChoiceSchemaNode and CaseSchemaNode are present instead of their children. This is consistent with schema tree.

        Specified by:
        getChildNodes in interface DataNodeContainer
        Returns:
        child nodes in lexicographical order
      • getUses

        public Set<UsesNode> getUses()
        Description copied from interface: DataNodeContainer
        Returns grouping nodes used ny this container.
        Specified by:
        getUses in interface DataNodeContainer
        Returns:
        Set of all uses nodes defined within this DataNodeContainer
      • isPresenceContainer

        public boolean isPresenceContainer()
        Description copied from interface: ContainerSchemaNode
        Returns true if this container is marked as presence.
        Specified by:
        isPresenceContainer in interface ContainerSchemaNode
        Returns:
        true, if presence of this container has an explicit meaning, false otherwise