本文整理了Java中org.opendaylight.yangtools.yang.model.api.Module.getRevision()
方法的一些代码示例,展示了Module.getRevision()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Module.getRevision()
方法的具体详情如下:
包路径:org.opendaylight.yangtools.yang.model.api.Module
类名称:Module
方法名:getRevision
[英]Returns the revision date for the module. If you need both namespace and revision, please consider using #getQNameModule().
[中]返回模块的修订日期。如果您需要两个命名空间和修订版,请考虑使用y.GETQNAMEMODULE()。
代码示例来源:origin: org.opendaylight.yangtools/binding-type-provider
@Override
public int compare(final Module o1, final Module o2) {
return o1.getRevision().compareTo(o2.getRevision());
}
});
代码示例来源:origin: org.opendaylight.yangtools/restconf-util
private static Module filterLatestModule(final Iterable<Module> modules) {
Module latestModule = Iterables.getFirst(modules, null);
for (final Module module : modules) {
Date revision = module.getRevision();
Date latestModuleRevision = latestModule.getRevision();
if (revision.after(latestModuleRevision)) {
latestModule = module;
}
}
return latestModule;
}
代码示例来源:origin: org.opendaylight.yangtools/yang-model-export
private void emitRevisionNodes(final Module input) {
/*
* FIXME: BUG-2444: emit revisions properly, when parsed model will
* provide enough information
*/
input.getRevision().ifPresent(this::emitRevision);
}
代码示例来源:origin: org.opendaylight.yangtools/yang-model-util
@Override
public Optional<Module> findModule(final String name, final Optional<Revision> revision) {
for (final Module module : getNameToModules().get(name)) {
if (revision.equals(module.getRevision())) {
return Optional.of(module);
}
}
return Optional.empty();
}
代码示例来源:origin: org.opendaylight.yangtools/yang-model-api
/**
* Returns module instance (from the context) with specified name and an optional revision.
*
* @param name
* string with the module name
* @param revision
* date of the module revision
* @return module instance which has name and revision the same as are the values specified in parameters
* <code>name</code> and <code>revision</code>.
*/
default Optional<Module> findModule(final String name, final Optional<Revision> revision) {
return findModules(name).stream().filter(module -> revision.equals(module.getRevision())).findAny();
}
代码示例来源:origin: opendaylight/yangtools
@Override
public Optional<Module> findModule(final String name, final Optional<Revision> revision) {
for (final Module module : getNameToModules().get(name)) {
if (revision.equals(module.getRevision())) {
return Optional.of(module);
}
}
return Optional.empty();
}
代码示例来源:origin: opendaylight/yangtools
/**
* Returns module instance (from the context) with specified name and an optional revision.
*
* @param name
* string with the module name
* @param revision
* date of the module revision
* @return module instance which has name and revision the same as are the values specified in parameters
* <code>name</code> and <code>revision</code>.
*/
default Optional<Module> findModule(final String name, final Optional<Revision> revision) {
return findModules(name).stream().filter(module -> revision.equals(module.getRevision())).findAny();
}
代码示例来源:origin: org.opendaylight.mdsal/mdsal-binding2-java-api-generator
public static Module getSortedQName(final Set<Module> modules, final String name) {
final TreeMap<Optional<Revision>, Module> sorted = new TreeMap<>(Revision::compare);
for (Module module : modules) {
if (name.equals(module.getName())) {
sorted.put(module.getRevision(), module);
}
}
return sorted.lastEntry().getValue();
}
代码示例来源:origin: org.opendaylight.controller/yang-jmx-generator
public static QName getQName(final Module currentModule) {
return QName.create(currentModule.getNamespace(), currentModule.getRevision(), currentModule.getName());
}
}
代码示例来源:origin: org.opendaylight.yangtools/yang-model-util
private static boolean selectAdditionalModules(final Module module, final Set<ModuleId> additionalModules) {
return additionalModules.contains(new ModuleId(module.getName(), module.getRevision()));
}
代码示例来源:origin: org.opendaylight.controller/config-util
private static String toCapabilityURI(final Module module) {
return String.valueOf(module.getNamespace()) + "?module="
+ module.getName() + "&revision=" + SimpleDateFormatUtil.getRevisionFormat().format(module.getRevision());
}
代码示例来源:origin: opendaylight/yangtools
static SourceIdentifier moduleToIdentifier(final Module module) {
return RevisionSourceIdentifier.create(module.getName(), module.getRevision());
}
}
代码示例来源:origin: org.opendaylight.controller/netconf-util
private static String toCapabilityURI(final Module module) {
return String.valueOf(module.getNamespace()) + "?module="
+ module.getName() + "&revision=" + SimpleDateFormatUtil.getRevisionFormat().format(module.getRevision());
}
代码示例来源:origin: org.opendaylight.controller/sal-rest-connector
@Override
public QName deserialize(final IdentityValuesDTO data) {
final IdentityValue valueWithNamespace = data.getValuesWithNamespaces().get(0);
final Module module = getModuleByNamespace(valueWithNamespace.getNamespace(), mountPoint);
if (module == null) {
logger.info("Module was not found for namespace {}", valueWithNamespace.getNamespace());
logger.info("Idenetityref will be translated as NULL for data - {}", String.valueOf(valueWithNamespace));
return null;
}
return QName.create(module.getNamespace(), module.getRevision(), valueWithNamespace.getValue());
}
代码示例来源:origin: org.opendaylight.controller/config-util
public YangModuleCapability(final Module module, final String moduleContent) {
super(toCapabilityURI(module));
this.content = moduleContent;
this.moduleName = module.getName();
this.moduleNamespace = module.getNamespace().toString();
this.revision = SimpleDateFormatUtil.getRevisionFormat().format(module.getRevision());
}
代码示例来源:origin: org.opendaylight.controller/netconf-util
public YangModuleCapability(final Module module, final String moduleContent) {
super(toCapabilityURI(module));
this.content = moduleContent;
this.moduleName = module.getName();
this.moduleNamespace = module.getNamespace().toString();
this.revision = SimpleDateFormatUtil.getRevisionFormat().format(module.getRevision());
}
代码示例来源:origin: org.opendaylight.controller/config-netconf-connector
@Override
public boolean apply(final Module input) {
final ModuleIdentifierImpl id = new ModuleIdentifierImpl(input.getName(), Optional.fromNullable(input.getNamespace()), Optional.fromNullable(input.getRevision()));
return id.equals(moduleIdentifier);
}
}).getSource();
代码示例来源:origin: org.opendaylight.netconf/mdsal-netconf-yang-library
private Submodules createSubmodulesForModule(final Module module) {
final List<Submodule> submodulesList = Lists.newArrayList();
for (final Module subModule : module.getSubmodules()) {
final SubmoduleBuilder subModuleEntryBuilder = new SubmoduleBuilder();
subModuleEntryBuilder.setName(new YangIdentifier(subModule.getName()))
.setRevision(new OptionalRevision(SimpleDateFormatUtil.getRevisionFormat().format(subModule.getRevision())));
submodulesList.add(subModuleEntryBuilder.build());
}
return new SubmodulesBuilder().setSubmodule(submodulesList).build();
}
}
代码示例来源:origin: org.opendaylight.netconf/mdsal-netconf-yang-library
private org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev160409.module.list.Module createModuleEntryFromModule(final Module module) {
final ModuleBuilder moduleBuilder = new ModuleBuilder();
// TODO Conformance type is always set to Implement value, but it should it really be like this?
// TODO Add also deviations and features lists to module entries
moduleBuilder.setName(new YangIdentifier(module.getName()))
.setRevision(new OptionalRevision(SimpleDateFormatUtil.getRevisionFormat().format(module.getRevision())))
.setNamespace(new Uri(module.getNamespace().toString()))
.setConformanceType(ConformanceType.Implement)
.setSubmodules(createSubmodulesForModule(module));
return moduleBuilder.build();
}
代码示例来源:origin: org.onap.ccsdk.sli.plugins/restconf-client-provider
private RootNode createRootNode(String lastNodeName, String rootUri) {
Module m = SchemaContextUtil.findParentModule(schemaCtx(), curSchema);
Namespace ns = new Namespace(m.getName(), m.getNamespace(),
getRevision(m.getRevision()));
return new RootNode(lastNodeName, ns, schemaNode(), rootUri);
}
内容来源于网络,如有侵权,请联系作者删除!