Skip to content

Commit 85aa9b5

Browse files
committed
Replace references to PojoCodec in reference documentation
PojoCodec is not a public class, so it's not appropriate to refer to it directly in the reference documentation. JAVA-3203
1 parent 145f7f8 commit 85aa9b5

File tree

4 files changed

+26
-23
lines changed

4 files changed

+26
-23
lines changed

docs/reference/content/bson/pojos.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ title = "POJOs"
99

1010
## POJOs - Plain Old Java Objects
1111

12-
The 3.5 release of the driver adds POJO support via the [`PojoCodec`]({{<apiref "org/bson/codecs/pojo/PojoCodec.html">}}), which allows for
13-
direct serialization of POJOs and Java Beans to and from BSON. Internally, each `PojoCodec` utilizes a
12+
The 3.5 release of the driver adds POJO support via the [`PojoCodecProvider`]({{<apiref "org/bson/codecs/pojo/PojoCodecProvider.html">}}),
13+
which allows for direct serialization of POJOs and Java Beans to and from BSON. Internally, the `Codec` for each POJO utilizes a
1414
[`ClassModel`]({{<apiref "org/bson/codecs/pojo/ClassModel.html">}}) instance to store metadata about how the POJO should be serialized.
1515

1616
A `ClassModel` for a POJO includes:
@@ -43,7 +43,7 @@ ClassModels are built using the [`ClassModelBuilder`]({{<apiref "org/bson/codecs
4343
the [`ClassModel.builder(clazz)`]({{<apiref "org/bson/codecs/pojo/ClassModel.html#builder-java.lang.Class-">}}) method. The builder
4444
initially uses reflection to create the required metadata.
4545

46-
`PojoCodec` instances are created by the [`PojoCodecProvider`]({{<apiref "org/bson/codecs/pojo/PojoCodecProvider.html">}}) which is a
46+
POJO `Codec` instances are created by the [`PojoCodecProvider`]({{<apiref "org/bson/codecs/pojo/PojoCodecProvider.html">}}) which is a
4747
`CodecProvider`. CodecProviders are used by the `CodecRegistry` to find the correct `Codec` for any given class.
4848

4949
{{% note class="important" %}}
@@ -58,8 +58,7 @@ encoded and decoded.
5858
## POJO support
5959

6060
Automatic POJO support can be provided by setting `PojoCodecProvider.Builder#automatic(true)`, once built the `PojoCodecProvider` will
61-
automatically create a `PojoCodec` for any class that contains at least one serializable or deserializable
62-
property.
61+
automatically create a POJO `Codec` for any class that contains at least one serializable or deserializable property.
6362

6463
The entry point for customisable POJO support is the `PojoCodecProvider`. New instances can be created via the
6564
[`PojoCodecProvider.builder()`]({{<apiref "org/bson/codecs/pojo/PojoCodecProvider.html#builder">}}) method. The `builder` allows users to
@@ -70,8 +69,8 @@ register any combination of:
7069
* `ClassModel` instances which allow fine grained control over how a POJO is encoded and decoded.
7170

7271
The `builder` also allows the user to register default [Conventions](#conventions) for any POJOs that are automatically mapped, either
73-
the individual POJO classes or POJOs found from registered packages. The `PojoCodecProvider` will lookup PojoCodecs and return the first
74-
that matches the POJO class:
72+
the individual POJO classes or POJOs found from registered packages. The `PojoCodecProvider` will lookup POJO `Codec` instances and return
73+
the first that matches the POJO class:
7574

7675
* Registered ClassModels
7776
* Registered POJO classes
@@ -96,14 +95,14 @@ CodecRegistry pojoCodecRegistry = fromRegistries(getDefaultCodecRegistry(), from
9695
{{% note class="tip" %}}
9796
In general only one instance of a `PojoCodecProvider` should be created.
9897

99-
This is because each `PojoCodecProvider` instance contains a look up table for discriminator names. If multiple PojoCodecProviders are
98+
This is because each `PojoCodecProvider` instance contains a look up table for discriminator names. If multiple `PojoCodecProvider`s are
10099
used, care should be taken to ensure that each provider contains a holistic view of POJO classes, otherwise discriminator lookups can fail.
101100
Alternatively, using the full class name as the discriminator value will ensure successful POJO lookups.
102101
{{% /note %}}
103102

104103
## Default configuration
105104

106-
By default the `PojoCodec` will not store `null` values or a discriminator when converting a POJO to BSON.
105+
By default the POJO `Codec` will not store `null` values or a discriminator when converting a POJO to BSON.
107106

108107
Take the following `Person` class:
109108

@@ -195,8 +194,8 @@ public final class Tree extends GenericTree<Integer, String> {
195194
The `Tree` POJO is serializable because it doesn't have any unknown type parameters. The `left`, `right` and `genericClass` properties are
196195
all serializable because they are bound to the concrete types `Integer`, `String` and `Long`.
197196

198-
On their own, instances of `GenericTree` or `GenericClass` are not serializable by the `PojoCodec`. This is because the runtime type parameter
199-
information is erased by the JVM, and the type parameters cannot be specialized accurately.
197+
On their own, instances of `GenericTree` or `GenericClass` are not serializable by the POJO `Codec`. This is because the runtime type
198+
parameter information is erased by the JVM, and the type parameters cannot be specialized accurately.
200199

201200
The 3.6 release of the driver further improves generic support with the addition of PropertyCodecProviders. The `PropertyCodecProvider` API
202201
allows type-safe support of container types by providing concrete type parameters for the generic types as declared in the POJO.
@@ -273,8 +272,8 @@ public class Person {
273272

274273
### Enum support
275274

276-
Enums are fully supported. The `PojoCodec` uses the name of the enum constant as the property value. This is then converted back into an Enum
277-
value by the codec using the static `Enum.valueOf` method.
275+
Enums are fully supported. The POJO `Codec` uses the name of the enum constant as the property value. This is then converted back into an
276+
Enum value by the codec using the static `Enum.valueOf` method.
278277

279278
Take the following example:
280279

@@ -427,7 +426,7 @@ CodecRegistry pojoCodecRegistry = fromRegistries(getDefaultCodecRegistry(), from
427426

428427
### Supporting POJOs without no args constructors
429428

430-
By default PojoCodecs work with POJOs that have an empty, no arguments, constructor. POJOs with alternative constructors are supported
429+
By default a POJO `Codec` works with POJOs that have an empty, no arguments, constructor. POJOs with alternative constructors are supported
431430
via the `ANNOTATION_CONVENTION` and the `@BsonCreator` annotation. Any parameters for the creator constructor should be annotated with the
432431
`@BsonProperty` annotation. Below is an example of a `Person` POJO that contains final fields that are set via the annotated constructor:
433432

docs/reference/content/driver-async/getting-started/quick-start-pojo.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ Before you can use a POJO with the driver, you need to configure the [`CodecRegi
138138
to handle the translation to and from [`bson`]({{< relref "bson/index.md" >}}) for your POJOs. The simplest way to do that is to use the
139139
[`PojoCodecProvider.builder()`]({{< apiref "org/bson/codecs/pojo/PojoCodecProvider.html">}}) to create and configure a `CodecProvider`.
140140

141-
The following example will combine the default codec registry, with the `PojoCodecProvider` configured to automatically create `PojoCodecs`:
141+
The following example will combine the default codec registry, with the `PojoCodecProvider` configured to automatically create POJO
142+
`Codec`s:
143+
142144
```java
143145
CodecRegistry pojoCodecRegistry = fromRegistries(MongoClients.getDefaultCodecRegistry(),
144146
fromProviders(PojoCodecProvider.builder().automatic(true).build()));
@@ -169,8 +171,8 @@ collection = collection.withCodecRegistry(pojoCodecRegistry);
169171

170172
## Inserting a POJO into MongoDB
171173

172-
The codec registry will automatically try to create a `PojoCodec` for unknown classes. This allows you to use POJOs out of the
173-
box without any extra configuration. See the [Bson POJO page]({{< ref "bson/pojos.md" >}}) for information on configuring `PojoCodecs`.
174+
The codec registry will automatically try to create a POJO `Codec` for unknown classes. This allows you to use POJOs out of the
175+
box without any extra configuration. See the [Bson POJO page]({{< ref "bson/pojos.md" >}}) for information on configuring POJO `Codec`s.
174176

175177
Before you can insert a POJO into MongoDB, you need a `MongoCollection` instance configured with the Pojo's type:
176178

docs/reference/content/driver/getting-started/quick-start-pojo.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,9 @@ Before you can use a POJO with the driver, you need to configure the [`CodecRegi
136136
to handle the translation to and from [`bson`]({{< relref "bson/index.md" >}}) for your POJOs. The simplest way to do that is to use the
137137
[`PojoCodecProvider.builder()`]({{< apiref "org/bson/codecs/pojo/PojoCodecProvider.html">}}) to create and configure a `CodecProvider`.
138138

139-
The following example will combine the default codec registry, with the `PojoCodecProvider` configured to automatically create `PojoCodecs`:
139+
The following example will combine the default codec registry, with the `PojoCodecProvider` configured to automatically create POJO
140+
`Codec`s:
141+
140142
```java
141143
CodecRegistry pojoCodecRegistry = fromRegistries(MongoClient.getDefaultCodecRegistry(),
142144
fromProviders(PojoCodecProvider.builder().automatic(true).build()));
@@ -169,8 +171,8 @@ collection = collection.withCodecRegistry(pojoCodecRegistry);
169171

170172
## Inserting a POJO into MongoDB
171173

172-
The codec registry will automatically try to create a `PojoCodec` for unknown classes. This allows you to use POJOs out of the
173-
box without any extra configuration. See the [Bson POJO page]({{< ref "bson/pojos.md" >}}) for information on configuring `PojoCodecs`.
174+
The codec registry will automatically try to create a POJO `Codec` for unknown classes. This allows you to use POJOs out of the
175+
box without any extra configuration. See the [Bson POJO page]({{< ref "bson/pojos.md" >}}) for information on configuring POJO `Codec`s.
174176

175177
Before you can insert a POJO into MongoDB, you need a `MongoCollection` instance configured with the Pojo's type:
176178

docs/reference/content/whats-new.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ Connecting to Unix domain sockets is done via the [`ConnectionString`]({{< apire
126126

127127
### PojoCodec improvements
128128

129-
The 3.7 release brings support for `Map<String, Object>` to the `PojoCodec`.
129+
The 3.7 release brings support for `Map<String, Object>` to the POJO `Codec`.
130130

131131
### JSR-310 Instant, LocalDate & LocalDateTime support
132132

@@ -210,9 +210,9 @@ The 3.6 release adds support for [causally consistency](http://dochub.mongodb.or
210210
The 3.6 release adds support for application-configured control over server selection, using the `serverSelector` option in
211211
[`MongoClientOptions`]({{<apiref "com/mongodb/MongoClientOptions">}}).
212212

213-
### PojoCodec improvements
213+
### POJO Codec improvements
214214

215-
The 3.6 release brings new improvements to the `PojoCodec`:
215+
The 3.6 release brings new improvements to the POJO `Codec`:
216216

217217
* Improved sub-class and discriminator support.
218218
* Support for custom Collection and Map implementations.

0 commit comments

Comments
 (0)