/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.flink.api.common.serialization;

import org.apache.flink.annotation.Public;

import java.io.Serializable;

/**
 * The serialization schema describes how to turn a data object into a different serialized
 * representation. Most data sinks (for example Apache Kafka) require the data to be handed
 * to them in a specific format (for example as byte strings).
 *
 * @param <T> The type to be serialized.
 */
@Public
public interface SerializationSchema<T> extends Serializable {

	/**
	 * Serializes the incoming element to a specified type.
	 *
	 * @param element
	 *            The incoming element to be serialized
	 * @return The serialized element.
	 */
	byte[] serialize(T element);
}

@@ -889,16 +889,112 @@
 .Public;
+%0Aimport org.apache.flink.annotation.PublicEvolving;%0Aimport org.apache.flink.metrics.MetricGroup;
 %0A%0Aimport
@@ -1391,216 +1391,1397 @@
 e %7B%0A
-%0A%09/**%0A%09 * Serializes the incoming element to a specified type.%0A%09 *%0A%09 * @param element%0A%09 *            The incoming element to be serialized%0A%09 * @return The serialized element.%0A%09 */%0A%09byte%5B%5D serialize(T element);
+%09/**%0A%09 * Initialization method for the schema. It is called before the actual working methods%0A%09 * %7B@link #serialize(Object)%7D and thus suitable for one time setup work.%0A%09 *%0A%09 * %3Cp%3EThe provided %7B@link InitializationContext%7D can be used to access additional features such as e.g.%0A%09 * registering user metrics.%0A%09 *%0A%09 * @param context Contextual information that can be used during initialization.%0A%09 */%0A%09@PublicEvolving%0A%09default void open(InitializationContext context) throws Exception %7B%0A%09%7D%0A%0A%09/**%0A%09 * Serializes the incoming element to a specified type.%0A%09 *%0A%09 * @param element%0A%09 *            The incoming element to be serialized%0A%09 * @return The serialized element.%0A%09 */%0A%09byte%5B%5D serialize(T element);%0A%0A%09/**%0A%09 * A contextual information provided for %7B@link #open(InitializationContext)%7D method. It can be used to:%0A%09 * %3Cul%3E%0A%09 *     %3Cli%3ERegister user metrics via %7B@link InitializationContext#getMetricGroup()%7D%3C/li%3E%0A%09 * %3C/ul%3E%0A%09 */%0A%09@PublicEvolving%0A%09interface InitializationContext %7B%0A%09%09/**%0A%09%09 * Returns the metric group for the parallel subtask of the source that runs%0A%09%09 * this %7B@link DeserializationSchema%7D.%0A%09%09 *%0A%09%09 * %3Cp%3EInstances of this class can be used to register new metrics with Flink and to create a nested%0A%09%09 * hierarchy based on the group names. See %7B@link MetricGroup%7D for more information for the metrics%0A%09%09 * system.%0A%09%09 *%0A%09%09 * @see MetricGroup%0A%09%09 */%0A%09%09MetricGroup getMetricGroup();%0A%09%7D
 %0A%7D%0A

Add open to SerializationSchema