Package org.bson.codecs.pojo.annotations
Annotation Interface BsonProperty
An annotation that configures a property.
For POJOs, requires the Conventions.ANNOTATION_CONVENTION
For Java records, the annotation is only supported on the record component.
- Since:
- 3.5
- See Also:
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionboolean
The name of the property.
-
Element Details
-
value
String valueThe name of the property.Note: Regarding POJOs:
For asymmetrical property names, the context of theBsonProperty
can be important. For example, when used with@BsonCreator
the value will relate to the read name. When used directly on a field it will set both the read name if unset and the write name if unset.- Returns:
- the name to use for the property
- See Also:
- Default:
- ""
-
useDiscriminator
boolean useDiscriminator- Returns:
- whether to include a discriminator when serializing nested Pojos.
- Default:
- false
-