如何从 Datastore Google Cloud 检索文本类型?

How to retrieve Text type from Datastore Google Cloud?

好的,这些都是基本问题,但是在网上找到的答案不多。

好的,现在,我使用此 Java 代码

插入数据存储
Text descriptionText=new Text(description);
structureEntity.setUnindexedProperty("Description",descriptionText);

Anh 这是检索代码:

Text description=(Text)structureObjectEntity.getProperty("Description");\
System.out.println(description);

现在,假设我将“We should arrive before dark.<br>I should have finished the book by Friday. <br>The roads should be less crowded today.<br><br>Source: http://www.oxfordlearnersdictionaries.com/definition/english/should?q=should”插入数据存储区

但是在检索数据时,System.out.println(description); return <Text: We should arrive before dark.<br>I should have finished the book by Fr...>(部分数据丢失&数据头部有<Text:&... 在数据的尾部)&这把一切都搞砸了。

那么,如何从数据存储 Google 云中检索文本类型?

您需要调用getValue()方法。如果将 Text 对象传递给 println(),它将调用 toString() 方法。 Here are the Javadocs