开发者

How do I dynamically create class and persist it to the Google App Engine?

How do I create persist-able class dynamically and persist it to the Goo开发者_JAVA百科gle App Engine datastore


If you mean you don't know beforehand what fields/properties will be persisted then you can use the Datastore API to create and persist entities on the fly.

Entity entity = new Entity("User"); // specify the entity kind
entity.setProperty("name", "someuser"); // add some properties
entity.setProperty("email", "some@user.com");
DatastoreServiceFactory.getDatastoreService().put(entity); //save it

However if you actually want to create 'class' dynamically then this answer would not help.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜