@@ -78,7 +78,7 @@ public class Document implements Map<String, Object>, Serializable, Bson {
78
78
* Creates an empty Document instance.
79
79
*/
80
80
public Document () {
81
- documentAsMap = new LinkedHashMap <String , Object >();
81
+ documentAsMap = new LinkedHashMap <>();
82
82
}
83
83
84
84
/**
@@ -88,7 +88,7 @@ public Document() {
88
88
* @param value value
89
89
*/
90
90
public Document (final String key , final Object value ) {
91
- documentAsMap = new LinkedHashMap <String , Object >();
91
+ documentAsMap = new LinkedHashMap <>();
92
92
documentAsMap .put (key , value );
93
93
}
94
94
@@ -98,7 +98,7 @@ public Document(final String key, final Object value) {
98
98
* @param map initial map
99
99
*/
100
100
public Document (final Map <String , ?> map ) {
101
- documentAsMap = new LinkedHashMap <String , Object >(map );
101
+ documentAsMap = new LinkedHashMap <>(map );
102
102
}
103
103
104
104
@@ -131,7 +131,7 @@ public static Document parse(final String json, final Decoder<Document> decoder)
131
131
132
132
@ Override
133
133
public <C > BsonDocument toBsonDocument (final Class <C > documentClass , final CodecRegistry codecRegistry ) {
134
- return new BsonDocumentWrapper <Document >(this , codecRegistry .get (Document .class ));
134
+ return new BsonDocumentWrapper <>(this , codecRegistry .get (Document .class ));
135
135
}
136
136
137
137
/**
@@ -186,7 +186,7 @@ public <T> T get(final Object key, final T defaultValue) {
186
186
* Gets the value in an embedded document, casting it to the given {@code Class<T>}. The list of keys represents a path to the
187
187
* embedded value, drilling down into an embedded document for each key. This is useful to avoid having casts in
188
188
* client code, though the effect is the same.
189
- *
189
+ * <p>
190
190
* The generic type of the keys list is {@code ?} to be consistent with the corresponding {@code get} methods, but in practice
191
191
* the actual type of the argument should be {@code List<String>}. So to get the embedded value of a key list that is of type String,
192
192
* you would write {@code String name = doc.getEmbedded(List.of("employee", "manager", "name"), String.class)} instead of
@@ -210,7 +210,7 @@ public <T> T getEmbedded(final List<?> keys, final Class<T> clazz) {
210
210
* Gets the value in an embedded document, casting it to the given {@code Class<T>} or returning the default value if null.
211
211
* The list of keys represents a path to the embedded value, drilling down into an embedded document for each key.
212
212
* This is useful to avoid having casts in client code, though the effect is the same.
213
- *
213
+ * <p>
214
214
* The generic type of the keys list is {@code ?} to be consistent with the corresponding {@code get} methods, but in practice
215
215
* the actual type of the argument should be {@code List<String>}. So to get the embedded value of a key list that is of type String,
216
216
* you would write {@code String name = doc.getEmbedded(List.of("employee", "manager", "name"), "John Smith")} instead of
@@ -414,7 +414,6 @@ private <T> List<T> constructValuesList(final Object key, final Class<T> clazz,
414
414
* @see #toJson(JsonWriterSettings)
415
415
* @see JsonWriterSettings
416
416
*/
417
- @ SuppressWarnings ("deprecation" )
418
417
public String toJson () {
419
418
return toJson (JsonWriterSettings .builder ().outputMode (JsonMode .RELAXED ).build ());
420
419
}
@@ -441,7 +440,6 @@ public String toJson(final JsonWriterSettings writerSettings) {
441
440
* @return a JSON representation of this document
442
441
* @throws org.bson.codecs.configuration.CodecConfigurationException if the registry does not contain a codec for the document values.
443
442
*/
444
- @ SuppressWarnings ("deprecation" )
445
443
public String toJson (final Encoder <Document > encoder ) {
446
444
return toJson (JsonWriterSettings .builder ().outputMode (JsonMode .RELAXED ).build (), encoder );
447
445
}
0 commit comments