@Override
    @SuppressWarnings({"unchecked", "rawtypes", "null"})
    public void decode(Object bean, CodedInputStream input) throws ConverterException {
        try {
            CodedInputStream inputItem = CodedInputStream.newInstance(input
                    .readBytes().toByteArray());

            Converter converter = null;
            int tag;
            while ((tag = inputItem.readTag()) != 0) {
                int fieldId = WireFormat.getTagFieldNumber(tag);
                switch (fieldId) {
                    case CLASS_NAME:
                        Class<?> classOfValue = Class.forName(inputItem
                                .readString());
                        converter = converters.get(classOfValue);
                        if (converter == null) {
                            throw new RuntimeException("No converter provided for "
                                    + classOfValue.getName());
                        }
                        break;
                    case OBJECT:
                        byte[] itemBytes = inputItem.readBytes().toByteArray();
                        field.set(bean, converter.decode(itemBytes));
                        break;
                }
            }
        } catch (IOException | ClassNotFoundException | RuntimeException | IllegalAccessException e) {
            throw new ConverterException("Exception during serialization", e);
        }
    }