Avro, mail # user - Re: How to use java-class with JSON schema? - 2014-07-03, 18:14
Solr & Elasticsearch trainings in New York & San Francisco [more info][hide]
 Search Hadoop and all its subprojects:

Switch to Threaded View
Copy link to this message
-
Re: How to use java-class with JSON schema?
The java-class attribute is supported by the reflect implementation,
not by the code-generating specific implementation.  So you could
define Foo in Java with something like:

public class Foo {
  private long batchId;
  @Stringable private Timestamp timestamp;
  public Foo() {}
  public Foo(long batchId, Timestamp timestamp) { ... }
}

then use ReflectData to read/write instances.  Note that
java.sql.Timestamp doesn't have a string constructor.  Are you using a
different timestamp class?  If you're defining your own then you could
instead add the @Stringable annotation to your Timestamp class rather
than to each field where it is used.

Reflect-defined schemas can refer to specific-defined classes, but not
vice-versa, since the compiler doesn't use reflection to discover
schemas, but rather always generates from the schema alone.

Doug

On Wed, Jul 2, 2014 at 8:05 AM, Ian Hummel <[EMAIL PROTECTED]> wrote:

 
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