Skip to content

Commit

Permalink
Translate any reserved property names in constants file
Browse files Browse the repository at this point in the history
  • Loading branch information
goneall committed Jan 9, 2025
1 parent c98180f commit aa3f8b4
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 aa3f8b4

Please sign in to comment.