summaryrefslogtreecommitdiff
path: root/src/main/java/com/amazon/carbonado/info
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2008-04-18 20:23:47 +0000
committerBrian S. O'Neill <bronee@gmail.com>2008-04-18 20:23:47 +0000
commit5403ce66194832e9887cc0d0222ff449464e041f (patch)
treea43e942b2232d69cb14c0885b05a5a9602c4506e /src/main/java/com/amazon/carbonado/info
parent80feb9546265d9c0feb9837e6cca041dbffc222d (diff)
Support renamed properties in indexes and keys.
Diffstat (limited to 'src/main/java/com/amazon/carbonado/info')
-rw-r--r--src/main/java/com/amazon/carbonado/info/ChainedProperty.java5
-rw-r--r--src/main/java/com/amazon/carbonado/info/StorableIntrospector.java12
-rw-r--r--src/main/java/com/amazon/carbonado/info/StorableProperty.java11
3 files changed, 20 insertions, 8 deletions
diff --git a/src/main/java/com/amazon/carbonado/info/ChainedProperty.java b/src/main/java/com/amazon/carbonado/info/ChainedProperty.java
index 65151e8..24a30cf 100644
--- a/src/main/java/com/amazon/carbonado/info/ChainedProperty.java
+++ b/src/main/java/com/amazon/carbonado/info/ChainedProperty.java
@@ -562,11 +562,8 @@ public class ChainedProperty<S extends Storable> implements Serializable, Append
appendPropTo(app, mPrime.getName(), isOuterJoin(0));
StorableProperty<?>[] chain = mChain;
if (chain != null) {
- app.append('.');
for (int i=0; i<chain.length; i++) {
- if (i > 0) {
- app.append('.');
- }
+ app.append('.');
appendPropTo(app, chain[i].getName(), isOuterJoin(i + 1));
}
}
diff --git a/src/main/java/com/amazon/carbonado/info/StorableIntrospector.java b/src/main/java/com/amazon/carbonado/info/StorableIntrospector.java
index fdfb51f..94b391e 100644
--- a/src/main/java/com/amazon/carbonado/info/StorableIntrospector.java
+++ b/src/main/java/com/amazon/carbonado/info/StorableIntrospector.java
@@ -624,7 +624,7 @@ public class StorableIntrospector {
String sig = createSig(readMethod);
if (storableProp.isDerived() || methods.containsKey(sig)) {
methods.remove(sig);
- properties.put(property.getName(), storableProp);
+ properties.put(storableProp.getName(), storableProp);
} else {
continue;
}
@@ -634,7 +634,7 @@ public class StorableIntrospector {
String sig = createSig(writeMethod);
if (storableProp.isDerived() || methods.containsKey(sig)) {
methods.remove(sig);
- properties.put(property.getName(), storableProp);
+ properties.put(storableProp.getName(), storableProp);
} else {
continue;
}
@@ -1594,6 +1594,7 @@ public class StorableIntrospector {
private final boolean mAutomatic;
private final boolean mIsDerived;
private final String mName;
+ private final String mBeanName;
// Temporary reference until derived from is resolved.
private Derived mDerived;
@@ -1635,13 +1636,18 @@ public class StorableIntrospector {
mAutomatic = automatic;
mIsDerived = derived != null;
mDerived = derived;
- mName = name == null ? mBeanProperty.getName() : name;
+ mBeanName = mBeanProperty.getName();
+ mName = name == null ? mBeanName : name;
}
public final String getName() {
return mName;
}
+ public final String getBeanName() {
+ return mBeanName;
+ }
+
public final Class<?> getType() {
return mBeanProperty.getType();
}
diff --git a/src/main/java/com/amazon/carbonado/info/StorableProperty.java b/src/main/java/com/amazon/carbonado/info/StorableProperty.java
index 0d77481..38418ec 100644
--- a/src/main/java/com/amazon/carbonado/info/StorableProperty.java
+++ b/src/main/java/com/amazon/carbonado/info/StorableProperty.java
@@ -31,11 +31,20 @@ import com.amazon.carbonado.util.Appender;
*/
public interface StorableProperty<S extends Storable> extends Serializable, Appender {
/**
- * Returns the name of this property.
+ * Returns the name of this property, which is the same as the bean name
+ * unless it has been {@link com.amazon.carbonado.Name renamed}.
*/
String getName();
/**
+ * Returns the bean name of this property, which is derived from the read
+ * and write method names.
+ *
+ * @since 1.2
+ */
+ String getBeanName();
+
+ /**
* Returns the type of this property.
*/
Class<?> getType();