@Override
    public void encode(final BsonWriter writer, final Instant value, final EncoderContext encoderContext) {
        try {
            writer.writeDateTime(value.toEpochMilli());
        } catch (ArithmeticException e) {
            throw new CodecConfigurationException(format("Unsupported Instant value '%s' could not be converted to milliseconds: %s",
                    value, e.getMessage()), e);
        }
    }
@Override
    public void encode(final BsonWriter writer, final Instant value, final EncoderContext encoderContext) {
        try {
            writer.writeDateTime(value.toEpochMilli());
        } catch (ArithmeticException e) {
            throw new CodecConfigurationException(format("Unsupported Instant value '%s' could not be converted to milliseconds: %s",
                    value, e.getMessage()), e);
        }
    }
@ Override public void encode ( final BsonWriter writer , final Instant value , final EncoderContext encoderContext ) { try { writer . writeDateTime ( value . toEpochMilli ( ) ) ; } catch ( ArithmeticException e ) { throw new CodecConfigurationException ( format ( "Unsupported Instant value '%s' could not be converted to milliseconds: %s" , value , e . getMessage ( ) ) , e ) ; } }
{@inheritDoc}
@throws CodecConfigurationException if the Instant cannot be converted to a valid Bson DateTime.
{