feat(serde-ext, weaver-pojo-serde-ext): Enable serde for woven string map entries

This commit is contained in:
2026-05-02 19:08:36 +02:00
parent 353c5126bc
commit a085a2acc6
3 changed files with 14 additions and 0 deletions
+1
View File
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
that allows to get a subentry by its data key. that allows to get a subentry by its data key.
- `serde-extension`: Introduce a more generic `ReaderWriter` for `MutableStructuredConfigEntry`s. - `serde-extension`: Introduce a more generic `ReaderWriter` for `MutableStructuredConfigEntry`s.
- `weaver-pojo`: Make maps with string keys into their own weavable entry type. - `weaver-pojo`: Make maps with string keys into their own weavable entry type.
- `weaver-pojo-serde-ext`: Such string map entries get serde using the `MutableStructuredConfigEntry` interface.
## [0.8.1] - 2026-04-26 ## [0.8.1] - 2026-04-26
@@ -51,6 +51,12 @@ public class DefaultTweedEntryReaderWriterImplsProvider implements TweedReaderWr
)); ));
context.registerReaderFactory("tweed5.collection", new StaticReaderWriterFactory<>(collectionReaderWriter())); context.registerReaderFactory("tweed5.collection", new StaticReaderWriterFactory<>(collectionReaderWriter()));
context.registerWriterFactory("tweed5.collection", new StaticReaderWriterFactory<>(collectionReaderWriter())); context.registerWriterFactory("tweed5.collection", new StaticReaderWriterFactory<>(collectionReaderWriter()));
context.registerReaderFactory("tweed5.mutatableStruct", new StaticReaderWriterFactory<>(
mutableStructuredReaderWriter()
));
context.registerWriterFactory("tweed5.mutatableStruct", new StaticReaderWriterFactory<>(
mutableStructuredReaderWriter()
));
context.registerReaderFactory("tweed5.compound", new StaticReaderWriterFactory<>(compoundReaderWriter())); context.registerReaderFactory("tweed5.compound", new StaticReaderWriterFactory<>(compoundReaderWriter()));
context.registerWriterFactory("tweed5.compound", new StaticReaderWriterFactory<>(compoundReaderWriter())); context.registerWriterFactory("tweed5.compound", new StaticReaderWriterFactory<>(compoundReaderWriter()));
} }
@@ -3,12 +3,14 @@ package de.siphalor.tweed5.weaver.pojoext.serde.api.auto;
import de.siphalor.tweed5.annotationinheritance.api.AnnotationInheritance; import de.siphalor.tweed5.annotationinheritance.api.AnnotationInheritance;
import de.siphalor.tweed5.core.api.entry.CollectionConfigEntry; import de.siphalor.tweed5.core.api.entry.CollectionConfigEntry;
import de.siphalor.tweed5.core.api.entry.CompoundConfigEntry; import de.siphalor.tweed5.core.api.entry.CompoundConfigEntry;
import de.siphalor.tweed5.weaver.pojo.api.entry.WeavableStringMapConfigEntry;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import java.util.Collection; import java.util.Collection;
import java.util.Map;
@AnnotationInheritance(passOn = AutoReadWriteMapping.class) @AnnotationInheritance(passOn = AutoReadWriteMapping.class)
@AutoReadWriteMapping(valueClasses = {boolean.class, Boolean.class}, spec = "tweed5.bool") @AutoReadWriteMapping(valueClasses = {boolean.class, Boolean.class}, spec = "tweed5.bool")
@@ -30,6 +32,11 @@ import java.util.Collection;
valueClasses = Object.class, valueClasses = Object.class,
spec = "tweed5.compound" spec = "tweed5.compound"
) )
@AutoReadWriteMapping(
entryClasses = WeavableStringMapConfigEntry.class,
valueClasses = Map.class,
spec = "tweed5.mutatableStruct"
)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.TYPE, ElementType.ANNOTATION_TYPE}) @Target({ElementType.FIELD, ElementType.TYPE, ElementType.ANNOTATION_TYPE})
public @interface DefaultReadWriteMappings { public @interface DefaultReadWriteMappings {