Search in sources :

Example 1 with MapSerializer

use of com.esotericsoftware.kryo.serializers.MapSerializer in project intellij-community by JetBrains.

the class ExternalProjectSerializer method configureKryo.

private void configureKryo() {
    myKryo.setAutoReset(true);
    myKryo.setRegistrationRequired(true);
    Log.set(Log.LEVEL_WARN);
    myKryo.register(ArrayList.class, new CollectionSerializer() {

        @Override
        protected Collection create(Kryo kryo, Input input, Class<Collection> type) {
            return new ArrayList();
        }
    });
    myKryo.register(HashMap.class, new MapSerializer() {

        @Override
        protected Map create(Kryo kryo, Input input, Class<Map> type) {
            return new HashMap();
        }
    });
    myKryo.register(HashSet.class, new CollectionSerializer() {

        @Override
        protected Collection create(Kryo kryo, Input input, Class<Collection> type) {
            return new HashSet();
        }
    });
    myKryo.register(File.class, new FileSerializer());
    myKryo.register(DefaultExternalProject.class, new FieldSerializer<DefaultExternalProject>(myKryo, DefaultExternalProject.class) {

        @Override
        protected DefaultExternalProject create(Kryo kryo, Input input, Class<DefaultExternalProject> type) {
            return new DefaultExternalProject();
        }
    });
    myKryo.register(DefaultExternalTask.class, new FieldSerializer<DefaultExternalTask>(myKryo, DefaultExternalTask.class) {

        @Override
        protected DefaultExternalTask create(Kryo kryo, Input input, Class<DefaultExternalTask> type) {
            return new DefaultExternalTask();
        }
    });
    myKryo.register(DefaultExternalPlugin.class, new FieldSerializer<DefaultExternalPlugin>(myKryo, DefaultExternalPlugin.class) {

        @Override
        protected DefaultExternalPlugin create(Kryo kryo, Input input, Class<DefaultExternalPlugin> type) {
            return new DefaultExternalPlugin();
        }
    });
    myKryo.register(DefaultExternalSourceSet.class, new FieldSerializer<DefaultExternalSourceSet>(myKryo, DefaultExternalSourceSet.class) {

        @Override
        protected DefaultExternalSourceSet create(Kryo kryo, Input input, Class<DefaultExternalSourceSet> type) {
            return new DefaultExternalSourceSet();
        }
    });
    myKryo.register(DefaultExternalSourceDirectorySet.class, new FieldSerializer<DefaultExternalSourceDirectorySet>(myKryo, DefaultExternalSourceDirectorySet.class) {

        @Override
        protected DefaultExternalSourceDirectorySet create(Kryo kryo, Input input, Class<DefaultExternalSourceDirectorySet> type) {
            return new DefaultExternalSourceDirectorySet();
        }
    });
    myKryo.register(DefaultExternalFilter.class, new FieldSerializer<DefaultExternalFilter>(myKryo, DefaultExternalFilter.class) {

        @Override
        protected DefaultExternalFilter create(Kryo kryo, Input input, Class<DefaultExternalFilter> type) {
            return new DefaultExternalFilter();
        }
    });
    myKryo.register(ExternalSystemSourceType.class, new DefaultSerializers.EnumSerializer(ExternalSystemSourceType.class));
    myKryo.register(DefaultExternalProjectDependency.class, new FieldSerializer<DefaultExternalProjectDependency>(myKryo, DefaultExternalProjectDependency.class) {

        @Override
        protected DefaultExternalProjectDependency create(Kryo kryo, Input input, Class<DefaultExternalProjectDependency> type) {
            return new DefaultExternalProjectDependency();
        }
    });
    myKryo.register(DefaultFileCollectionDependency.class, new FieldSerializer<DefaultFileCollectionDependency>(myKryo, DefaultFileCollectionDependency.class) {

        @Override
        protected DefaultFileCollectionDependency create(Kryo kryo, Input input, Class<DefaultFileCollectionDependency> type) {
            return new DefaultFileCollectionDependency();
        }
    });
    myKryo.register(DefaultExternalLibraryDependency.class, new FieldSerializer<DefaultExternalLibraryDependency>(myKryo, DefaultExternalLibraryDependency.class) {

        @Override
        protected DefaultExternalLibraryDependency create(Kryo kryo, Input input, Class<DefaultExternalLibraryDependency> type) {
            return new DefaultExternalLibraryDependency();
        }
    });
    myKryo.register(DefaultUnresolvedExternalDependency.class, new FieldSerializer<DefaultUnresolvedExternalDependency>(myKryo, DefaultUnresolvedExternalDependency.class) {

        @Override
        protected DefaultUnresolvedExternalDependency create(Kryo kryo, Input input, Class<DefaultUnresolvedExternalDependency> type) {
            return new DefaultUnresolvedExternalDependency();
        }
    });
    myKryo.register(DefaultExternalDependencyId.class, new FieldSerializer<DefaultExternalDependencyId>(myKryo, DefaultExternalDependencyId.class) {

        @Override
        protected DefaultExternalDependencyId create(Kryo kryo, Input input, Class<DefaultExternalDependencyId> type) {
            return new DefaultExternalDependencyId();
        }
    });
    myKryo.register(LinkedHashSet.class, new CollectionSerializer() {

        @Override
        protected Collection create(Kryo kryo, Input input, Class<Collection> type) {
            return new LinkedHashSet();
        }
    });
    myKryo.register(HashSet.class, new CollectionSerializer() {

        @Override
        protected Collection create(Kryo kryo, Input input, Class<Collection> type) {
            return new HashSet();
        }
    });
    myKryo.register(THashSet.class, new CollectionSerializer() {

        @Override
        protected Collection create(Kryo kryo, Input input, Class<Collection> type) {
            return new THashSet();
        }
    });
    myKryo.register(Set.class, new CollectionSerializer() {

        @Override
        protected Collection create(Kryo kryo, Input input, Class<Collection> type) {
            return new HashSet();
        }
    });
    myKryo.register(THashMap.class, new MapSerializer() {

        @Override
        protected Map create(Kryo kryo, Input input, Class<Map> type) {
            return new THashMap();
        }
    });
}
Also used : THashMap(gnu.trove.THashMap) DefaultExternalDependencyId(org.jetbrains.plugins.gradle.DefaultExternalDependencyId) Input(com.esotericsoftware.kryo.io.Input) MapSerializer(com.esotericsoftware.kryo.serializers.MapSerializer) THashSet(gnu.trove.THashSet) THashSet(gnu.trove.THashSet) THashMap(gnu.trove.THashMap) ExternalSystemSourceType(com.intellij.openapi.externalSystem.model.project.ExternalSystemSourceType) THashMap(gnu.trove.THashMap) DefaultSerializers(com.esotericsoftware.kryo.serializers.DefaultSerializers) CollectionSerializer(com.esotericsoftware.kryo.serializers.CollectionSerializer) Kryo(com.esotericsoftware.kryo.Kryo)

Aggregations

Kryo (com.esotericsoftware.kryo.Kryo)1 Input (com.esotericsoftware.kryo.io.Input)1 CollectionSerializer (com.esotericsoftware.kryo.serializers.CollectionSerializer)1 DefaultSerializers (com.esotericsoftware.kryo.serializers.DefaultSerializers)1 MapSerializer (com.esotericsoftware.kryo.serializers.MapSerializer)1 ExternalSystemSourceType (com.intellij.openapi.externalSystem.model.project.ExternalSystemSourceType)1 THashMap (gnu.trove.THashMap)1 THashSet (gnu.trove.THashSet)1 DefaultExternalDependencyId (org.jetbrains.plugins.gradle.DefaultExternalDependencyId)1