java如何从数据存储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);
返回<Text: We should arrive before dark.<br>I should have finished the book by Fr...>
(一些数据丢失了,数据的头部有<Text:
,数据的尾部有...
);这把一切都搞砸了
那么,如何从数据存储Google Cloud中检索文本类型
# 1 楼答案
您需要调用
getValue()
方法。如果将Text
对象传递给println()
,它将调用toString()
方法Here are the Javadocs