TemplateRegistry registry = new TemplateRegistry();
registry.register(EnumTypeFieldsClassNotNullable.SampleEnum.class,
new OrdinalEnumTemplateBuilder(registry).buildTemplate(EnumTypeFieldsClassNotNullable.SampleEnum.class));
ReflectionTemplateBuilder builder = new ReflectionTemplateBuilder(registry);
Template<EnumTypeFieldsClassNotNullable> tmpl = builder.buildTemplate(EnumTypeFieldsClassNotNullable.class);
BufferPacker packer = msgpack.createBufferPacker();
tmpl.write(packer, v);
byte[] bytes = packer.toByteArray();
BufferUnpacker unpacker = msgpack.createBufferUnpacker();
unpacker.wrap(bytes);
EnumTypeFieldsClassNotNullable ret = tmpl.read(unpacker, null);