[
https://issues.apache.org/jira/browse/AVRO-1406?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13845040#comment-13845040
]
Thiruvalluvan M. G. commented on AVRO-1406:
-------------------------------------------
I think Doug's latest idea of adding a new method to GenericRecord is the
cleanest solution. That actually means four new methods. Three accessors:
* {{const GenericDatum& field(const std::string& name) const;}}
* {{GenericDatum& field(const std::string& name);}}
* {{void setField(const std::string& name, const GenericDatum& v);}}
All of them will use another method:
* {{size_t fieldIndex(const std::string& name);}}
and then use {{fieldAt()}} or {{setFieldAt()}}. I think it makes sense to let
{{fieldIndex()}} also public so that if a client wants to cache field index, it
can. {{fieldIndex()}} should throw an exception if there is no field with the
given name.
> Avro C++ GenericRecord (GenericDatum, etc.) doesn't support getters and
> setters with field name argument
> --------------------------------------------------------------------------------------------------------
>
> Key: AVRO-1406
> URL: https://issues.apache.org/jira/browse/AVRO-1406
> Project: Avro
> Issue Type: Bug
> Components: c++
> Affects Versions: 1.7.5
> Reporter: Iaroslav Zeigerman
> Labels: c++
> Fix For: 1.7.6
>
> Attachments: AVRO-1406.patch, AVRO-1406.patch
>
>
> In Java implementation there is GenericData.Record which can use field names
> to set and get data. There is nothing similar in C++ implementation.
--
This message was sent by Atlassian JIRA
(v6.1.4#6159)