avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Maslov <alex.mas...@lab49.com>
Subject Re: How to add custom code to avro generated Java objects?
Date Mon, 14 Mar 2011 19:58:15 GMT
Yes, it does.

Thank you.

----- Original Message -----
From: Doug Cutting [mailto:cutting@apache.org]
Sent: Monday, March 14, 2011 02:45 PM
To: user@avro.apache.org <user@avro.apache.org>
Subject: Re: How to add custom code to avro generated Java objects?

The best practice is not to modify the generated classes directly, but
rather to author classes that wrap instances of generated classes,
adding methods that enforce such constraints to those.  The wrapper
classes can then also maintain back-compatible APIs.  Does that make sense?

Doug

On 03/14/2011 10:06 AM, Aleksey Maslov wrote:
> Hi,
>
> Is there a way to specify inter dependencies between object methods in IDL?
> For example, if object tracks 2 symmetrical properties that have perfect
> -1/+1 correlation; when one is updated, the other needs to be updated (in
> opposite direction in case of -1 corr); Ex:
>
> record CredtiCardStatement {
> double balance;
> double payed;
> }
>
> so paying 100 units should decrease the balance by 100 units;
>
> any way to specify such dependencies in the IDL?
> Or if I add this code to the generated Java file, is there a way to merge
> future re-generations of the record from IDL -> avro protocol -> java, not
> override it;
>
> I am trying to smarten-up my java representations of avro data objects i get
> from generating from IDL but how can i preserve my changes, as i modify the
> IDL and re-generate the java object definitions?
>
> Thank you,
> Aleksey
>
>
> --
> View this message in context: http://apache-avro.679487.n3.nabble.com/How-to-add-custom-code-to-avro-generated-Java-objects-tp2676654p2676654.html
> Sent from the Avro - Users mailing list archive at Nabble.com.

This email and any attachments may contain information which is confidential and/or privileged.
The information is intended exclusively for the addressee and the views expressed may not
be official policy, but the personal views of the originator. If you are not the intended
recipient, be aware that any disclosure, copying, distribution or use of the contents is prohibited.
If you have received this email and any file transmitted with it in error, please notify the
sender by telephone or return email immediately and delete the material from your computer.
Internet communications are not secure and Lab49 is not responsible for their abuse by third
parties, nor for any alteration or corruption in transmission, nor for any damage or loss
caused by any virus or other defect. Lab49 accepts no liability or responsibility arising
out of or in any way connected to this email.

Mime
View raw message