本文整理了Java中org.opendaylight.yangtools.yang.binding.YangModuleInfo.getName()
方法的一些代码示例,展示了YangModuleInfo.getName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YangModuleInfo.getName()
方法的具体详情如下:
包路径:org.opendaylight.yangtools.yang.binding.YangModuleInfo
类名称:YangModuleInfo
方法名:getName
[英]Returns yang module name
[中]返回模块名
代码示例来源:origin: org.opendaylight.mdsal/yang-binding
@Override
public String toString() {
return MoreObjects.toStringHelper(this).add("name", getName()).toString();
}
};
代码示例来源:origin: org.opendaylight.yangtools/yang-binding
/**
* Given a {@link YangModuleInfo}, create a QName representing it. The QName
* is formed by reusing the module's namespace and revision using the
* module's name as the QName's local name.
*
* @param moduleInfo
* module information
* @return QName representing the module
*/
public static QName getModuleQName(final YangModuleInfo moduleInfo) {
checkArgument(moduleInfo != null, "moduleInfo must not be null.");
return QName.create(moduleInfo.getNamespace(), moduleInfo.getRevision(), moduleInfo.getName());
}
代码示例来源:origin: io.fd.hc2vpp.docs/docs-core
ModelTypeIndex() throws IOException {
namespaceToModuleIndex = collectAllModules(this.getClass().getClassLoader())
.stream()
.collect(toMap(YangModelKey::new, yangModuleInfo -> yangModuleInfo.getName().toString()));
}
代码示例来源:origin: io.fd.hc2vpp.docs/docs-core
YangModelKey(final YangModuleInfo moduleInfo) {
this.namespace = moduleInfo.getName().getNamespace().toString();
Optional<Revision> optRevision = moduleInfo.getName().getRevision();
this.revision = optRevision.isPresent() ? optRevision.get().toString() : "";
}
代码示例来源:origin: io.lighty.core/lighty-common
private static boolean hasDependency(final YangModuleInfo superiorModel, final YangModuleInfo dependency) {
for (YangModuleInfo moduleInfo: superiorModel.getImportedModules()) {
if (moduleInfo.getName().equals(dependency.getName())) {
return true;
}
hasDependency(moduleInfo, dependency);
}
return false;
}
代码示例来源:origin: io.lighty.core/lighty-common
public static void printConfiguration(final Set<YangModuleInfo> allModelsFromClasspath) {
final Set<YangModuleInfo> topLevelModels = YangModuleUtils.filterTopLevelModels(allModelsFromClasspath);
LOG.info("# top-level models list: {}", topLevelModels.size());
for (final YangModuleInfo yangModuleInfo : topLevelModels) {
final QName qname = yangModuleInfo.getName();
System.out.println("{ \"nameSpace\": \"" + qname.getNamespace() + "\", \"name\": \""
+ qname.getLocalName() + "\", \"revision\": \"" + qname.getRevision().orElse(null) + "\" },");
}
LOG.info("# top-level models list: {}", topLevelModels.size());
for (final YangModuleInfo yangModuleInfo: topLevelModels) {
System.out.println(yangModuleInfo.getClass().getCanonicalName() + ".getInstance(),");
}
}
代码示例来源:origin: org.opendaylight.yangtools/binding-generator-impl
private SourceIdentifier sourceIdentifierFrom(final YangModuleInfo moduleInfo) {
return SourceIdentifier.create(moduleInfo.getName(), Optional.of(moduleInfo.getRevision()));
}
代码示例来源:origin: io.lighty.core/lighty-common
private static Set<YangModuleInfo> filterYangModelBindingProviders(final ModuleId moduleId,
final ServiceLoader<YangModelBindingProvider> yangProviderLoader) {
Set<YangModuleInfo> filteredSet = new HashSet<>();
for (YangModelBindingProvider yangModelBindingProvider : yangProviderLoader) {
if (moduleId.getQName().equals(yangModelBindingProvider.getModuleInfo().getName())) {
filteredSet.add(yangModelBindingProvider.getModuleInfo());
}
}
return filteredSet;
}
代码示例来源:origin: io.lighty.core/lighty-common
private static void printDependencies(final Collection<YangModuleInfo> yangModuleInfos, final int prefixLength) {
for (final YangModuleInfo yangModuleInfo : yangModuleInfos) {
final QName qname = yangModuleInfo.getName();
LOG.info("{}{} {} {}", Strings.repeat(" ", prefixLength), qname.getNamespace(), qname.getLocalName(), qname.getRevision());
printDependencies(yangModuleInfo.getImportedModules(), prefixLength + PREFIX);
}
}
代码示例来源:origin: io.lighty.core/lighty-common
public static ModuleId from(final YangModuleInfo yangModuleInfo) {
final QName name = yangModuleInfo.getName();
return new ModuleId(name.getNamespace().toString(), name.getLocalName(), name.getRevision().get().toString());
}
代码示例来源:origin: org.opendaylight.mdsal/mdsal-binding-generator-impl
private static SourceIdentifier sourceIdentifierFrom(final YangModuleInfo moduleInfo) {
final QName name = moduleInfo.getName();
return RevisionSourceIdentifier.create(name.getLocalName(), name.getRevision());
}
代码示例来源:origin: io.lighty.core/lighty-common
public static void printModelInfo(final Set<YangModuleInfo> allModelsFromClasspath) {
final int prefixLength = 0;
final Set<YangModuleInfo> topLevelModels = YangModuleUtils.filterTopLevelModels(allModelsFromClasspath);
LOG.info("# top-level models tree: {}", topLevelModels.size());
for (final YangModuleInfo yangModuleInfo : topLevelModels) {
final QName qname = yangModuleInfo.getName();
LOG.info("{}", qname.getNamespace(), qname.getLocalName(), qname.getRevision());
printDependencies(yangModuleInfo.getImportedModules(), prefixLength + PREFIX);
}
LOG.info("# top-level models list: {}", topLevelModels.size());
for (final YangModuleInfo yangModuleInfo : topLevelModels) {
final QName qname = yangModuleInfo.getName();
LOG.info("{} {} {}", qname.getNamespace(), qname.getLocalName(), qname.getRevision());
}
final Set<YangModuleInfo> uniqueModels = YangModuleUtils.filterUniqueModels(allModelsFromClasspath);
LOG.info("# unique models list : {}", uniqueModels.size());
for (final YangModuleInfo yangModuleInfo : uniqueModels) {
final QName qname = yangModuleInfo.getName();
LOG.info("{} {} {}", qname.getNamespace(), qname.getLocalName(), qname.getRevision());
}
}
代码示例来源:origin: org.opendaylight.mdsal/mdsal-binding-generator-impl
@SuppressWarnings("checkstyle:illegalCatch")
private static Optional<DataNodeContainer> findFirstDataNodeContainerInRpc(final SchemaContext ctx,
final Class<? extends DataObject> targetType) {
final QNameModule targetModule;
try {
targetModule = BindingReflections.getModuleInfo(targetType).getName().getModule();
} catch (Exception e) {
throw new IllegalArgumentException(
String.format("Failed to load module information for class %s", targetType), e);
}
for (RpcDefinition rpc : ctx.getOperations()) {
if (targetModule.equals(rpc.getQName().getModule())) {
final Optional<DataNodeContainer> potential = findInputOutput(rpc,targetType.getSimpleName());
if (potential.isPresent()) {
return potential;
}
}
}
return Optional.empty();
}
代码示例来源:origin: org.opendaylight.yangtools/restconf-client-impl
public BindingToRestRpc(final Class<?> proxiedInterface,final BindingNormalizedNodeCodecRegistry mappingService2,final RestconfClientImpl client,final SchemaContext schemaContext) throws Exception {
this.mappingService = mappingService2;
this.client = client;
this.schcemaContext = schemaContext;
YangModuleInfo moduleInfo = BindingReflections.getModuleInfo(proxiedInterface);
this.module = schemaContext.findModuleByName(moduleInfo.getName(),org.opendaylight.yangtools.yang.common.QName.parseRevision(moduleInfo.getRevision()));
}
代码示例来源:origin: org.opendaylight.yangtools/restconf-client-impl
if (method.getName().equals(BindingMapping.getMethodName(rpcDef.getQName()))){
String moduleName = BindingReflections.getModuleInfo(method.getDeclaringClass()).getName();
String rpcMethodName = rpcDef.getQName().getLocalName();
Document rpcInputDoc = null;
内容来源于网络,如有侵权,请联系作者删除!