diff --git a/runtime/src/main/java/io/quarkiverse/fury/FuryBuildTimeConfig.java b/runtime/src/main/java/io/quarkiverse/fury/FuryBuildTimeConfig.java index bf01151..3f49b6d 100644 --- a/runtime/src/main/java/io/quarkiverse/fury/FuryBuildTimeConfig.java +++ b/runtime/src/main/java/io/quarkiverse/fury/FuryBuildTimeConfig.java @@ -3,6 +3,8 @@ import java.util.Map; import java.util.Optional; +import org.apache.fury.config.CompatibleMode; + import io.quarkus.runtime.annotations.ConfigDocMapKey; import io.quarkus.runtime.annotations.ConfigDocSection; import io.quarkus.runtime.annotations.ConfigPhase; @@ -17,6 +19,40 @@ public interface FuryBuildTimeConfig { @WithDefault("true") boolean requiredClassRegistration(); + /** Whether track shared or circular references. */ + @WithDefault("false") + boolean trackRef(); + + /** + * Set class schema compatible mode. + *
+ * SCHEMA_CONSISTENT: Class schema must be consistent between serialization peer and deserialization peer. + *
+ * COMPATIBLE: Class schema can be different between serialization peer and deserialization peer. They can + * add/delete fields independently. + */ + @WithDefault("SCHEMA_CONSISTENT") + CompatibleMode compatibleMode(); + + /** Use variable length encoding for int/long. */ + @WithDefault("true") + boolean compressNumber(); + + /** Whether compress string for small size. */ + @WithDefault("true") + boolean compressString(); + + /** + * Whether deserialize/skip data of un-existed class. If not enabled, an exception will be thrown + * if class not exist. + */ + @WithDefault("false") + boolean deserializeNonexistentClass(); + + /** If an enum value doesn't exist, return a null instead of throws exception. */ + @WithDefault("false") + boolean deserializeNonexistentEnumValueAsNull(); + /** Whether to use thread safe fury. The default is true. */ @WithDefault("true") boolean threadSafe(); diff --git a/runtime/src/main/java/io/quarkiverse/fury/FuryRecorder.java b/runtime/src/main/java/io/quarkiverse/fury/FuryRecorder.java index 5198cc9..627a95e 100644 --- a/runtime/src/main/java/io/quarkiverse/fury/FuryRecorder.java +++ b/runtime/src/main/java/io/quarkiverse/fury/FuryRecorder.java @@ -23,7 +23,13 @@ public RuntimeValue createFury( final FuryBuildTimeConfig config, final BeanContainer beanContainer) { // create the Fury instance from the config FuryBuilder builder = Fury.builder(); - builder.requireClassRegistration(config.requiredClassRegistration()); + builder.requireClassRegistration(config.requiredClassRegistration()) + .withRefTracking(config.trackRef()) + .withCompatibleMode(config.compatibleMode()) + .withDeserializeNonexistentClass(config.deserializeNonexistentClass()) + .deserializeNonexistentEnumValueAsNull(config.deserializeNonexistentEnumValueAsNull()) + .withNumberCompressed(config.compressNumber()) + .withStringCompressed(config.compressString()); BaseFury fury = config.threadSafe() ? builder.buildThreadSafeFury() : builder.build(); // register to the container