Skip to content
Browse files

tuned up POGO coercion

  • Loading branch information...
1 parent bae3c4d commit f9f1c0c25c6735557db9367cbac1a1a86710a3f8 @musketyr musketyr committed
View
3 .gitignore
@@ -11,4 +11,5 @@ out
.settings
website/war/api
website/war/WEB-INF/classes
-website/war/WEB-INF/lib
+website/war/WEB-INF/lib
+/gaelyk-template-project.zip
View
12 core/src/main/groovyx/gaelyk/datastore/EntityTransformation.groovy
@@ -58,6 +58,10 @@ class EntityTransformation extends AbstractASTTransformation {
ClassNode parent = (ClassNode) nodes[1]
ClassNode keyType = handleKey(parent, source)
+ if(!keyType) {
+ return
+ }
+
ClassNode keyCN = ClassHelper.makeWithoutCaching(Key).plainNodeReference
handleVersion(parent, source)
@@ -337,21 +341,25 @@ class EntityTransformation extends AbstractASTTransformation {
}
}
+ parent.addField new FieldNode('DATASTORE_INDEXED_PROPERTIES', Modifier.PRIVATE | Modifier.STATIC | Modifier.FINAL, getBoundListNode(ClassHelper.STRING_TYPE), parent, buildList(indexed))
+
parent.addMethod new MethodNode(
'getDatastoreIndexedProperties',
Modifier.PUBLIC,
getBoundListNode(ClassHelper.STRING_TYPE),
Parameter.EMPTY_ARRAY,
ClassNode.EMPTY_ARRAY,
- new ReturnStatement(buildList(indexed))
+ new ReturnStatement(new VariableExpression('DATASTORE_INDEXED_PROPERTIES'))
)
+
+ parent.addField new FieldNode('DATASTORE_UNINDEXED_PROPERTIES', Modifier.PRIVATE | Modifier.STATIC | Modifier.FINAL, getBoundListNode(ClassHelper.STRING_TYPE), parent, buildList(unindexed))
parent.addMethod new MethodNode(
'getDatastoreUnindexedProperties',
Modifier.PUBLIC,
getBoundListNode(ClassHelper.STRING_TYPE),
Parameter.EMPTY_ARRAY,
ClassNode.EMPTY_ARRAY,
- new ReturnStatement(buildList(unindexed))
+ new ReturnStatement(new VariableExpression('DATASTORE_UNINDEXED_PROPERTIES'))
)
}
View
18 core/src/test/groovyx/gaelyk/datastore/EntityTransformationSpec.groovy
@@ -255,6 +255,24 @@ class EntityTransformationSpec extends Specification {
obj.getDatastoreParent() == null
}
+ def "Test DatastoreEntity implementation 2"(){
+ def obj = newShell().evaluate '''
+ import groovyx.gaelyk.datastore.Key
+ import groovyx.gaelyk.datastore.Entity as GE
+ import groovy.transform.Canonical
+
+ @Canonical @GE
+ class Person {
+ @Key long id
+ String name
+ }
+
+ new Person(id: 15, name: 'test')'''
+ expect:
+ obj
+ }
+
+
private GroovyShell newShell() {
CompilerConfiguration cc = new CompilerConfiguration()
View
1 template-project/build.gradle
@@ -44,6 +44,7 @@ dependencies {
compile "com.google.appengine:appengine-api-1.0-sdk:$gaeVersion",
"com.google.appengine:appengine-api-labs:$gaeVersion"
compile 'org.gaelyk:gaelyk:2.0-SNAPSHOT'
+ compile 'org.gaelyk:gaelyk-console:2.0-SNAPSHOT'
/**
* To add binary plugin just declare it as a dependency. For example,

0 comments on commit f9f1c0c

Please sign in to comment.
Something went wrong with that request. Please try again.