Skip to content

Commit 75c00da

Browse files
committed
Make deprecated IterableCodec package-private
It's still used by IterableCodecProvider, so it can't be removed entirely. (Though IterableCodecProvider is almost entirely supplanted by CollectionCodecProvider, it was not itself deprecated because it provides a codec for any Iterable, while CollectionCodecProvider only provides one for any Collection, which is not quite the same thing). JAVA-5142
1 parent 482190a commit 75c00da

File tree

2 files changed

+8
-29
lines changed

2 files changed

+8
-29
lines changed

Diff for: bson/src/main/org/bson/codecs/IterableCodec.java

+2-23
Original file line numberDiff line numberDiff line change
@@ -31,37 +31,16 @@
3131

3232
/**
3333
* Encodes and decodes {@code Iterable} objects.
34-
*
35-
* @since 3.3
36-
* @deprecated Prefer {@link CollectionCodecProvider}
3734
*/
38-
@Deprecated
3935
@SuppressWarnings("rawtypes")
40-
public class IterableCodec implements Codec<Iterable>, OverridableUuidRepresentationCodec<Iterable> {
36+
class IterableCodec implements Codec<Iterable>, OverridableUuidRepresentationCodec<Iterable> {
4137

4238
private final CodecRegistry registry;
4339
private final BsonTypeCodecMap bsonTypeCodecMap;
4440
private final Transformer valueTransformer;
4541
private final UuidRepresentation uuidRepresentation;
4642

47-
/**
48-
* Construct a new instance with the given {@code CodecRegistry} and {@code BsonTypeClassMap}.
49-
*
50-
* @param registry the non-null codec registry
51-
* @param bsonTypeClassMap the non-null BsonTypeClassMap
52-
*/
53-
public IterableCodec(final CodecRegistry registry, final BsonTypeClassMap bsonTypeClassMap) {
54-
this(registry, bsonTypeClassMap, null);
55-
}
56-
57-
/**
58-
* Construct a new instance with the given {@code CodecRegistry} and {@code BsonTypeClassMap}.
59-
*
60-
* @param registry the non-null codec registry
61-
* @param bsonTypeClassMap the non-null BsonTypeClassMap
62-
* @param valueTransformer the value Transformer
63-
*/
64-
public IterableCodec(final CodecRegistry registry, final BsonTypeClassMap bsonTypeClassMap, final Transformer valueTransformer) {
43+
IterableCodec(final CodecRegistry registry, final BsonTypeClassMap bsonTypeClassMap, final Transformer valueTransformer) {
6544
this(registry, new BsonTypeCodecMap(notNull("bsonTypeClassMap", bsonTypeClassMap), registry), valueTransformer,
6645
UuidRepresentation.UNSPECIFIED);
6746
}

Diff for: bson/src/test/unit/org/bson/codecs/IterableCodecSpecification.groovy

+6-6
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ class IterableCodecSpecification extends Specification {
4343

4444
def 'should have Iterable encoding class'() {
4545
given:
46-
def codec = new IterableCodec(REGISTRY, new BsonTypeClassMap())
46+
def codec = new IterableCodec(REGISTRY, new BsonTypeClassMap(), null)
4747

4848
expect:
4949
codec.getEncoderClass() == Iterable
5050
}
5151

5252
def 'should encode an Iterable to a BSON array'() {
5353
given:
54-
def codec = new IterableCodec(REGISTRY, new BsonTypeClassMap())
54+
def codec = new IterableCodec(REGISTRY, new BsonTypeClassMap(), null)
5555
def writer = new BsonDocumentWriter(new BsonDocument())
5656

5757
when:
@@ -66,7 +66,7 @@ class IterableCodecSpecification extends Specification {
6666

6767
def 'should decode a BSON array to an Iterable'() {
6868
given:
69-
def codec = new IterableCodec(REGISTRY, new BsonTypeClassMap())
69+
def codec = new IterableCodec(REGISTRY, new BsonTypeClassMap(), null)
7070
def reader = new BsonDocumentReader(parse('{array : [1, 2, 3, null]}'))
7171

7272
when:
@@ -81,7 +81,7 @@ class IterableCodecSpecification extends Specification {
8181

8282
def 'should decode a BSON array of arrays to an Iterable of Iterables'() {
8383
given:
84-
def codec = new IterableCodec(REGISTRY, new BsonTypeClassMap())
84+
def codec = new IterableCodec(REGISTRY, new BsonTypeClassMap(), null)
8585
def reader = new BsonDocumentReader(parse('{array : [[1, 2], [3, 4, 5]]}'))
8686

8787
when:
@@ -116,7 +116,7 @@ class IterableCodecSpecification extends Specification {
116116
def 'should decode binary subtype 3 for UUID'() {
117117
given:
118118
def reader = new BsonDocumentReader(parse(document))
119-
def codec = new IterableCodec(fromCodecs(new UuidCodec(representation), new BinaryCodec()), new BsonTypeClassMap())
119+
def codec = new IterableCodec(fromCodecs(new UuidCodec(representation), new BinaryCodec()), new BsonTypeClassMap(), null)
120120
.withUuidRepresentation(representation)
121121

122122
when:
@@ -142,7 +142,7 @@ class IterableCodecSpecification extends Specification {
142142
def 'should decode binary subtype 4 for UUID'() {
143143
given:
144144
def reader = new BsonDocumentReader(parse(document))
145-
def codec = new IterableCodec(fromCodecs(new UuidCodec(representation), new BinaryCodec()), new BsonTypeClassMap())
145+
def codec = new IterableCodec(fromCodecs(new UuidCodec(representation), new BinaryCodec()), new BsonTypeClassMap(), null)
146146
.withUuidRepresentation(representation)
147147

148148
when:

0 commit comments

Comments
 (0)