I am using Objectify and want to have the Key <> type passed in my API. I created ApiTransformer, but my questions are the declaration, because the serialized Key <> class is not available, so I cannot declare its transformer as a class annotation. I tried to declare it in the @Api annotation, but it does not work, I still get the error message:
There was a problem generating the API metadata for your Cloud Endpoints classes: java.lang.IllegalArgumentException: Parameterized type com.googlecode.objectify.Key<[my package].User> not supported.
ApiTransformer looks like this:
public class KeyTransformer implements Transformer<Key<?>, String> {
public String transformTo(Key<?> in) {
return in.getString();
}
public Key<?> transformFrom(String in) {
return Key.valueOf(in);
}
}
And in my @Api I:
@Api(name = "users", version = "v1",transformers = {KeyTransformer.class})
source
share