Open GoogleCodeExporter opened 9 years ago
While this isn't technically true with GWT (annotations get ignored), I can see
your point about Android. I can think of two "easy" solutions:
1) Create a jar which contains just the annotations, so you can have a tiny
distribution.
2) Offer the notion of a mix-in class similar to how Jackson does. Basically
ObjectifyFactory.register() would take two classes - one, the class that's
being registered and two, the class that is being introspected for
registration. The mix-in class is essentially the same as the basic class but
with the relevant annotations added.
In practice I suspect #1 is probably the more convenient solution - maintaining
parallel class hierarchies sucks. But #2 does offer a lot of flexibility.
Original comment by lhori...@gmail.com
on 28 Jul 2010 at 8:46
#1 came to mind but I also thought it was a pain to maintain (pardon the pun).
I didn't get #2 though. Could you elaborate a bit. An example perhaps. Thanks
for Your time.
Original comment by dilbert....@gmail.com
on 28 Jul 2010 at 9:11
[deleted comment]
There is an example for Jackson mix-in on
http://www.cowtowncoder.com/blog/archives/2009/08/entry_305.html. So for the
car example
class Car {
@Id String vin;
String color;
@Unindexed String unindexed;
}
there would be an additional describing interface and the Car class could be
free of any annotations.
interface MixIn
{
@Objectify("vin") @ObjectifyId String vin();
// or maybe: @Objectify(name="vin", id=true) String vin();
@Objectify String color();
}
Later Car and MixIn is brought together.
I would like to free my JavaBeans from Objectify annotations too but I would be
happy with a more simple API also. One can also consider using a builder style
of describing the meta data. Maybe something like
ObjectifyService.register( YourEntity.class ).withId( "vin" );
That would be quite easy to implement.
Original comment by ullenb...@googlemail.com
on 29 Jul 2010 at 8:54
Hi ullenb... Thanks for the Jackson mix-in explanation. I like your idea about
programmatic configuration.
BTW here is the group thread about this issue:
http://groups.google.com/group/objectify-appengine/browse_thread/thread/9348bf24
e4ddfe26/
Original comment by dilbert....@gmail.com
on 30 Jul 2010 at 1:55
I think an annotation-only jar would be best.
Original comment by matt...@jaggard.org.uk
on 17 Nov 2011 at 10:59
There is "client-jar" nant target which produces client only jar.
Original comment by rus...@walkmind.com
on 28 Feb 2012 at 3:48
Original issue reported on code.google.com by
dilbert....@gmail.com
on 28 Jul 2010 at 8:20