@@ -0,0 +1,2112 @@
+/*%0A * Copyright 2017 MovingBlocks%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.terasology.persistence.typeHandling;%0A%0Aimport org.terasology.reflection.TypeInfo;%0A%0Aimport java.util.Optional;%0A%0A/**%0A * Creates type handlers for a set of types. Type handler factories are generally used when a set of types%0A * are similar in serialization structure.%0A */%0Apublic interface TypeHandlerFactory %7B%0A    /**%0A     * Creates a %7B@link TypeHandler%7D for the given type %7B@link T%7D. If the type is not supported by%0A     * this %7B@link TypeHandlerFactory%7D, %7B@link Optional#empty()%7D is returned.%0A     *%0A     * This method is usually called only once for a type, so all expensive pre-computations and reflection%0A     * operations can be performed here so that the generated%0A     * %7B@link TypeHandler#serialize(Object, SerializationContext)%7D and%0A     * %7B@link TypeHandler#deserialize(PersistedData, DeserializationContext)%7D implementations are fast.%0A     *%0A     * @param typeInfo The %7B@link TypeInfo%7D of the type for which a %7B@link TypeHandler%7D must be generated.%0A     * @param typeSerializationLibrary The %7B@link TypeSerializationLibrary%7D for which the %7B@link TypeHandler%7D%0A     *                                 is being created.%0A     * @param %3CT%3E The type for which a %7B@link TypeHandler%7D must be generated.%0A     * @return An %7B@link Optional%7D wrapping the created %7B@link TypeHandler%7D, or %7B@link Optional#empty()%7D%0A     * if the type is not supported by this %7B@link TypeHandlerFactory%7D.%0A     */%0A    %3CT%3E Optional%3CTypeHandler%3CT%3E%3E create(TypeInfo%3CT%3E typeInfo, TypeSerializationLibrary typeSerializationLibrary);%0A%7D%0A

Add TypeHandlerFactory