本文整理了Java中org.opendaylight.yangtools.yang.model.api.Module.getQNameModule()
方法的一些代码示例,展示了Module.getQNameModule()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Module.getQNameModule()
方法的具体详情如下:
包路径:org.opendaylight.yangtools.yang.model.api.Module
类名称:Module
方法名:getQNameModule
[英]Returns a QNameModule, which contains the namespace and the revision of the module.
[中]修订版返回模块的名称和名称。
代码示例来源:origin: opendaylight/yangtools
/**
* Returns the revision date for the module. If you need both namespace and
* revision, please consider using {@link #getQNameModule()}.
*
* @return date of the module revision which is specified as argument of
* YANG {@link Module <b><font color="#339900">revison</font></b>}
* keyword
*/
@Override
default Optional<Revision> getRevision() {
return getQNameModule().getRevision();
}
代码示例来源:origin: org.opendaylight.yangtools/yang-model-api
/**
* Returns the namespace of the module which is specified as argument of
* YANG {@link Module <b><font color="#00FF00">namespace</font></b>}
* keyword. If you need both namespace and revision, please consider using
* {@link #getQNameModule()}.
*
* @return URI format of the namespace of the module
*/
@Override
default URI getNamespace() {
return getQNameModule().getNamespace();
}
代码示例来源:origin: org.opendaylight.yangtools/yang-model-api
/**
* Returns the revision date for the module. If you need both namespace and
* revision, please consider using {@link #getQNameModule()}.
*
* @return date of the module revision which is specified as argument of
* YANG {@link Module <b><font color="#339900">revison</font></b>}
* keyword
*/
@Override
default Optional<Revision> getRevision() {
return getQNameModule().getRevision();
}
代码示例来源:origin: org.opendaylight.yangtools/yang-data-util
@Override
protected final QName createQName(final String prefix, final String localName) {
final Module module = moduleForPrefix(prefix);
checkArgument(module != null, "Failed to lookup prefix %s", prefix);
return QName.create(module.getQNameModule(), localName);
}
}
代码示例来源:origin: opendaylight/yangtools
@Override
protected final QName createQName(final String prefix, final String localName) {
final Module module = moduleForPrefix(prefix);
checkArgument(module != null, "Failed to lookup prefix %s", prefix);
return QName.create(module.getQNameModule(), localName);
}
}
代码示例来源:origin: org.opendaylight.mdsal/mdsal-binding-generator-impl
String modulePackageName() {
String ret = modulePackageName;
if (ret == null) {
modulePackageName = ret = BindingMapping.getRootPackageName(module.getQNameModule());
}
return ret;
}
代码示例来源:origin: opendaylight/yangtools
@Override
public QName parseValue(final NamespaceContext ctx, final String str) {
return IdentityCodecUtil.parseIdentity(str, schemaContext, prefix -> {
if (prefix.isEmpty()) {
return parentModule;
}
final String prefixedNS = ctx.getNamespaceURI(prefix);
final Iterator<Module> modules = schemaContext.findModules(URI.create(prefixedNS)).iterator();
checkArgument(modules.hasNext(), "Could not find module for namespace %s", prefixedNS);
return modules.next().getQNameModule();
}).getQName();
}
代码示例来源:origin: org.opendaylight.yangtools/yang-data-codec-gson
@Override
public QName parseValue(final Object ctx, final String value) {
return IdentityCodecUtil.parseIdentity(value, schemaContext, prefix -> {
if (prefix.isEmpty()) {
return parentModule;
}
final Iterator<Module> modules = schemaContext.findModules(prefix).iterator();
checkArgument(modules.hasNext(), "Could not find module %s", prefix);
return modules.next().getQNameModule();
}).getQName();
}
代码示例来源:origin: opendaylight/yangtools
@Override
public QName parseValue(final Object ctx, final String value) {
return IdentityCodecUtil.parseIdentity(value, schemaContext, prefix -> {
if (prefix.isEmpty()) {
return parentModule;
}
final Iterator<Module> modules = schemaContext.findModules(prefix).iterator();
checkArgument(modules.hasNext(), "Could not find module %s", prefix);
return modules.next().getQNameModule();
}).getQName();
}
代码示例来源:origin: org.opendaylight.yangtools/yang-data-impl
@Override
public void enterPrefix(final PrefixContext ctx) {
final String prefix = ctx.getText();
if (!leafrefModule.getPrefix().equals(prefix)) {
final Optional<QNameModule> qnameModuleOpt = getQNameModuleForImportPrefix(leafrefModule, prefix);
checkArgument(qnameModuleOpt.isPresent(), "No module import for prefix: %s in module: %s", prefix,
leafrefModule.getName());
currentQnameModule = qnameModuleOpt.get();
} else {
currentQnameModule = leafrefModule.getQNameModule();
}
}
代码示例来源:origin: org.opendaylight.mdsal/mdsal-binding-generator-impl
List<Type> toTypes(final Set<Module> modules) {
final List<Type> filteredGenTypes = new ArrayList<>();
for (final Module m : modules) {
filteredGenTypes.addAll(moduleContext(m.getQNameModule()).getGeneratedTypes());
final Set<Type> additionalTypes = typeProvider().getAdditionalTypes().get(m);
if (additionalTypes != null) {
filteredGenTypes.addAll(additionalTypes);
}
}
return filteredGenTypes;
}
代码示例来源:origin: opendaylight/yangtools
@Override
public void enterPrefix(final PrefixContext ctx) {
final String prefix = ctx.getText();
if (!leafrefModule.getPrefix().equals(prefix)) {
final Optional<QNameModule> qnameModuleOpt = getQNameModuleForImportPrefix(leafrefModule, prefix);
checkArgument(qnameModuleOpt.isPresent(), "No module import for prefix: %s in module: %s", prefix,
leafrefModule.getName());
currentQnameModule = qnameModuleOpt.get();
} else {
currentQnameModule = leafrefModule.getQNameModule();
}
}
代码示例来源:origin: opendaylight/yangtools
private QName createQName(final String prefix, final String localName) {
final Module module = schemaContext.findModule(schemaNode.getQName().getModule()).get();
if (prefix.isEmpty() || module.getPrefix().equals(prefix)) {
return QName.create(module.getQNameModule(), localName);
}
for (final ModuleImport moduleImport : module.getImports()) {
if (prefix.equals(moduleImport.getPrefix())) {
final Module importedModule = schemaContext.findModule(moduleImport.getModuleName(),
moduleImport.getRevision()).get();
return QName.create(importedModule.getQNameModule(),localName);
}
}
throw new IllegalArgumentException(String.format("Failed to lookup a module for prefix %s", prefix));
}
代码示例来源:origin: opendaylight/yangtools
@Override
protected final QName createQName(final String prefix, final String localName) {
final Module module = moduleForPrefix(prefix);
checkArgument(module != null, "Failed to lookup prefix %s", prefix);
final QName qname = QName.create(module.getQNameModule(), localName);
for (IdentitySchemaNode identity : module.getIdentities()) {
if (qname.equals(identity.getQName())) {
return identity.getQName();
}
}
throw new IllegalArgumentException("Failed to find identity matching " + qname);
}
}
代码示例来源:origin: org.opendaylight.controller/sal-rest-connector
private QName toQName(final String name, final Date revisionDate) {
checkPreconditions();
final String module = toModuleName(name);
final String node = toNodeName(name);
final Module m = globalSchema.findModuleByName(module, revisionDate);
return m == null ? null : QName.create(m.getQNameModule(), node);
}
代码示例来源:origin: org.opendaylight.netconf/sal-rest-docgen
public static String resolveNodesName(final SchemaNode node, final Module module,
final SchemaContext schemaContext) {
if (node.getQName().getNamespace().equals(module.getQNameModule().getNamespace())
&& node.getQName().getRevision().equals(module.getQNameModule().getRevision())) {
return node.getQName().getLocalName();
} else {
return resolveFullNameFromNode(node, schemaContext);
}
}
代码示例来源:origin: opendaylight/controller
private String findYangModuleName(final QName qname, final SchemaContext schemaContext)
throws ConfigXMLReaderException {
for (Module m : schemaContext.getModules()) {
if (qname.getModule().equals(m.getQNameModule())) {
return m.getName();
}
}
throw new ConfigXMLReaderException(
String.format("%s: Could not find yang module for QName %s", logName, qname));
}
代码示例来源:origin: org.opendaylight.mdsal/mdsal-binding-java-api-generator
public YangModuleInfoTemplate(final org.opendaylight.yangtools.yang.model.api.Module module, final SchemaContext ctx, final Function<org.opendaylight.yangtools.yang.model.api.Module, Optional<String>> moduleFilePathResolver) {
Preconditions.checkArgument((module != null), "Module must not be null.");
this.module = module;
this.ctx = ctx;
this.moduleFilePathResolver = moduleFilePathResolver;
this.packageName = BindingMapping.getRootPackageName(module.getQNameModule());
StringConcatenation _builder = new StringConcatenation();
_builder.append(this.packageName);
_builder.append(".");
_builder.append(BindingMapping.MODEL_BINDING_PROVIDER_CLASS_NAME);
this.modelBindingProviderName = _builder.toString();
}
代码示例来源:origin: org.opendaylight.controller/blueprint
private String findYangModuleName(QName qname, SchemaContext schemaContext) {
for(Module m: schemaContext.getModules()) {
if(qname.getModule().equals(m.getQNameModule())) {
return m.getName();
}
}
setFailureMessage(String.format("%s: Could not find yang module for QName %s", logName(), qname));
return null;
}
代码示例来源:origin: org.opendaylight.yangtools/binding-generator-impl
private void processUsesAugments(final DataNodeContainer node, final Module module) {
final String basePackageName = BindingMapping.getRootPackageName(module.getQNameModule());
for (final UsesNode usesNode : node.getUses()) {
for (final AugmentationSchema augment : usesNode.getAugmentations()) {
usesAugmentationToGenTypes(basePackageName, augment, module, usesNode, node);
processUsesAugments(augment, module);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!