public static void addUnitsToGenTO(final GeneratedTOBuilder to, final String units) {
if (!Strings.isNullOrEmpty(units)) {
- to.addConstant(Types.STRING, "Units", "\"" + units + "\"");
+ to.addConstant(Types.STRING, "_UNITS", "\"" + units + "\"");
final GeneratedPropertyBuilder prop = new GeneratedPropertyBuilderImpl("UNITS");
prop.setReturnType(Types.STRING);
to.addToStringProperty(prop);
// a base type which holds these constraints.
if (typeDefinition instanceof DecimalTypeDefinition) {
final Type ret = BaseYangTypes.BASE_YANG_TYPES_PROVIDER.javaTypeForSchemaDefinitionType
- (typeDefinition, parentNode, r, null);
+ (typeDefinition, parentNode, r, context);
if (ret != null) {
return ret;
}
}
if (returnType == null) {
returnType = BaseYangTypes.BASE_YANG_TYPES_PROVIDER.javaTypeForSchemaDefinitionType(
- baseTypeDef, typeDefinition, r, null);
+ baseTypeDef, typeDefinition, r, context);
}
}
}
if (strXPath != null) {
if (strXPath.indexOf('[') == -1) {
final Module module;
+ final SchemaNode actualParentSchemaNode;
if ((parentNode instanceof DerivableSchemaNode) && ((DerivableSchemaNode) parentNode).isAddedByUses()) {
final Optional<? extends SchemaNode> originalNode = ((DerivableSchemaNode) parentNode).getOriginal();
Preconditions.checkArgument(originalNode.isPresent(), "originalNode can not be null.");
+ actualParentSchemaNode = originalNode.get();
module = findParentModule(schemaContext, originalNode.get());
} else {
+ actualParentSchemaNode = parentNode;
module = findParentModule(schemaContext, parentNode);
}
Preconditions.checkArgument(module != null, "Failed to find module for parent %s", parentNode);
if (xpath.isAbsolute()) {
dataNode = findDataSchemaNode(schemaContext, module, xpath);
} else {
- dataNode = findDataSchemaNodeForRelativeXPath(schemaContext, module, parentNode, xpath);
+ dataNode = findDataSchemaNodeForRelativeXPath(schemaContext, module, actualParentSchemaNode, xpath);
}
Preconditions.checkArgument(dataNode != null, "Failed to find leafref target: %s in module %s (%s)",
strXPath, getParentModule(parentNode, schemaContext).getName(), parentNode.getQName().getModule());