Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ public String render() {
// Process internal variables to handle Resources before rendering
Map<String, Object> processedVariables = new HashMap<>();
for (Entry<String, Object> entry : this.variables.entrySet()) {
if (entry.getValue() instanceof Resource) {
processedVariables.put(entry.getKey(), renderResource((Resource) entry.getValue()));
if (entry.getValue() instanceof Resource resource) {
processedVariables.put(entry.getKey(), renderResource(resource));
}
else {
processedVariables.put(entry.getKey(), entry.getValue());
Expand All @@ -126,8 +126,8 @@ public String render(Map<String, Object> additionalVariables) {
Map<String, Object> combinedVariables = new HashMap<>(this.variables);

for (Entry<String, Object> entry : additionalVariables.entrySet()) {
if (entry.getValue() instanceof Resource) {
combinedVariables.put(entry.getKey(), renderResource((Resource) entry.getValue()));
if (entry.getValue() instanceof Resource resource) {
combinedVariables.put(entry.getKey(), renderResource(resource));
}
else {
combinedVariables.put(entry.getKey(), entry.getValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ private static boolean isValidJson(String input) {
* Converts a Java object to a JSON string if it's not already a valid JSON string.
*/
public static String toJson(@Nullable Object object) {
if (object instanceof String && isValidJson((String) object)) {
return (String) object;
if (object instanceof String str && isValidJson(str)) {
return str;
}
try {
return OBJECT_MAPPER.writeValueAsString(object);
Expand Down