Back to project page Station42.
The source code is released under:
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUC...
If you think the Android project Station42 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.station42.server.serializers; /* w ww . j a v a 2s. c o m*/ import com.esotericsoftware.kryo.Kryo; import com.esotericsoftware.kryo.Registration; import com.esotericsoftware.kryo.Serializer; import com.esotericsoftware.kryo.io.Input; import com.esotericsoftware.kryo.io.Output; import com.station42.base.Entity; public class EntitySerializer extends Serializer<Entity> { public Entity read(Kryo kryo, Input input, Class<Entity> type) { return (Entity) kryo.readClassAndObject(input); } @Override public void write(Kryo kryo, Output output, Entity object) { for (Object component : object.getComponents()) { Registration serializer = kryo.getRegistration(component.getClass()); if (serializer.getId() != -1) { kryo.writeClassAndObject(output, component); } } } }