Converting Text to String and Vise-Versa in Google App-Engine Java

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?

1 Answer

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

David Miller
Author

David Miller

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.