// Path: src/main/java/me/welkinbai/bsonmapper/Utils.java
// public static void checkIsSupportClazz(Class<?> targetClazz, String message) {
//     if (BsonValueConverterRepertory.isValueSupportClazz(targetClazz)) {
//         throw new BsonMapperConverterException(message);
//     }
// }
// 
// Path: src/main/java/me/welkinbai/bsonmapper/Utils.java
// public static void checkNotNull(Object object, String message) {
//     if (object == null) {
//         throw new NullPointerException(message);
//     }
// }
// 
// Path: src/main/java/me/welkinbai/bsonmapper/Utils.java
// public static boolean isStrEmpty(String str) {
//     return str == null || str.length() == 0;
// }


import org.bson.BsonBinaryReader;
import org.bson.BsonBinaryWriter;
import org.bson.BsonBinaryWriterSettings;
import org.bson.BsonDocument;
import org.bson.BsonValue;
import org.bson.BsonWriter;
import org.bson.BsonWriterSettings;
import org.bson.Document;
import org.bson.codecs.DocumentCodec;
import org.bson.codecs.configuration.CodecRegistries;
import org.bson.io.BasicOutputBuffer;
import org.bson.io.BsonInput;
import org.bson.io.BsonOutput;
import org.bson.json.JsonReader;
import org.bson.json.JsonWriter;
import org.bson.json.JsonWriterSettings;
import java.io.StringWriter;
import java.nio.ByteBuffer;
import java.util.Map.Entry;
import static me.welkinbai.bsonmapper.Utils.checkIsSupportClazz;
import static me.welkinbai.bsonmapper.Utils.checkNotNull;
import static me.welkinbai.bsonmapper.Utils.isStrEmpty;
        }
        checkNotNull(targetClazz, NOT_NULL_MSG);
        checkIsSupportClazz(targetClazz, NOT_SUPPORT_CLAZZ_MSG + targetClazz.getName());
        return BsonValueConverterRepertory.getBsonDocumentConverter().decode(bsonDocument, targetClazz, bsonMapperConfig);
    }

    @Override
    public <T> T readFrom(ByteBuffer byteBuffer, Class<T> targetClazz) {
        if (byteBuffer == null) {
            return null;
        }
        checkNotNull(targetClazz, NOT_NULL_MSG);
        checkIsSupportClazz(targetClazz, NOT_SUPPORT_CLAZZ_MSG + targetClazz.getName());
        BsonBinaryReader bsonBinaryReader = new BsonBinaryReader(byteBuffer);
        return BsonValueConverterRepertory.getBsonDocumentConverter().decode(bsonBinaryReader, targetClazz, bsonMapperConfig);
    }

    @Override
    public <T> T readFrom(BsonInput bsonInput, Class<T> targetClazz) {
        if (bsonInput == null) {
            return null;
        }
        checkNotNull(targetClazz, NOT_NULL_MSG);
        checkIsSupportClazz(targetClazz, NOT_SUPPORT_CLAZZ_MSG + targetClazz.getName());
        BsonBinaryReader bsonBinaryReader = new BsonBinaryReader(bsonInput);
        return BsonValueConverterRepertory.getBsonDocumentConverter().decode(bsonBinaryReader, targetClazz, bsonMapperConfig);
    }

    @Override
    public <T> T readFrom(String jsonString, Class<T> targetClazz) {
// Path: src/main/java/me/welkinbai/bsonmapper/Utils.java
// public static void checkIsSupportClazz(Class<?> targetClazz, String message) {
//     if (BsonValueConverterRepertory.isValueSupportClazz(targetClazz)) {
//         throw new BsonMapperConverterException(message);
//     }
// }
// 
// Path: src/main/java/me/welkinbai/bsonmapper/Utils.java
// public static void checkNotNull(Object object, String message) {
//     if (object == null) {
//         throw new NullPointerException(message);
//     }
// }
// 
// Path: src/main/java/me/welkinbai/bsonmapper/Utils.java
// public static boolean isStrEmpty(String str) {
//     return str == null || str.length() == 0;
// }


// Path: src/main/java/me/welkinbai/bsonmapper/DefaultBsonMapper.java
import org.bson.BsonBinaryReader;
import org.bson.BsonBinaryWriter;
import org.bson.BsonBinaryWriterSettings;
import org.bson.BsonDocument;
import org.bson.BsonValue;
import org.bson.BsonWriter;
import org.bson.BsonWriterSettings;
import org.bson.Document;
import org.bson.codecs.DocumentCodec;
import org.bson.codecs.configuration.CodecRegistries;
import org.bson.io.BasicOutputBuffer;
import org.bson.io.BsonInput;
import org.bson.io.BsonOutput;
import org.bson.json.JsonReader;
import org.bson.json.JsonWriter;
import org.bson.json.JsonWriterSettings;
import java.io.StringWriter;
import java.nio.ByteBuffer;
import java.util.Map.Entry;
import static me.welkinbai.bsonmapper.Utils.checkIsSupportClazz;
import static me.welkinbai.bsonmapper.Utils.checkNotNull;
import static me.welkinbai.bsonmapper.Utils.isStrEmpty;

        }
        checkNotNull(targetClazz, NOT_NULL_MSG);
        checkIsSupportClazz(targetClazz, NOT_SUPPORT_CLAZZ_MSG + targetClazz.getName());
        return BsonValueConverterRepertory.getBsonDocumentConverter().decode(bsonDocument, targetClazz, bsonMapperConfig);
    }

    @Override
    public <T> T readFrom(ByteBuffer byteBuffer, Class<T> targetClazz) {
        if (byteBuffer == null) {
            return null;
        }
        checkNotNull(targetClazz, NOT_NULL_MSG);
        checkIsSupportClazz(targetClazz, NOT_SUPPORT_CLAZZ_MSG + targetClazz.getName());
        BsonBinaryReader bsonBinaryReader = new BsonBinaryReader(byteBuffer);
        return BsonValueConverterRepertory.getBsonDocumentConverter().decode(bsonBinaryReader, targetClazz, bsonMapperConfig);
    }

    @Override
    public <T> T readFrom(BsonInput bsonInput, Class<T> targetClazz) {
        if (bsonInput == null) {
            return null;
        }
        checkNotNull(targetClazz, NOT_NULL_MSG);
        checkIsSupportClazz(targetClazz, NOT_SUPPORT_CLAZZ_MSG + targetClazz.getName());
        BsonBinaryReader bsonBinaryReader = new BsonBinaryReader(bsonInput);
        return BsonValueConverterRepertory.getBsonDocumentConverter().decode(bsonBinaryReader, targetClazz, bsonMapperConfig);
    }

    @Override
    public <T> T readFrom(String jsonString, Class<T> targetClazz) {
        if (isStrEmpty(jsonString)) {