From 89ef89a127e1dbf88bd8e3d3d0232edba120730b Mon Sep 17 00:00:00 2001 From: dyu Date: Sun, 24 May 2020 20:43:18 +0800 Subject: [PATCH] programmatic config --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 52ff59b37..e95025d20 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,20 @@ If you are to purely use this to replace java serialization (no compatibility wi -Dprotostuff.runtime.morph_non_final_pojos=true ``` +You can also customize it programmatically: +```java +static final DefaultIdStrategy STRATEGY = new DefaultIdStrategy(IdStrategy.DEFAULT_FLAGS + | IdStrategy.PRESERVE_NULL_ELEMENTS, + | IdStrategy.MORPH_COLLECTION_INTERFACES, + | IdStrategy.MORPH_MAP_INTERFACES, + | IdStrategy.MORPH_NON_FINAL_POJOS); +``` + +Use it: +```java +Schema schema = RuntimeSchema.getSchema(Foo.class, STRATEGY); +``` + Questions/Concerns/Suggestions ------------------------------