From bda8398355eeb3c3e6ec3041d961efc1f5ae68a1 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Wed, 18 Feb 2009 22:30:14 +0000 Subject: Make sure derived properties are accessed by methods since they don't have generated fields. --- .../java/com/amazon/carbonado/raw/GenericEncodingStrategy.java | 8 ++++++++ src/main/java/com/amazon/carbonado/raw/GenericPropertyInfo.java | 2 ++ src/main/java/com/amazon/carbonado/raw/StorablePropertyInfo.java | 4 ++++ 3 files changed, 14 insertions(+) (limited to 'src/main/java/com/amazon') diff --git a/src/main/java/com/amazon/carbonado/raw/GenericEncodingStrategy.java b/src/main/java/com/amazon/carbonado/raw/GenericEncodingStrategy.java index c5417c4..d89aca5 100644 --- a/src/main/java/com/amazon/carbonado/raw/GenericEncodingStrategy.java +++ b/src/main/java/com/amazon/carbonado/raw/GenericEncodingStrategy.java @@ -1331,6 +1331,10 @@ public class GenericEncodingStrategy { Class adapterInstanceClass, LocalVariable partialStartVar) { + if (info.isDerived()) { + useReadMethod = true; + } + final TypeDesc type = info.getPropertyType(); final TypeDesc storageType = info.getStorageType(); @@ -2351,6 +2355,10 @@ public class GenericEncodingStrategy { boolean useWriteMethod, LocalVariable instanceVar, Class adapterInstanceClass) { + if (info.isDerived()) { + useWriteMethod = true; + } + TypeDesc type = info.getPropertyType(); TypeDesc storageType = info.getStorageType(); diff --git a/src/main/java/com/amazon/carbonado/raw/GenericPropertyInfo.java b/src/main/java/com/amazon/carbonado/raw/GenericPropertyInfo.java index 9e246f2..fc082a5 100644 --- a/src/main/java/com/amazon/carbonado/raw/GenericPropertyInfo.java +++ b/src/main/java/com/amazon/carbonado/raw/GenericPropertyInfo.java @@ -46,6 +46,8 @@ public interface GenericPropertyInfo { boolean isLob(); + boolean isDerived(); + /** * Returns the optional method used to adapt the property from the * storage supported type to the user visible type. diff --git a/src/main/java/com/amazon/carbonado/raw/StorablePropertyInfo.java b/src/main/java/com/amazon/carbonado/raw/StorablePropertyInfo.java index 18db76b..913bc7e 100644 --- a/src/main/java/com/amazon/carbonado/raw/StorablePropertyInfo.java +++ b/src/main/java/com/amazon/carbonado/raw/StorablePropertyInfo.java @@ -76,6 +76,10 @@ public class StorablePropertyInfo implements GenericPropertyInfo { return clazz != null && Lob.class.isAssignableFrom(clazz); } + public boolean isDerived() { + return mProp.isDerived(); + } + public Method getFromStorageAdapter() { return mFromStorage; } -- cgit v1.2.3