From c1b46fa8ff51915c38b4f7efd962faca63bcb416 Mon Sep 17 00:00:00 2001 From: Tamas Cservenak Date: Sun, 21 Jan 2024 20:34:15 +0100 Subject: [PATCH 1/2] [MNG-8024] Make WrapperProperties and WrapperList serizalizable. This solves the two, but there are more... --- https://issues.apache.org/jira/browse/MNG-8024 --- src/mdo/java/WrapperList.java | 17 +++++++++++------ src/mdo/java/WrapperProperties.java | 7 +++++-- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/mdo/java/WrapperList.java b/src/mdo/java/WrapperList.java index 0799336aeff5..9386d3f271b4 100644 --- a/src/mdo/java/WrapperList.java +++ b/src/mdo/java/WrapperList.java @@ -27,16 +27,21 @@ import java.util.function.Supplier; class WrapperList extends AbstractList { - private final Supplier> getter; - private final Consumer> setter; - private final Function mapper; - private final Function revMapper; + public interface SerializableConsumer extends java.util.function.Consumer, java.io.Serializable {} + public interface SerializableFunction extends java.util.function.Function, java.io.Serializable {} + public interface SerializableSupplier extends java.util.function.Supplier, java.io.Serializable {} - WrapperList(List list, Function mapper, Function revMapper) { + + private final SerializableSupplier> getter; + private final SerializableConsumer> setter; + private final SerializableFunction mapper; + private final SerializableFunction revMapper; + + WrapperList(List list, SerializableFunction mapper, SerializableFunction revMapper) { this(() -> list, null, mapper, revMapper); } - WrapperList(Supplier> getter, Consumer> setter, Function mapper, Function revMapper) { + WrapperList(SerializableSupplier> getter, SerializableConsumer> setter, SerializableFunction mapper, SerializableFunction revMapper) { this.getter = getter; this.setter = setter; this.mapper = mapper; diff --git a/src/mdo/java/WrapperProperties.java b/src/mdo/java/WrapperProperties.java index 46d7658365a4..0ad7e2a1744f 100644 --- a/src/mdo/java/WrapperProperties.java +++ b/src/mdo/java/WrapperProperties.java @@ -41,10 +41,13 @@ class WrapperProperties extends Properties { + public interface SerializableConsumer extends java.util.function.Consumer, java.io.Serializable {} + public interface SerializableSupplier extends java.util.function.Supplier, java.io.Serializable {} + final Supplier> getter; - final Consumer setter; + final SerializableConsumer setter; - WrapperProperties(Supplier> getter, Consumer setter) { + WrapperProperties(SerializableSupplier> getter, SerializableConsumer setter) { this.getter = getter; this.setter = setter; } From 04986c2c20214a749670f929c1c22f59408dff32 Mon Sep 17 00:00:00 2001 From: Tamas Cservenak Date: Sun, 21 Jan 2024 20:40:20 +0100 Subject: [PATCH 2/2] forgot the member --- src/mdo/java/WrapperProperties.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mdo/java/WrapperProperties.java b/src/mdo/java/WrapperProperties.java index 0ad7e2a1744f..4d9b623f64d7 100644 --- a/src/mdo/java/WrapperProperties.java +++ b/src/mdo/java/WrapperProperties.java @@ -44,7 +44,7 @@ class WrapperProperties extends Properties { public interface SerializableConsumer extends java.util.function.Consumer, java.io.Serializable {} public interface SerializableSupplier extends java.util.function.Supplier, java.io.Serializable {} - final Supplier> getter; + final SerializableSupplier> getter; final SerializableConsumer setter; WrapperProperties(SerializableSupplier> getter, SerializableConsumer setter) {