@Override public boolean equals(Object obj) { return super.equals(obj) && (obj instanceof TupleSerializerConfigSnapshot) && (tupleClass.equals(((TupleSerializerConfigSnapshot) obj).getTupleClass())); }
@Override public int hashCode() { return super.hashCode() * 31 + tupleClass.hashCode(); } }
@Override public void read(DataInputView in) throws IOException { super.read(in); try (final DataInputViewStream inViewWrapper = new DataInputViewStream(in)) { tupleClass = InstantiationUtil.deserializeObject(inViewWrapper, getUserCodeClassLoader(), true); } catch (ClassNotFoundException e) { throw new IOException("Could not find requested tuple class in classpath.", e); } }
@Override public void write(DataOutputView out) throws IOException { super.write(out); try (final DataOutputViewStream outViewWrapper = new DataOutputViewStream(out)) { InstantiationUtil.serializeObject(outViewWrapper, tupleClass); } }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null) { return false; } return (obj.getClass().equals(getClass())) && nestedSerializersAndConfigs.equals(((CompositeTypeSerializerConfigSnapshot) obj).getNestedSerializersAndConfigs()); }
@Override public void read(DataInputView in) throws IOException { super.read(in); this.nestedSerializersAndConfigs = TypeSerializerSerializationUtil.readSerializersAndConfigsWithResilience(in, getUserCodeClassLoader()); }
@Override public TypeSerializerSchemaCompatibility<Map<K, V>> resolveSchemaCompatibility(TypeSerializer<Map<K, V>> newSerializer) { if (newSerializer instanceof MapSerializer) { List<Tuple2<TypeSerializer<?>, TypeSerializerSnapshot<?>>> nestedSerializersAndConfigs = getNestedSerializersAndConfigs(); // redirect the compatibility check to the new MapSerializerSnapshot return CompositeTypeSerializerUtil.delegateCompatibilityCheckToNewSnapshot( newSerializer, new MapSerializerSnapshot<>(), nestedSerializersAndConfigs.get(0).f1, nestedSerializersAndConfigs.get(1).f1); } else { return super.resolveSchemaCompatibility(newSerializer); } }
@Override public void write(DataOutputView out) throws IOException { super.write(out); try (final DataOutputViewStream outViewWrapper = new DataOutputViewStream(out)) { InstantiationUtil.serializeObject(outViewWrapper, componentClass); } }
@Override public CompatibilityResult<T> ensureCompatibility(TypeSerializerConfigSnapshot configSnapshot) { // We can not remove this method, as long as we support restoring into CompositeTypeSerializerConfigSnapshot. // Previously (pre 1.8), multiple composite serializers were using this class directly as their snapshot class. if (configSnapshot instanceof ConfigSnapshot) { List<Tuple2<TypeSerializer<?>, TypeSerializerConfigSnapshot>> previousSerializersAndConfigs = ((CompositeTypeSerializerConfigSnapshot) configSnapshot).getNestedSerializersAndConfigs(); if (previousSerializersAndConfigs.size() == fieldSerializers.length) { return ensureFieldCompatibility(previousSerializersAndConfigs); } } return CompatibilityResult.requiresMigration(); }
@Override public void read(DataInputView in) throws IOException { super.read(in); this.nestedSerializersAndConfigs = TypeSerializerSerializationUtil.readSerializersAndConfigsWithResilience(in, getUserCodeClassLoader()); }
@Override @SuppressWarnings("unchecked") public TypeSerializerSchemaCompatibility<Either<L, R>> resolveSchemaCompatibility( TypeSerializer<Either<L, R>> newSerializer) { // this class was shared between the Java Either Serializer and the // Scala Either serializer if (newSerializer.getClass() == EitherSerializer.class) { List<Tuple2<TypeSerializer<?>, TypeSerializerSnapshot<?>>> nestedSerializersAndConfigs = getNestedSerializersAndConfigs(); return CompositeTypeSerializerUtil.delegateCompatibilityCheckToNewSnapshot( newSerializer, new JavaEitherSerializerSnapshot<>(), nestedSerializersAndConfigs.get(0).f1, nestedSerializersAndConfigs.get(1).f1); } else { // Scala Either Serializer, or other. // fall back to the backwards compatibility path return super.resolveSchemaCompatibility(newSerializer); } } }
@Override public boolean equals(Object obj) { return super.equals(obj) && (obj instanceof GenericArraySerializerConfigSnapshot) && (componentClass.equals(((GenericArraySerializerConfigSnapshot) obj).getComponentClass())); }
@Override public int hashCode() { return super.hashCode() * 31 + tupleClass.hashCode(); } }
@Override public void read(DataInputView in) throws IOException { super.read(in); try (final DataInputViewStream inViewWrapper = new DataInputViewStream(in)) { tupleClass = InstantiationUtil.deserializeObject(inViewWrapper, getUserCodeClassLoader(), true); } catch (ClassNotFoundException e) { throw new IOException("Could not find requested tuple class in classpath.", e); } }
@Override public void write(DataOutputView out) throws IOException { super.write(out); try (final DataOutputViewStream outViewWrapper = new DataOutputViewStream(out)) { InstantiationUtil.serializeObject(outViewWrapper, tupleClass); } }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null) { return false; } return (obj.getClass().equals(getClass())) && nestedSerializersAndConfigs.equals(((CompositeTypeSerializerConfigSnapshot) obj).getNestedSerializersAndConfigs()); }
@Override public void read(DataInputView in) throws IOException { super.read(in); this.nestedSerializersAndConfigs = TypeSerializerSerializationUtil.readSerializersAndConfigsWithResilience(in, getUserCodeClassLoader()); }
@Override @SuppressWarnings("unchecked") public TypeSerializerSchemaCompatibility<C> resolveSchemaCompatibility(TypeSerializer<C> newSerializer) { if (!(newSerializer instanceof ListSerializer)) { return super.resolveSchemaCompatibility(newSerializer); } return CompositeTypeSerializerUtil.delegateCompatibilityCheckToNewSnapshot( newSerializer, (CompositeTypeSerializerSnapshot<C, ? extends TypeSerializer>) new ListSerializerSnapshot<>(), getSingleNestedSerializerAndConfig().f1); }
@Override public boolean equals(Object obj) { return super.equals(obj) && (obj instanceof TupleSerializerConfigSnapshot) && (tupleClass.equals(((TupleSerializerConfigSnapshot) obj).getTupleClass())); }
@Override public int hashCode() { return 31 * (31 * super.hashCode() + eleType.hashCode()) + (isPrimitive ? 1 : 0); } }