Antonio Varela
06/30/2023, 6:31 AM@TypeInfo(MyPojoTypeInfoFactory.class)
public class MyPojo {
private List<OtherPojo> listOfOtherPojos;
...
}
can someone please point me to an example on how to accomplish this?
I’m thinking to switch to Avro Serialization because of this, but I’m aware that Kryo must be avoided. Any help will be appreciated. Thank you in advance.Lukasz Krawiec
06/30/2023, 2:41 PM@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TypeInfo(EventTypeFactory.class)
public class State {
private List<Event> events;
}
public class EventTypeFactory extends TypeInfoFactory<State> {
@Override
public TypeInformation<State> createTypeInfo(Type t, Map<String, TypeInformation<?>> genericParameters) {
return StateTypeInfo.stateInfo;
}
}
public class StateTypeInfo {
public static final TypeInformation<Event> eventInfo = Types.POJO(Event.class,
ImmutableMap.of(
"eventId", Types.STRING,
// .... more stuff present in Event class
));
public static final TypeInformation<State> traceIdStateInfo = Types.POJO(State.class,
Map.of(
"events", Types.LIST(StateTypeInfo.eventInfo),
)
);
}Antonio Varela
06/30/2023, 5:04 PMAntonio Varela
06/30/2023, 6:01 PMLukasz Krawiec
06/30/2023, 6:03 PM