Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App Engine - why are there PhoneNumber, Link, Rating etc classes?

I haven't found any reason for the existence of a few of the App Engine classes. There's a PhoneNumber, a Link, a PostalAddress, a GeoPt, a Rating, etc. Why are these given special treatment? They don't seem to have any smarts - e.g. geo searching. I know Link has more space than a String property, but the rest?

See: http://code.google.com/appengine/docs/java/datastore/dataclasses.html

like image 933
Richard Watson Avatar asked Dec 06 '09 18:12

Richard Watson


1 Answers

Those types are 'semantic' types. They're present in the Java API for parity with the Python API. In the Python API, they define special behaviour with regards to the .to_xml() method - for example, a PhoneNumberProperty serializes like this:

<property name="foo" type="gd:phonenumber"><gd:phoneNumber>12345-678</gd:phoneNumber></property>
like image 94
Nick Johnson Avatar answered Nov 03 '22 00:11

Nick Johnson