File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
java/fury-core/src/main/java/org/apache/fury/serializer Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ package org .apache .fury .serializer ;
2
+
3
+ import java .lang .reflect .Field ;
4
+
5
+ /** Callback interface for handling field mismatch during deserialization. */
6
+ public interface FieldMismatchCallback {
7
+
8
+ /**
9
+ * Called when a field mismatch is detected during deserialization.
10
+ *
11
+ * @param modifiedClass The class that is being deserialized
12
+ * @param deserializedTypeName The name of the type that was deserialized
13
+ * @param deserializedFieldName The name of the field that was deserialized
14
+ * @return A FieldAdjustment that contains the target Field and a method to map the deserialized
15
+ * value to the target field.
16
+ */
17
+ FieldAdjustment onMismatch (
18
+ Class <?> modifiedClass , String deserializedTypeName , String deserializedFieldName );
19
+
20
+ abstract class FieldAdjustment {
21
+ private final Field targetField ;
22
+
23
+ public FieldAdjustment (Field targetField ) {
24
+ this .targetField = targetField ;
25
+ }
26
+
27
+ public Field getTargetField () {
28
+ return targetField ;
29
+ }
30
+
31
+ public abstract Object adjustValue (Object deserializedValue );
32
+ }
33
+ }
You can’t perform that action at this time.
0 commit comments