Here's my property definition via Objectify:
@Unindex
@Load
private List<Ref<Achievement>> oTrophyCase;
public List<Ref<Achievement>> getTrophyCase() {
return oTrophyCase;
}
public void setTrophyCase(List<Ref<Achievement>> trophyCase) {
this.oTrophyCase = trophyCase;
}
Though I have seen other example with the same if not similar design, I am getting this error at compile time:
Error:Execution failed for task ':backend:appengineEndpointsGetClientLibs'. There was an error running endpoints command get-client-lib: Parameterized type com.googlecode.objectify.Ref not supported.
I am using Objectify 5.1.5.
I'm looking for the same answer and found:
Google Cloud Endpoints is unable to serialise the Ref object because it is an arbitrary object defined by objectify, therefore not supported as the error indicates.
There are two ways you can now approach the issue with the property.
- Add an
@ApiResourceProperty
annotation that causes the key to be omitted from your object during serialization. Use this approach if you want a simple solution and don't need access to the key in your clients.- Add an
@ApiTransformer
annotation that provides a compatible mechanism to serialize/deserialize the field. Use this approach if need access to the key (or a representation of it) in your clients. As this requires writing a transformer class, it is more work than the first option.
but more interesting is
This is an issue with Cloud Endpoints, not Objectify. CE appears to need some sort of custom serializer for unknown classes, like GWT. If you can figure out what is necessary, we might consider including it in the Objectify source.
So I found you can solve it as suggested above, by annotating the field with @ApiResourceProperty(ignored = AnnotationBoolean.TRUE)
, or with @ApiTransformer(value=class)
, where the class is a custom Transformer explaining the compiler how to serialize the object.