Skip to content

Commit 8e84b06

Browse files
authored
Add JavaDoc regarding CLOSE_CLOSEABLE (#5426)
1 parent 9f00d63 commit 8e84b06

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/main/java/com/fasterxml/jackson/databind/SerializationFeature.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,26 @@ public enum SerializationFeature implements ConfigFeature
141141
* writeValue() (or equivalent) method is called)
142142
* that implement {@link java.io.Closeable}
143143
* is called after serialization or not. If enabled, <b>close()</b> will
144-
* be called after serialization completes (whether succesfully, or
144+
* be called after serialization completes (whether successfully, or
145145
* due to an error manifested by an exception being thrown). You can
146146
* think of this as sort of "finally" processing.
147147
*<p>
148148
* NOTE: only affects behavior with <b>root</b> objects, and not other
149149
* objects reachable from the root object. Put another way, only one
150150
* call will be made for each 'writeValue' call.
151-
*<p>
152-
* Feature is disabled by default.
151+
*<p>
152+
* <b>This feature does not control closing of the underlying
153+
* {@link java.io.OutputStream} or {@link java.io.Writer}.</b>
154+
* Stream closing is handled by the streaming layer and can be configured
155+
* via {@link com.fasterxml.jackson.core.JsonGenerator.Feature#AUTO_CLOSE_TARGET},
156+
* for example:
157+
* <pre>
158+
* ObjectMapper mapper = JsonMapper.builder()
159+
* .disable(JsonGenerator.Feature.AUTO_CLOSE_TARGET)
160+
* .build();
161+
* </pre>
162+
* <p>
163+
* Feature is disabled by default.
153164
*/
154165
CLOSE_CLOSEABLE(false),
155166

0 commit comments

Comments
 (0)