Add a properties setter to ProblemDetail

Mainly to allow Kotlin idiomatic properties assignment.

Closes gh-31430
This commit is contained in:
Sébastien Deleuze
2023-10-17 14:11:24 +02:00
parent 7a60e2024b
commit 875eeabb6f
2 changed files with 46 additions and 0 deletions

View File

@@ -216,6 +216,18 @@ public class ProblemDetail {
this.properties.put(name, value);
}
/**
* Setter for the {@link #getProperties() properties map}.
* <p>By default, this is not set.
* <p>When Jackson JSON is present on the classpath, any properties set here
* are rendered as top level key-value pairs in the output JSON. Otherwise,
* they are rendered as a {@code "properties"} sub-map.
* @param properties the properties map
*/
public void setProperties(@Nullable Map<String, Object> properties) {
this.properties = properties;
}
/**
* Return a generic map of properties that are not known ahead of time,
* possibly {@code null} if no properties have been added. To add a property,