Skip to content

Commit 27fdf56

Browse files
committed
Polishing contribution
Closes gh-29949
1 parent 55392df commit 27fdf56

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

spring-web/src/main/java/org/springframework/http/converter/json/ProblemDetailJacksonXmlMixin.java

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,46 +30,48 @@
3030
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_EMPTY;
3131

3232
/**
33-
* Intended to be identical to {@link ProblemDetailJacksonMixin} but for used
34-
* instead of it when jackson-dataformat-xml is on the classpath. Customizes the
35-
* XML root element name and adds namespace information.
33+
* Provides the same declarations as {@link ProblemDetailJacksonMixin}, and
34+
* some additional ones to support XML serialization when
35+
* jackson-dataformat-xml is on the classpath. Customizes the XML root element
36+
* name and adds namespace information.
3637
*
37-
* <p>Note: Unfortunately, we cannot just use {@code JsonRootName} to specify
38-
* the namespace since that is not inherited by fields of the class. This is
39-
* why we need a dedicated mixin for use when jackson-dataformat-xml is on the
40-
* classpath. For more details, see
38+
* <p>Note that we can't use {@code JsonRootName} to specify the namespace
39+
* since that is not inherited by fields of the class. This is why we need a
40+
* dedicated mixin for use when jackson-dataformat-xml is on the classpath.
41+
* For more details, see
4142
* <a href="https://github.com/FasterXML/jackson-dataformat-xml/issues/355">FasterXML/jackson-dataformat-xml#355</a>.
4243
*
4344
* @author Rossen Stoyanchev
44-
* @author Yanming Zhou
4545
* @since 6.0.5
4646
*/
4747
@JsonInclude(NON_EMPTY)
48-
@JacksonXmlRootElement(localName = "problem", namespace = ProblemDetailJacksonXmlMixin.NAMESPACE)
48+
@JacksonXmlRootElement(localName = "problem", namespace = ProblemDetailJacksonXmlMixin.RFC_7807_NAMESPACE)
4949
public interface ProblemDetailJacksonXmlMixin {
5050

51-
String NAMESPACE = "urn:ietf:rfc:7807";
51+
/** RFC 7807 namespace. */
52+
String RFC_7807_NAMESPACE = "urn:ietf:rfc:7807";
5253

53-
@JacksonXmlProperty(namespace = NAMESPACE)
54+
55+
@JacksonXmlProperty(namespace = RFC_7807_NAMESPACE)
5456
URI getType();
5557

56-
@JacksonXmlProperty(namespace = NAMESPACE)
58+
@JacksonXmlProperty(namespace = RFC_7807_NAMESPACE)
5759
String getTitle();
5860

59-
@JacksonXmlProperty(namespace = NAMESPACE)
61+
@JacksonXmlProperty(namespace = RFC_7807_NAMESPACE)
6062
int getStatus();
6163

62-
@JacksonXmlProperty(namespace = NAMESPACE)
64+
@JacksonXmlProperty(namespace = RFC_7807_NAMESPACE)
6365
String getDetail();
6466

65-
@JacksonXmlProperty(namespace = NAMESPACE)
67+
@JacksonXmlProperty(namespace = RFC_7807_NAMESPACE)
6668
URI getInstance();
6769

6870
@JsonAnySetter
6971
void setProperty(String name, @Nullable Object value);
7072

7173
@JsonAnyGetter
72-
@JacksonXmlProperty(namespace = NAMESPACE)
74+
@JacksonXmlProperty(namespace = RFC_7807_NAMESPACE)
7375
Map<String, Object> getProperties();
7476

7577
}

0 commit comments

Comments
 (0)