glaforge/gaelyk — pull request #88 by codeconsole (2011-11-17 05:29:17+00:00)
Title: Pogo to Entity Coercion - Allow null keys on Pogos

If the key has not been set on a POGO, an exception will occur:

class Person {
@Key Long id
String name
}

def p = new Person(name: 'Scott')
Entity e = p as Entity // EXCEPTION
This patch allows for null keys.

Also, for some reason I was getting an exception with p.getProperty(key).
Is this because my POGO is a POJO (Java class)?

I changed the code to props[key].value() and it works fine, so I would prefer if we use props[key].value() instead.

Updated unit test to test conversion on a Pogo with a null key.

Here is the original underlying exception:
Cannot resolve which method to invoke for [class java.lang.String, null] due to overlapping prototypes between:
[class java.lang.String, class com.google.appengine.api.datastore.Key]
[class java.lang.String, class java.lang.String]