【问题标题】:How to retrieve Text type from Datastore Google Cloud?如何从 Datastore Google Cloud 中检索文本类型?
【发布时间】:2016-07-24 01:21:03
【问题描述】:

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

好的,现在,我使用这个 Java 代码插入 Datastore

Text descriptionText=new Text(description);
structureEntity.setUnindexedProperty("Description",descriptionText);

这里是检索代码:

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: 在数据的头部,... 在数据的尾部)& 这搞砸了一切。

那么,如何从 Datastore Google Cloud 中检索文本类型?

【问题讨论】:

    标签: java google-app-engine google-cloud-storage google-cloud-platform google-cloud-datastore


    【解决方案1】:

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

    【讨论】:

    猜你喜欢
    • 2018-07-16
    • 1970-01-01
    • 2020-02-23
    • 2021-01-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-06
    • 1970-01-01
    相关资源
    最近更新 更多