Skip to content

Commit

Permalink
Allow declaring BSON values in entities
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesChenX committed Jul 21, 2024
1 parent 394f76d commit 4f09a5b
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
import jakarta.annotation.Nullable;

import lombok.Setter;
import org.bson.BsonValue;
import org.bson.codecs.Codec;
import org.bson.codecs.configuration.CodecProvider;
import org.bson.codecs.configuration.CodecRegistry;
import org.bson.conversions.Bson;
import org.jctools.maps.NonBlockingIdentityHashMap;

/**
Expand Down Expand Up @@ -56,7 +58,9 @@ public <T> Codec<T> get(Class<T> clazz, CodecRegistry registry) {
public <T> MongoCodec<T> getCodec(Class<T> clazz) {
if (clazz == Object.class) {
return (MongoCodec<T>) ObjectCodec.INSTANCE;
} else if (clazz.getClassLoader() == null) {
} else if (clazz.getClassLoader() == null
|| Bson.class.isAssignableFrom(clazz)
|| BsonValue.class.isAssignableFrom(clazz)) {
// Return null if the class is loaded by the bootstrap class loader, which means
// it is a system class.
return null;
Expand Down

0 comments on commit 4f09a5b

Please sign in to comment.