Skip to content

Commit

Permalink
Merge pull request #9 from spdx/fixpropuris
Browse files Browse the repository at this point in the history
Translate any reserved property names in constants file
  • Loading branch information
goneall authored Jan 9, 2025
2 parents c98180f + aa3f8b4 commit b738eaa
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/main/java/org/spdx/tools/model2java/ShaclToJava.java
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,19 @@ private void generateSpdxConstants(File dir, List<String> classUris) throws IOEx
String propertyName = uriToPropertyName.get(propUri);
String propertyConstantName = propertyNameToPropertyConstant(propertyName, namespaceName);
propMustacheMap.put("propertyConstantName", propertyConstantName);
propMustacheMap.put("propertyConstantValue", propertyName);
String uriPropName = null;
if (RESERVED_JAVA_WORDS.containsValue(propertyName)) {
for (Entry<String, String> entry:RESERVED_JAVA_WORDS.entrySet()) {
if (entry.getValue().equals(propertyName)) {
uriPropName = entry.getKey();
break;
}
}
}
if (Objects.isNull(uriPropName)) {
uriPropName = propertyName;;
}
propMustacheMap.put("propertyConstantValue", uriPropName);
propMustacheList.add(propMustacheMap);
}
namespaceMustacheMap.put("propertyDescriptors", propMustacheList);
Expand Down

0 comments on commit b738eaa

Please sign in to comment.