

package com.github.gfx.android.orma.test.type_adapter;

import com.github.gfx.android.orma.annotation.StaticTypeAdapter;
import com.github.gfx.android.orma.annotation.StaticTypeAdapters;
import com.github.gfx.android.orma.test.toolbox.MutableInt;
import com.github.gfx.android.orma.test.toolbox.MutableLong;

@StaticTypeAdapters({
        @StaticTypeAdapter(
                targetType = MutableInt.class,
                serializedType = int.class,
                serializer = "serializeMutableInt",
                deserializer = "deserializeMutableInt"
        ),
        @StaticTypeAdapter(
                targetType = MutableLong.class,
                serializedType = long.class,
                serializer = "serializeMutableLong",
                deserializer = "deserializeMutableLong"
        )
})
public class TypeAdapters {

    public static int serializeMutableInt(MutableInt target) {
        return target.value;
    }

    public static MutableInt deserializeMutableInt(int deserialized) {
        return new MutableInt(deserialized);
    }

    public static long serializeMutableLong(MutableLong target) {
        return target.value;
    }

    public static MutableLong deserializeMutableLong(long deserialized) {
        return new MutableLong(deserialized);
    }
}
