Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Avro >> mail # user >> re-use or copy a Field


Copy link to this message
-
re-use or copy a Field
I often find myself manipulating record schemas or creating new ones from
the fields of existing ones in Java.

Now at first i just tried to re-use a field of an existing record schema in
a new record schema, but no luck: i ran into the "Field already used"
runtime exception. Apparently a field is aware of its position and does not
like to be re-used because of that. For the same reason i assume
Field.clone() or something like that will be of no use either.

I could create a copy myself using the Field constructor, however that way
i lose the aliases and props. In avro 1.5.4 there is no way to get to these
either.

Any suggestions? Thanks
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB