[英]Setting a property to com.google.appengine.api.datastore.Entity
I have an entity which has property Person person(user defined object) so I wanted to setProperty("person", new Person()) however got an IllegalArgumentException "....Person is not a supported property type". 我有一个具有属性Person person(用户定义的对象)的实体,因此我想setProperty(“ person”,new Person())但是得到了IllegalArgumentException“ .... Person不是受支持的属性类型”。 It is a simple class with field String name and String country which implements Serializable.
这是一个简单的类,具有字段String name和String country,它实现了Serializable。
class People{ Person person;
类People {人person; }
}
I am trying to: 我在尝试着:
entityOfTypePeople.setProperty("person", new Person());
this is where I get "IllegalArgumentException ....Person is not a supported property type". 这是我得到“ IllegalArgumentException .... Person不是受支持的属性类型”的地方。
Properties are always String objects (see http://download.oracle.com/javase/1.5.0/docs/api/java/util/Properties.html and http://leepoint.net/notes-java/io/30properties_and_preferences/10properties.html ) as far as I know. 属性始终是String对象(请参见http://download.oracle.com/javase/1.5.0/docs/api/java/util/Properties.html和http://leepoint.net/notes-java/io/30properties_and_preferences据我所知/10properties.html )。 I think you want to use java preferences not java properties (though to be fair, I don't know if GAE supports that or not).
我认为您想使用Java首选项而不是Java属性(尽管公平地说,我不知道GAE是否支持)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.