@Transient with the external mappings?

16 views
Skip to first unread message

Jamie Cramb

unread,
Jan 31, 2013, 12:38:00 PM1/31/13
to pir...@googlegroups.com
Is it possible to define a property as @Transient with the external mappings?

Cheers,
Jamie

Harald Pehl

unread,
Jan 31, 2013, 3:24:05 PM1/31/13
to pir...@googlegroups.com
Hi Jamie,

sorry for the long delay. I just checked the source: You cannot define a property transient using external mappings. But that is not necessary IMO. If you want to skip a property just don't include it in the @Mappings annotations. AFAICR only the properties in the @Mappings annotation will be processed. 

Cheers 
Harald

---
Harald Pehl




--
You received this message because you are subscribed to the Google Groups "Piriti" group.
To unsubscribe from this group and stop receiving emails from it, send an email to piriti+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Jamie Cramb

unread,
Feb 1, 2013, 1:16:05 PM2/1/13
to pir...@googlegroups.com
Hi Harald,

First off, no problem & thanks for the response / great work on Piriti to date!

But that is not necessary IMO. If you want to skip a property just don't include it in the @Mappings annotations. AFAICR only the properties in the @Mappings annotation will be processed. 

This is what I thought as well but it looks like it picks up all of the properties even if you define explicit @Mapping's for only a subset of the properties.

The reason I'm trying to work around this problem is that I have some sections of an object graph (with circular references) that I don't want to (de)serialize. I'm thinking that I might be able to solve this problem by using a custom getter; however, I'm not sure how widely supported this feature of the @Mapping is; I found it in the source not the docs and saw some unexpected behaviors when using it before such as:
  • Needing to place a valid property into the code even though I wanted to use a custom getter to create a fabricated property at write time (i.e. I wanted to include type information in the JSON document on write).
  • Needing to define the custom getter on the writer definition for all sub-classes of a type hierarchy. 
I have created a test project that mirrors the type of work I'm currently doing / proves out the issue I mentioned above and have put it up on github: https://github.com/jamiecramb/piriti-example.

It would be great if you could take a look at the project and:
  • See if you can spot anything wrong that I'm doing in terms of having all properties de-serialized even if I only explicitly map a few.
  • Give any feedback you have on the technique I'm using to support two-way polymorphism / inheritance between the server & GWT app (I needed to use a custom Getter to solve the gwt -> server communication; however, I think this could be fixed if Piriti was to implement type support functionality in a similar way to Jackson on the server side).
Hope you have a great weekend.

Cheers,
Jamie
Reply all
Reply to author
Forward
0 new messages