@Override public TypeSerializerSchemaCompatibility<String> resolveSchemaCompatibility(TypeSerializer<String> newSerializer) { // checks the exact class instead of using instanceof; // this ensures that we get a new serializer, and not a ReconfiguredNestedSerializer or RestoredNestedSerializer if (newSerializer.getClass() == NestedSerializer.class) { switch (targetCompatibility) { case COMPATIBLE_AS_IS: return TypeSerializerSchemaCompatibility.compatibleAsIs(); case COMPATIBLE_AFTER_MIGRATION: return TypeSerializerSchemaCompatibility.compatibleAfterMigration(); case COMPATIBLE_WITH_RECONFIGURED_SERIALIZER: return TypeSerializerSchemaCompatibility.compatibleWithReconfiguredSerializer( new ReconfiguredNestedSerializer(targetCompatibility)); case INCOMPATIBLE: return TypeSerializerSchemaCompatibility.incompatible(); default: throw new IllegalStateException("Unexpected target compatibility."); } } throw new IllegalArgumentException("Expected the new serializer to be of class " + NestedSerializer.class); }
@SuppressWarnings("unchecked") TypeSerializer<T> reconfiguredCompositeSerializer = createOuterSerializerWithNestedSerializers(reconfiguredNestedSerializers); return TypeSerializerSchemaCompatibility.compatibleWithReconfiguredSerializer(reconfiguredCompositeSerializer);