Permalink
Browse files

Merge pull request #228 from OutOfInception/issue/226

#226 ReflectionEntityCoercion does not use the transformValueFor{Retr…
  • Loading branch information...
musketyr committed Jun 5, 2018
2 parents 3c60de3 + d8f4bd0 commit a0fe772324d61265fdc2cc13aec627300630b600
Showing with 5 additions and 2 deletions.
  1. +5 −2 core/src/main/groovyx/gaelyk/datastore/ReflectionEntityCoercion.groovy
@@ -26,6 +26,9 @@ import com.google.appengine.api.datastore.Entities
import com.google.appengine.api.datastore.Entity
import com.google.appengine.api.datastore.EntityNotFoundException
import static groovyx.gaelyk.extensions.DatastoreExtensions.transformValueForRetrieval
import static groovyx.gaelyk.extensions.DatastoreExtensions.transformValueForStorage
/**
* Utility class handling the POGO to Entity coercion, and Entity to POGO coercion as well.
*
@@ -175,7 +178,7 @@ class ReflectionEntityCoercion {
props.each { String propName, PropertyDescriptor m ->
if (propName != key && propName != parent) {
if (!props[propName].ignore() && !props[propName].version() && !props[propName].parent()) {
def val = p.metaClass.getProperty(p, propName)
def val = transformValueForStorage(p.metaClass.getProperty(p, propName))
if (props[propName].unindexed()) {
entity.setUnindexedProperty(propName, val)
} else {
@@ -212,7 +215,7 @@ class ReflectionEntityCoercion {
entityProps.each { String k, v ->
if (o.metaClass.hasProperty(o, k)) {
try {
o[k] = v
o[k] = transformValueForRetrieval(v)
} catch(ReadOnlyPropertyException rope){
// cannot set read only property!
}

0 comments on commit a0fe772

Please sign in to comment.