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 >> Schema generation from POJO


Copy link to this message
-
Re: Schema generation from POJO
You can use Avro's reflect facilities:

http://avro.apache.org/docs/current/api/java/org/apache/avro/reflect/package-summary.html

In particular, you can use:
  Schema s = ReflectData.get().getSchema(MyPojo.class);
or
  DatumWriter<MyPojo> writer = new ReflectDatumWriter<MyPojo>(MyPojo.class);
or
  DatumReader<MyPojo> reader = new ReflectDatumReader<MyPojo>(MyPojo.class);
etc.

Doug

On Wed, Aug 21, 2013 at 12:21 PM, Sathwik B P <[EMAIL PROTECTED]> wrote:
> Hi guys,
>
> Is  there a way to generate the schema from existing pojos.
>
> regards,
> sathwik
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