
cocaine.msgpack.UUIDTemplate Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cocaine-core Show documentation
Show all versions of cocaine-core Show documentation
Core classes for Cocaine Application Engine.
package cocaine.msgpack;
import java.io.IOException;
import java.util.UUID;
import org.msgpack.packer.Packer;
import org.msgpack.template.AbstractTemplate;
import org.msgpack.template.Template;
import org.msgpack.unpacker.Unpacker;
/**
* @author Anton Bobukh
*/
public final class UUIDTemplate extends AbstractTemplate {
private static final UUIDTemplate instance = new UUIDTemplate();
private UUIDTemplate() { }
public static Template getInstance() {
return instance;
}
@Override
public void write(Packer packer, UUID uuid, boolean required) throws IOException {
packer.write(uuid.toString());
}
@Override
public UUID read(Unpacker unpacker, UUID uuid, boolean required) throws IOException {
return UUID.fromString(unpacker.readString());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy