views:

68

answers:

2

How can one convert from String to Text

java.lang.String

to

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

and vise-versa?

+4  A: 

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.

Bar
A: 

Does anyone have information about how to convert from String to Text? The Javadoc (as well as the example above) states how to go from Text to String, but not the other direction.

JZMatrix
Well as @Bar says you can use constructor of Text. I have not tested it yet but hope it works
Manjoor