2014-12-23 53 views
0

如何在Google App Engine中使用com.google.appengine.api.datastore.Category屬性 - Java?Google App Engine中的類別屬性 - Java

類的構造函數只需要String。我不確定我們是否可以使用Category作爲Multi值屬性。任何輸入或例如這是讚賞。

回答

0

找不到Category屬性的用法。所以,我想下面所提到使用List

Setting the property as mentioned below: 
//tags can contain TAG1, TAG2, TAG3, etc 
List<String> tags; 
entity.setProperty("tags", tags); 

查詢屬性:

List<String> tags = (List<String>)entity.getProperty("tags"); 
:以下提到

String tag = "TAG1"; 
Query q = new Query("EntityType").setAncestor(parentEntity.getKey()).setFilter(FilterOperator.EQUAL.of("tags", tag)); 

獲取屬性