Class PeriodAsDocumentCodec

  • All Implemented Interfaces:
    Codec<Period>, Decoder<Period>, Encoder<Period>

    public final class PeriodAsDocumentCodec
    extends Object
    implements Codec<Period>

    Encodes and decodes Period values to and from BSON Document, such as { years: 18, months: 1, days: 2 }.

    The values are stored using the following structure:

    • years (a non-null Int32);
    • months (a non-null Int32);
    • days (a non-null Int32).

    This type is immutable.