• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Module类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.opendaylight.yangtools.yang.model.api.Module的典型用法代码示例。如果您正苦于以下问题:Java Module类的具体用法?Java Module怎么用?Java Module使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Module类属于org.opendaylight.yangtools.yang.model.api包,在下文中一共展示了Module类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: findSIE

import org.opendaylight.yangtools.yang.model.api.Module; //导入依赖的package包/类
private static ServiceInterfaceEntry findSIE(final String prefixAndIdentityLocalName, final Module currentModule,
        final Map<QName, ServiceInterfaceEntry> qNamesToSIEs, final SchemaContext schemaContext) {

    Matcher m = PREFIX_COLON_LOCAL_NAME.matcher(prefixAndIdentityLocalName);
    Module foundModule;
    String localSIName;
    if (m.matches()) {
        // if there is a prefix, look for ModuleImport with this prefix. Get
        // Module from SchemaContext
        String prefix = m.group(1);
        ModuleImport moduleImport = findModuleImport(currentModule, prefix);
        foundModule = schemaContext.findModuleByName(moduleImport.getModuleName(), moduleImport.getRevision());
        checkNotNull(foundModule, format("Module not found in SchemaContext by %s", moduleImport));
        localSIName = m.group(2);
    } else {
        foundModule = currentModule; // no prefix => SIE is in currentModule
        localSIName = prefixAndIdentityLocalName;
    }
    QName siQName = QName.create(foundModule.getNamespace(), foundModule.getRevision(), localSIName);
    ServiceInterfaceEntry sie = qNamesToSIEs.get(siQName);
    checkState(sie != null, "Cannot find referenced Service Interface by " + prefixAndIdentityLocalName);
    return sie;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:24,代码来源:ModuleMXBeanEntryBuilder.java


示例2: getPackageName

import org.opendaylight.yangtools.yang.model.api.Module; //导入依赖的package包/类
/**
 * Based on mapping, find longest matching key and return value plus the
 * remaining part of namespace, with colons replaced by dots. Example:
 * Mapping [ 'urn:opendaylight:params:xml:ns:yang:controller' :
 * 'org.opendaylight.controller'] and module with namespace
 * 'urn:opendaylight:params:xml:ns:yang:controller:threads:api' will result
 * in 'org.opendaylight.controller.threads.api' .
 *
 * @throws IllegalStateException
 *             if there is no mapping found.
 */
public String getPackageName(final Module module) {
    Entry<String, String> longestMatch = null;
    int longestMatchLength = 0;
    final String namespace = module.getNamespace().toString();
    for (final Entry<String, String> entry : this.namespacePrefixToPackageMap
            .entrySet()) {
        if (namespace.startsWith(entry.getKey())
                && (entry.getKey().length() > longestMatchLength)) {
            longestMatch = entry;
            longestMatchLength = entry.getKey().length();
        }
    }
    if (longestMatch != null) {
        return longestMatch.getValue()
                + sanitizePackage(namespace.substring(longestMatchLength));
    } else {
        return BindingGeneratorUtil.moduleNamespaceToPackageName(module);
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:31,代码来源:PackageTranslator.java


示例3: loadYangs

import org.opendaylight.yangtools.yang.model.api.Module; //导入依赖的package包/类
private Module loadYangs(final File testedModule, final String moduleName)
        throws Exception {
    final List<InputStream> yangISs = new ArrayList<>();
    yangISs.addAll(getStreams("/ietf-inet-types.yang"));

    yangISs.add(new FileInputStream(testedModule));

    yangISs.addAll(getConfigApiYangInputStreams());

    this.context =  YangParserTestUtils.parseYangStreams(yangISs);
    // close ISs
    for (final InputStream is : yangISs) {
        is.close();
    }
    this.namesToModules = YangModelSearchUtils.mapModulesByNames(this.context
            .getModules());
    this.configModule = this.namesToModules.get(ConfigConstants.CONFIG_MODULE);
    final Module module = this.namesToModules.get(moduleName);
    Preconditions.checkNotNull(module, "Cannot get module %s from %s",
            moduleName, this.namesToModules.keySet());
    return module;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:23,代码来源:ModuleMXBeanEntryNameConflictTest.java


示例4: assertAllIdentitiesAreExpected

import org.opendaylight.yangtools.yang.model.api.Module; //导入依赖的package包/类
private void assertAllIdentitiesAreExpected(
        Module module,
        Map<String /* identity name */, Optional<QName>> expectedIdentitiesToBases) {
    Map<String /* identity name */, Optional<QName>> copyOfExpectedNames = new HashMap<>(
            expectedIdentitiesToBases);
    for (IdentitySchemaNode id : module.getIdentities()) {
        String localName = id.getQName().getLocalName();
        assertTrue("Unexpected identity " + localName,
                copyOfExpectedNames.containsKey(localName));
        Optional<QName> maybeExpectedBaseQName = copyOfExpectedNames
                .remove(localName);
        if (maybeExpectedBaseQName.isPresent()) {
            assertEquals("Unexpected base identity of " + localName,
                    maybeExpectedBaseQName.get(), id.getBaseIdentity()
                            .getQName());
        }
    }
    assertEquals("Expected identities not found " + copyOfExpectedNames,
            Collections.emptyMap(), copyOfExpectedNames);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:21,代码来源:SchemaContextTest.java


示例5: transformIdentities

import org.opendaylight.yangtools.yang.model.api.Module; //导入依赖的package包/类
private static Map<String, Map<Date, IdentityMapping>> transformIdentities(final Set<Module> modules) {
    Map<String, Map<Date, IdentityMapping>> mappedIds = new HashMap<>();
    for (Module module : modules) {
        String namespace = module.getNamespace().toString();
        Map<Date, IdentityMapping> revisionsByNamespace = mappedIds.computeIfAbsent(namespace,
            k -> new HashMap<>());

        Date revision = module.getRevision();

        IdentityMapping identityMapping = revisionsByNamespace.computeIfAbsent(revision,
            k -> new IdentityMapping());

        for (IdentitySchemaNode identitySchemaNode : module.getIdentities()) {
            identityMapping.addIdSchemaNode(identitySchemaNode);
        }

    }

    return mappedIds;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:21,代码来源:ConfigSubsystemFacade.java


示例6: createDefaultInstance

import org.opendaylight.yangtools.yang.model.api.Module; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public T createDefaultInstance(final FallbackConfigProvider fallback) throws ConfigXMLReaderException,
        URISyntaxException, ParserConfigurationException, XMLStreamException, SAXException, IOException {
    YangInstanceIdentifier yangPath = bindingSerializer.toYangInstanceIdentifier(bindingContext.appConfigPath);

    LOG.debug("{}: Creating app config instance from path {}, Qname: {}", logName, yangPath,
            bindingContext.bindingQName);

    checkNotNull(schemaService, "%s: Could not obtain the SchemaService OSGi service", logName);

    SchemaContext schemaContext = schemaService.getGlobalContext();

    Module module = schemaContext.findModuleByNamespaceAndRevision(bindingContext.bindingQName.getNamespace(),
            bindingContext.bindingQName.getRevision());
    checkNotNull(module, "%s: Could not obtain the module schema for namespace %s, revision %s",
            logName, bindingContext.bindingQName.getNamespace(), bindingContext.bindingQName.getRevision());

    DataSchemaNode dataSchema = module.getDataChildByName(bindingContext.bindingQName);
    checkNotNull(dataSchema, "%s: Could not obtain the schema for %s", logName, bindingContext.bindingQName);

    checkCondition(bindingContext.schemaType.isAssignableFrom(dataSchema.getClass()),
            "%s: Expected schema type %s for %s but actual type is %s", logName,
            bindingContext.schemaType, bindingContext.bindingQName, dataSchema.getClass());

    NormalizedNode<?, ?> dataNode = parsePossibleDefaultAppConfigXMLFile(schemaContext, dataSchema);
    if (dataNode == null) {
        dataNode = fallback.get(schemaService.getGlobalContext(), dataSchema);
    }

    DataObject appConfig = bindingSerializer.fromNormalizedNode(yangPath, dataNode).getValue();

    // This shouldn't happen but need to handle it in case...
    checkNotNull(appConfig, "%s: Could not create instance for app config binding %s", logName,
            bindingContext.appConfigBindingClass);

    return (T) appConfig;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:38,代码来源:DataStoreAppConfigDefaultXMLReader.java


示例7: decomposeRpcService

import org.opendaylight.yangtools.yang.model.api.Module; //导入依赖的package包/类
static Collection<SchemaPath> decomposeRpcService(final Class<RpcService> service,
        final SchemaContext schemaContext, final Predicate<RpcRoutingStrategy> filter) {
    final QNameModule moduleName = BindingReflections.getQNameModule(service);
    final Module module = schemaContext.findModuleByNamespaceAndRevision(moduleName.getNamespace(),
            moduleName.getRevision());
    LOG.debug("Resolved service {} to module {}", service, module);

    final Collection<RpcDefinition> rpcs = module.getRpcs();
    final Collection<SchemaPath> ret = new ArrayList<>(rpcs.size());
    for (RpcDefinition rpc : rpcs) {
        final RpcRoutingStrategy strategy = RpcRoutingStrategy.from(rpc);
        if (filter.test(strategy)) {
            ret.add(rpc.getPath());
        }
    }

    return ret;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:19,代码来源:RpcUtil.java


示例8: testDeviation

import org.opendaylight.yangtools.yang.model.api.Module; //导入依赖的package包/类
@Test
public void testDeviation() throws ReactorException {
    final SchemaContext context = RFC7950Reactors.defaultReactor().newBuild()
            .addSource(sourceForResource("/model/bar.yang"))
            .addSource(sourceForResource("/context-test/deviation-test.yang"))
            .buildEffective();

    final Module testModule = context.findModule("deviation-test", Revision.of("2013-02-27")).get();
    final Set<Deviation> deviations = testModule.getDeviations();
    assertEquals(1, deviations.size());
    final Deviation dev = deviations.iterator().next();

    assertEquals(Optional.of("system/user ref"), dev.getReference());

    final URI expectedNS = URI.create("urn:opendaylight.bar");
    final Revision expectedRev = Revision.of("2013-07-03");
    final List<QName> path = new ArrayList<>();
    path.add(QName.create(expectedNS, expectedRev, "interfaces"));
    path.add(QName.create(expectedNS, expectedRev, "ifEntry"));
    final SchemaPath expectedPath = SchemaPath.create(path, true);

    assertEquals(expectedPath, dev.getTargetPath());
    assertEquals(DeviateKind.ADD, dev.getDeviates().iterator().next().getDeviateType());
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:25,代码来源:YangParserWithContextTest.java


示例9: writeToStatementWriter

import org.opendaylight.yangtools.yang.model.api.Module; //导入依赖的package包/类
static void writeToStatementWriter(final Module module, final SchemaContext ctx,
        final StatementTextWriter statementWriter, final boolean emitInstantiated) {
    final YangModuleWriter yangSchemaWriter = SchemaToStatementWriterAdaptor.from(statementWriter);
    final Map<QName, StatementDefinition> extensions = ExtensionStatement.mapFrom(ctx.getExtensions());
    if (module instanceof EffectiveStatement && !emitInstantiated) {
        /*
         * if module is an effective statement and we don't want to export
         * instantiated statements (e.g. statements added by uses or
         * augment) we can get declared form i.e. ModuleStatement and then
         * use DeclaredSchemaContextEmitter
         */
        new DeclaredSchemaContextEmitter(yangSchemaWriter, extensions, module.getYangVersion())
        .emitModule(((EffectiveStatement<?, ?>) module).getDeclared());
    } else {
        /*
         * if we don't have access to declared form of supplied module or we
         * want to emit also instantiated statements (e.g. statements added
         * by uses or augment), we use EffectiveSchemaContextEmitter.
         */
        new EffectiveSchemaContextEmitter(yangSchemaWriter, extensions, module.getYangVersion(), emitInstantiated)
        .emitModule(module);
    }
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:24,代码来源:SchemaContextEmitter.java


示例10: testImplicitInputAndOutput

import org.opendaylight.yangtools.yang.model.api.Module; //导入依赖的package包/类
@Test
public void testImplicitInputAndOutput() throws Exception {
    final SchemaContext schemaContext = StmtTestUtils.parseYangSource("/rpc-stmt-test/bar.yang");
    assertNotNull(schemaContext);

    final Module barModule = schemaContext.findModule("bar", Revision.of("2016-11-25")).get();
    final Set<RpcDefinition> rpcs = barModule.getRpcs();
    assertEquals(1, rpcs.size());

    final RpcDefinition barRpc = rpcs.iterator().next();

    final ContainerSchemaNode input = barRpc.getInput();
    assertNotNull(input);
    assertEquals(2, input.getChildNodes().size());
    assertEquals(StatementSource.CONTEXT, ((EffectiveStatement<?, ?>) input).getDeclared().getStatementSource());

    final ContainerSchemaNode output = barRpc.getOutput();
    assertNotNull(output);
    assertEquals(2, output.getChildNodes().size());
    assertEquals(StatementSource.CONTEXT, ((EffectiveStatement<?, ?>) output).getDeclared().getStatementSource());
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:22,代码来源:RpcStmtTest.java


示例11: testCorrectAugment

import org.opendaylight.yangtools.yang.model.api.Module; //导入依赖的package包/类
@Test
public void testCorrectAugment() throws Exception {
    context = TestUtils.loadModules(getClass().getResource("/augment-to-extension-test/correct-augment").toURI());

    final Module devicesModule = TestUtils.findModule(context, "augment-module").get();

    final ContainerSchemaNode devicesContainer = (ContainerSchemaNode) devicesModule.getDataChildByName(QName
            .create(devicesModule.getQNameModule(), "my-container"));
    final Set<UsesNode> uses = devicesContainer.getUses();

    boolean augmentationIsInContainer = false;
    for (final UsesNode usesNode : uses) {
        final Set<AugmentationSchemaNode> augmentations = usesNode.getAugmentations();
        for (final AugmentationSchemaNode augmentationSchema : augmentations) {
            augmentationIsInContainer = true;
        }
    }

    assertTrue(augmentationIsInContainer);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:21,代码来源:AugmentToExtensionTest.java


示例12: testBasicSubmodule

import org.opendaylight.yangtools.yang.model.api.Module; //导入依赖的package包/类
@Test
public void testBasicSubmodule() {
    Module moduleConfig = mockModule(CONFIG_NAME);
    Module module2 = mockModule(MODULE2_NAME);
    Module module3 = mockModule(MODULE3_NAME);
    Module module4 = mockModule(MODULE4_NAME);
    Module module41 = mockModule(MODULE41_NAME);

    mockSubmodules(module4, module41);
    mockModuleImport(module2, moduleConfig, module3);
    mockModuleImport(module41, moduleConfig);

    SchemaContext schemaContext = mockSchema(moduleConfig, module2, module3, module4);

    FilteringSchemaContextProxy filteringSchemaContextProxy = createProxySchemaCtx(schemaContext, null,
            moduleConfig);
    assertProxyContext(filteringSchemaContextProxy, moduleConfig, module2, module3, module4);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:19,代码来源:SchemaContextProxyTest.java


示例13: testChainAdditionalModulesConfig

import org.opendaylight.yangtools.yang.model.api.Module; //导入依赖的package包/类
@Test
public void testChainAdditionalModulesConfig() {
    Module moduleConfig = mockModule(CONFIG_NAME);
    Module module2 = mockModule(MODULE2_NAME);

    Module module3 = mockModule(MODULE3_NAME);
    Module module4 = mockModule(MODULE4_NAME);
    Module module5 = mockModule(MODULE5_NAME);

    mockModuleImport(module2, moduleConfig);
    mockModuleImport(module3, module4);

    SchemaContext schemaContext = mockSchema(moduleConfig, module2, module3, module4, module5);

    FilteringSchemaContextProxy filteringSchemaContextProxy = createProxySchemaCtx(schemaContext,
        Collections.singleton(module3), moduleConfig);
    assertProxyContext(filteringSchemaContextProxy, moduleConfig, module2, module3, module4);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:19,代码来源:SchemaContextProxyTest.java


示例14: testDeclaredAugment

import org.opendaylight.yangtools.yang.model.api.Module; //导入依赖的package包/类
@Test
public void testDeclaredAugment() throws ReactorException {
    final StatementStreamSource augmentStmtModule =
            sourceForResource("/declared-statements-test/augment-declared-test.yang");

    final SchemaContext schemaContext = StmtTestUtils.parseYangSources(augmentStmtModule);
    assertNotNull(schemaContext);

    final Module testModule = schemaContext.findModules("augment-declared-test").iterator().next();
    assertNotNull(testModule);

    final Set<AugmentationSchemaNode> augmentationSchemas = testModule.getAugmentations();
    assertNotNull(augmentationSchemas);
    assertEquals(1, augmentationSchemas.size());

    final AugmentationSchemaNode augmentationSchema = augmentationSchemas.iterator().next();
    final AugmentStatement augmentStatement = ((AugmentEffectiveStatement) augmentationSchema).getDeclared();

    final SchemaNodeIdentifier targetNode = augmentStatement.getTargetNode();
    assertNotNull(targetNode);

    final Collection<? extends DataDefinitionStatement> augmentStatementDataDefinitions =
            augmentStatement.getDataDefinitions();
    assertNotNull(augmentStatementDataDefinitions);
    assertEquals(1, augmentStatementDataDefinitions.size());
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:27,代码来源:DeclaredStatementsTest.java


示例15: testAddedByUsesLeafTypeQName

import org.opendaylight.yangtools.yang.model.api.Module; //导入依赖的package包/类
@Test
public void testAddedByUsesLeafTypeQName() throws Exception {
    final SchemaContext loadModules = TestUtils.loadModules(getClass().getResource("/added-by-uses-leaf-test")
            .toURI());
    assertEquals(2, loadModules.getModules().size());
    foo = TestUtils.findModule(loadModules, "foo").get();
    final Module imp = TestUtils.findModule(loadModules, "import-module").get();

    final LeafSchemaNode leaf = (LeafSchemaNode) ((ContainerSchemaNode) foo.getDataChildByName(QName.create(
            foo.getQNameModule(), "my-container")))
            .getDataChildByName(QName.create(foo.getQNameModule(), "my-leaf"));

    TypeDefinition<?> impType = null;
    final Set<TypeDefinition<?>> typeDefinitions = imp.getTypeDefinitions();
    for (final TypeDefinition<?> typeDefinition : typeDefinitions) {
        if (typeDefinition.getQName().getLocalName().equals("imp-type")) {
            impType = typeDefinition;
            break;
        }
    }

    assertNotNull(impType);
    assertEquals(leaf.getType().getQName(), impType.getQName());
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:25,代码来源:GroupingTest.java


示例16: processModules

import org.opendaylight.yangtools.yang.model.api.Module; //导入依赖的package包/类
/**
 * Extract dependencies from modules to fill dependency graph.
 */
private static void processModules(final Table<String, Optional<Revision>, ModuleNodeImpl> moduleGraph,
        final Iterable<Module> modules) {

    // Process nodes
    for (final Module momb : modules) {

        final String name = momb.getName();
        final Optional<Revision> rev = momb.getRevision();
        final Map<Optional<Revision>, ModuleNodeImpl> revs = moduleGraph.row(name);
        if (revs.containsKey(rev)) {
            throw new IllegalArgumentException(String.format("Module:%s with revision:%s declared twice", name,
                formatRevDate(rev)));
        }

        revs.put(rev, new ModuleNodeImpl(name, rev.orElse(null), momb));
    }
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:21,代码来源:ModuleDependencySort.java


示例17: test

import org.opendaylight.yangtools.yang.model.api.Module; //导入依赖的package包/类
@Test
public void test() throws Exception {
    final SchemaContext schema = YangParserTestUtils.parseYangResourceDirectory("/bugs/bug2444/yang");
    assertNotNull(schema);

    final ImmutableSet<Module> modulesAndSubmodules = getAllModulesAndSubmodules(schema);
    for (final Module module : modulesAndSubmodules) {
        final OutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        final BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(byteArrayOutputStream);
        try {
            YinExportUtils.writeModuleToOutputStream(schema, module, bufferedOutputStream);
            final String output = byteArrayOutputStream.toString();
            assertNotNull(output);
            assertNotEquals(0, output.length());

            final Document doc = YinExportTestUtils.loadDocument("/bugs/bug2444/yin", module);
            assertXMLEquals(module.getName(), doc, output);
        } finally {
            byteArrayOutputStream.close();
            bufferedOutputStream.close();
        }
    }
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:24,代码来源:Bug2444Test.java


示例18: test

import org.opendaylight.yangtools.yang.model.api.Module; //导入依赖的package包/类
@Test
public void test() throws Exception {
    SchemaContext schema = YangParserTestUtils.parseYangResourceDirectory("/bugs/bug5531");

    assertNotNull(schema);
    assertNotNull(schema.getModules());
    assertEquals(1, schema.getModules().size());

    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(byteArrayOutputStream);

    // write small module of size less than 8kB
   for (Module module : schema.getModules()) {
       YinExportUtils.writeModuleToOutputStream(schema, module, bufferedOutputStream);
   }

    String output = byteArrayOutputStream.toString();

    // if all changes were flushed then following conditions are satisfied
    assertNotEquals("Output should not be empty", 0, output.length());
    assertTrue("Output should contains start of the module", output.contains("<module"));
    assertTrue("Output should contains end of the module", output.contains("</module>"));
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:24,代码来源:Bug5531Test.java


示例19: testIfFeatureStatementBeingIgnoredInYangDataBody

import org.opendaylight.yangtools.yang.model.api.Module; //导入依赖的package包/类
@Test
public void testIfFeatureStatementBeingIgnoredInYangDataBody() throws Exception {
    final SchemaContext schemaContext = reactor.newBuild().setSupportedFeatures(ImmutableSet.of())
            .addSources(FOOBAR_MODULE, IETF_RESTCONF_MODULE).buildEffective();
    assertNotNull(schemaContext);

    final Module foobar = schemaContext.findModule("foobar", REVISION).get();
    final List<UnknownSchemaNode> unknownSchemaNodes = foobar.getUnknownSchemaNodes();
    assertEquals(1, unknownSchemaNodes.size());

    final UnknownSchemaNode unknownSchemaNode = unknownSchemaNodes.iterator().next();
    assertTrue(unknownSchemaNode instanceof YangDataSchemaNode);
    final YangDataSchemaNode myYangDataNode = (YangDataSchemaNode) unknownSchemaNode;
    assertNotNull(myYangDataNode);

    final ContainerSchemaNode contInYangData = myYangDataNode.getContainerSchemaNode();
    assertNotNull(contInYangData);
    final ContainerSchemaNode innerCont = (ContainerSchemaNode) contInYangData.getDataChildByName(
            QName.create(foobar.getQNameModule(), "inner-cont"));
    assertNotNull(innerCont);
    final ContainerSchemaNode grpCont = (ContainerSchemaNode) contInYangData.getDataChildByName(
            QName.create(foobar.getQNameModule(), "grp-cont"));
    assertNotNull(grpCont);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:25,代码来源:YangDataExtensionTest.java


示例20: createAbsoluteLeafRefPath

import org.opendaylight.yangtools.yang.model.api.Module; //导入依赖的package包/类
/**
 * Create an absolute leafref path.
 *
 * @param leafRefPath leafRefPath
 * @param contextNodeSchemaPath contextNodeSchemaPath
 * @param module module
 * @return LeafRefPath object
 */
public static LeafRefPath createAbsoluteLeafRefPath(
        final LeafRefPath leafRefPath, final SchemaPath contextNodeSchemaPath,
        final Module module) {

    if (leafRefPath.isAbsolute()) {
        return leafRefPath;
    }

    final Deque<QNameWithPredicate> absoluteLeafRefTargetPathList = schemaPathToXPathQNames(
            contextNodeSchemaPath, module);
    final Iterator<QNameWithPredicate> leafRefTgtPathFromRootIterator = leafRefPath.getPathFromRoot().iterator();

    while (leafRefTgtPathFromRootIterator.hasNext()) {
        final QNameWithPredicate qname = leafRefTgtPathFromRootIterator.next();
        if (qname.equals(QNameWithPredicate.UP_PARENT)) {
            absoluteLeafRefTargetPathList.removeLast();
        } else {
            absoluteLeafRefTargetPathList.add(qname);
        }
    }

    return LeafRefPath.create(absoluteLeafRefTargetPathList, true);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:32,代码来源:LeafRefUtils.java



注:本文中的org.opendaylight.yangtools.yang.model.api.Module类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EasingFunction类代码示例发布时间:2022-05-22
下一篇:
Java MultiLayerTransformer类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap