Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting Text to String and vise-versa in Google App-Engine JAVA

How can one convert from String to Text

java.lang.String

to

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

and vise-versa?

like image 474
Manjoor Avatar asked Dec 06 '22 02:12

Manjoor


1 Answers

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

So, use getValue() instead:

String value = someText.getValue();

Contructor of the Text class supports initialization with a string value. And (as Javadoc says), this object cannot be modified after construction.

like image 86
MiKo Avatar answered Jan 21 '23 11:01

MiKo