Skip to content

Commit c20e23f

Browse files
committed
Use OneOfValueProvider for serialization
Signed-off-by: Francisco Javier Tirado Sarti <ftirados@redhat.com>
1 parent b91c9d7 commit c20e23f

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

api/src/main/java/io/serverlessworkflow/serialization/SerializeHelper.java

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,12 @@
1616
package io.serverlessworkflow.serialization;
1717

1818
import com.fasterxml.jackson.core.JsonGenerator;
19+
import io.serverlessworkflow.api.OneOfValueProvider;
1920
import java.io.IOException;
20-
import java.lang.reflect.Method;
2121

2222
public class SerializeHelper {
23-
public static void serializeOneOf(JsonGenerator jgen, Object item) throws IOException {
24-
try {
25-
for (Method m : item.getClass().getDeclaredMethods()) {
26-
Object value = m.invoke(item);
27-
if (value != null) {
28-
jgen.writeObject(value);
29-
break;
30-
}
31-
}
32-
} catch (ReflectiveOperationException ex) {
33-
throw new IOException(ex);
34-
}
23+
public static void serializeOneOf(JsonGenerator jgen, OneOfValueProvider item)
24+
throws IOException {
25+
jgen.writeObject(item.get());
3526
}
3627
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy