Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 a0fe772
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/src/main/groovyx/gaelyk/datastore/ReflectionEntityCoercion.groovy 100644 → 100755
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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!
}
Expand Down

0 comments on commit a0fe772

Please sign in to comment.