google-code-export / objectify-appengine

Automatically exported from code.google.com/p/objectify-appengine
MIT License
1 stars 0 forks source link

Per field annotation based storage configuration #98

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Objectify currently allows registering converters by type, but not on a 
per-field-of-class base. This shows when trying to store strings that have to 
be converted to Text in classes embedded in a collection. There is no way to 
configure Datastore to always use Text in a declarative way, without leaking 
Datastore specific classes into the domain model.

E.g.:

class A {
  @Embedded List<B> bs;
}
class B {
  String veryLongText; // gives errors when longer than 500 chars
}

Proposed solution would be either the specific:

class B {
  @Text String veryLongText; // or @StoreAsText, or sth like that
}

Or the more generic way of specifying your own converter:

class B {
  @Converter(MyConverter.class) String veryLongText;
}

Question with this: will a static class reference be sufficient, or do we need 
to tackle instances vs classes, life cycle, injection, and all those things 
here?

Original issue reported on code.google.com by martinpr...@google.com on 25 Jul 2011 at 8:48

GoogleCodeExporter commented 9 years ago

Original comment by lhori...@gmail.com on 27 Jul 2011 at 12:02

GoogleCodeExporter commented 9 years ago
This is effectively solved by the translation system in v4, and even more so by 
v5. For very fine grained control, see @Translate.

Original comment by lhori...@gmail.com on 14 Apr 2014 at 12:21