avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Baldassari <jbaldass...@gmail.com>
Subject Re: Deprecation warnings in generated source code
Date Thu, 05 Jan 2012 09:17:33 GMT

Since the Builder API was introduced
(AVRO-839<https://issues.apache.org/jira/browse/AVRO-839>released in
v1.6.0), direct access to record fields has been deprecated.
In some future version of Avro these fields will probably be made private.
The preferred way to access the fields in Avro 1.6.0 and later is to use
the associated getter/setter methods on the record or to use the Builder
API.  For example, if your record is called Person, you could do either of
the following:

// Use of accessor/mutator:
Person me = new Person();

// Use of Builder:
Person me2 = Person.newBuilder().setName("James").setEmail("root@localhost

There is a bit of a performance penalty with using the builder, but
hopefully that will be reduced somewhat when
AVRO-985<https://issues.apache.org/jira/browse/AVRO-985>is resolved.


On Thu, Jan 5, 2012 at 3:31 AM, Karthik Sampath Kumar <karbrv@gmail.com>wrote:

> I have 2 fields in .avsc file
>         {"name": "name", "type": "string"},
>         {"name": "email", "type": "string"},
> I get the following in generated  source code. Why does it contain  *
> @Deprecated* on the generated source code?
> *  @Deprecated* public java.lang.CharSequence name;
>   *@Deprecated* public java.lang.CharSequence email;
> It occurs only in version* 1.6.1 *of the avro-maven-plugin
> This doesn't happen when I use the 1.5.1 version

View raw message