0

Вот мое определение собственности через объективировать:Параметризованные типа не поддерживается

@Unindex 
@Load 
private List<Ref<Achievement>> oTrophyCase; 
public List<Ref<Achievement>> getTrophyCase() { 
    return oTrophyCase; 
} 
public void     setTrophyCase(List<Ref<Achievement>> trophyCase) { 
    this.oTrophyCase = trophyCase; 
} 

Хотя я видел другой пример с тем же, если не похожим дизайном, я получаю эту ошибку во время компиляции:

Ошибки : Выполнение выполнено для задачи ': backend: appengineEndpointsGetClientLibs'. Произошла ошибка Команда endpoints get-client-lib: Параметрированный тип com.googlecode.objectify.Ref не поддерживается.

Я использую Objectify 5.1.5.

ответ

0

Я ищу тот же ответ и нашел:

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.

  1. 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.
  2. 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.

но более интересным является

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.

Так что я нашел вы можете решить, как предложено выше, аннотирования поле с @ApiResourceProperty(ignored = AnnotationBoolean.TRUE), или с @ApiTransformer(value=class), где класс является обычай Transformer объясняя компилятору, как сериализовать объект.

+0

Таким образом, ссылки приветствуются в ответах, всегда нужно писать важную информацию в ответ, поскольку ссылки могут меняться. Спасибо! – Alex

+0

Хорошо, я отредактировал ответ. спасибо – Marco

Смежные вопросы