For numbers you can use the java.lang.Number its the parent class of
all "numbers". It has methods like shortValue(), longValue() ... that
you can use to extract values.

For Lists just extract a Collection and convert the collection to a
list. Strings are the most complicated, because a you need a Text
value to store greater than 500 chars, so just do a simple instanceof
to test if type Text or String. When going into the datastore you
should generally store as Text except where you need the value to be
indexed, in which case you have to use string.

On Nov 24, 2:59 am, jzhan <jzha...@gmail.com> wrote:
> I was wondering what the relationship between the type that went into
> setProperty and the types that I get out from getProperty is. I've
> found bits and pieces of information like all sets will be converted
> to Collection, shorts maybe converted to long, etc. Is there a table
> somewhere that list all these conversions?
>
> The reason why I ask is because I don't want to do blind casting in my
> code and try everything until I stop getting an exception. Even then
> it's not robust since it's possible to convert a long into an int but
> I might lose information in the process. I'm trying to persist
> schemaless objects, so I can't do blind casting like every example
> I've seen on the web.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to