diff options
author | Brian S. O'Neill <bronee@gmail.com> | 2009-02-18 22:30:14 +0000 |
---|---|---|
committer | Brian S. O'Neill <bronee@gmail.com> | 2009-02-18 22:30:14 +0000 |
commit | bda8398355eeb3c3e6ec3041d961efc1f5ae68a1 (patch) | |
tree | 13a4867b37db530f957945065a29ff6a8a06c6c2 /src/main/java/com/amazon/carbonado | |
parent | a6e8ca74e51a8dad2c75f58dae73f98e459449ca (diff) |
Make sure derived properties are accessed by methods since they don't have generated fields.
Diffstat (limited to 'src/main/java/com/amazon/carbonado')
3 files changed, 14 insertions, 0 deletions
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<S extends Storable> { 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<S extends Storable> { 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;
}
|