tillrohrmann commented on a change in pull request #19:
URL: 
https://github.com/apache/flink-statefun-playground/pull/19#discussion_r797654985



##########
File path: 
java/connected-components/src/main/java/org/apache/flink/statefun/playground/java/connectedcomponents/types/JavaType.java
##########
@@ -0,0 +1,70 @@
+package org.apache.flink.statefun.playground.java.connectedcomponents.types;
+
+import org.apache.flink.statefun.sdk.java.TypeName;
+import org.apache.flink.statefun.sdk.java.slice.Slice;
+import org.apache.flink.statefun.sdk.java.slice.Slices;
+import org.apache.flink.statefun.sdk.java.types.Type;
+import org.apache.flink.statefun.sdk.java.types.TypeCharacteristics;
+import org.apache.flink.statefun.sdk.java.types.TypeSerializer;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.Set;
+
+/**
+ * Simple type that uses Java serialization to serialize values.
+ *
+ * @param <T> type to hold
+ */
+final class JavaType<T> implements Type<T> {
+    private static final JavaSerializer INSTANCE = new JavaSerializer();
+    private final TypeName typeName;
+
+    JavaType(TypeName typeName) {
+        this.typeName = typeName;
+    }
+
+    @Override
+    public TypeName typeName() {
+        return typeName;
+    }
+
+    @Override
+    public TypeSerializer<T> typeSerializer() {
+        return INSTANCE;
+    }
+
+    @Override
+    public Set<TypeCharacteristics> typeCharacteristics() {
+        return 
Collections.unmodifiableSet(EnumSet.of(TypeCharacteristics.IMMUTABLE_VALUES));
+    }
+
+    private static final class JavaSerializer<T> implements TypeSerializer<T> {
+        @Override
+        public Slice serialize(T value) {
+            final ByteArrayOutputStream baos = new ByteArrayOutputStream();

Review comment:
       Sounds good. Let's not give a wrong example. I'll remove the Java 
serialization.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to