summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
982e75e)
findDataChildByName() is a better replacement, use that instead.
Change-Id: I8e6be2dfd68c1146c231e8381ce16d64a35896ce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
deb81986a6a314b95137c3809c93d511e827bd3f)
final List<QName> listKeys = ((ListSchemaNode) schemaNode).getKeyDefinition();
for (final QName listKey : listKeys) {
final ListPathBuilder keyBuilder = newListPathBuilder();
final List<QName> listKeys = ((ListSchemaNode) schemaNode).getKeyDefinition();
for (final QName listKey : listKeys) {
final ListPathBuilder keyBuilder = newListPathBuilder();
- final DataSchemaNode dataChildByName = ((DataNodeContainer) schemaNode).getDataChildByName(listKey);
final String pathParamIdentifier = keyBuilder.nextParamIdentifier(listKey.getLocalName());
path.append(pathParamIdentifier);
final Parameter pathParam = new Parameter();
pathParam.setName(listKey.getLocalName());
final String pathParamIdentifier = keyBuilder.nextParamIdentifier(listKey.getLocalName());
path.append(pathParamIdentifier);
final Parameter pathParam = new Parameter();
pathParam.setName(listKey.getLocalName());
- pathParam.setDescription(dataChildByName.getDescription().orElse(null));
+
+ ((DataNodeContainer) schemaNode).findDataChildByName(listKey).flatMap(DataSchemaNode::getDescription)
+ .ifPresent(pathParam::setDescription);
+
pathParam.setType("string");
pathParam.setParamType("path");
pathParam.setType("string");
pathParam.setParamType("path");
- private String findModuleName(final YangInstanceIdentifier id, final SchemaContext context) {
+ private static String findModuleName(final YangInstanceIdentifier id, final SchemaContext context) {
final PathArgument rootQName = id.getPathArguments().iterator().next();
for (final Module mod : context.getModules()) {
final PathArgument rootQName = id.getPathArguments().iterator().next();
for (final Module mod : context.getModules()) {
- if (mod.getDataChildByName(rootQName.getNodeType()) != null) {
+ if (mod.findDataChildByName(rootQName.getNodeType()).isPresent()) {
return mod.getName();
}
}
return mod.getName();
}
}