Convert text to string and vice versa in Google App Engine JAVA

How can I convert from String to Text

java.lang.String 

to

 com.google.appengine.api.datastore.Text; 

and vice versa -

+4
source share
1 answer

Check out the Javadoc about the Text class. It has two methods: toString() and getValue() . But toString() only returns the first 70 characters.

So use getValue() instead:

 String value = someText.getValue(); 

The Text class contractor supports initialization with a string value. And (as Javadok says), this object cannot be modified after construction.

+15
source

Source: https://habr.com/ru/post/1309570/


All Articles