From cee2677c3d2d2d31a5a921b625050fbb4ea45d59 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Thu, 7 Dec 2006 08:12:31 +0000 Subject: Added @Authoritative annotation. --- src/main/java/com/amazon/carbonado/info/StorableInfo.java | 5 +++++ .../com/amazon/carbonado/info/StorableIntrospector.java | 13 +++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'src/main/java/com/amazon/carbonado/info') diff --git a/src/main/java/com/amazon/carbonado/info/StorableInfo.java b/src/main/java/com/amazon/carbonado/info/StorableInfo.java index 1d6ed3e..796efb4 100644 --- a/src/main/java/com/amazon/carbonado/info/StorableInfo.java +++ b/src/main/java/com/amazon/carbonado/info/StorableInfo.java @@ -126,4 +126,9 @@ public interface StorableInfo { * @see com.amazon.carbonado.Independent */ boolean isIndependent(); + + /** + * @see com.amazon.carbonado.Authoritative + */ + boolean isAuthoritative(); } diff --git a/src/main/java/com/amazon/carbonado/info/StorableIntrospector.java b/src/main/java/com/amazon/carbonado/info/StorableIntrospector.java index 8da9c3e..29158f1 100644 --- a/src/main/java/com/amazon/carbonado/info/StorableIntrospector.java +++ b/src/main/java/com/amazon/carbonado/info/StorableIntrospector.java @@ -48,6 +48,7 @@ import org.cojen.util.WeakIdentityMap; import com.amazon.carbonado.Alias; import com.amazon.carbonado.AlternateKeys; +import com.amazon.carbonado.Authoritative; import com.amazon.carbonado.FetchException; import com.amazon.carbonado.Index; import com.amazon.carbonado.Indexes; @@ -220,7 +221,8 @@ public class StorableIntrospector { info = new Info(type, aliases, indexes, properties, primaryKey, alternateKeys, - type.getAnnotation(Independent.class) != null); + type.getAnnotation(Independent.class) != null, + type.getAnnotation(Authoritative.class) != null); cCache.put(type, new SoftReference>(info)); // Finish resolving join properties, after properties have been @@ -1121,6 +1123,7 @@ public class StorableIntrospector { private final StorableKey mPrimaryKey; private final StorableKey[] mAltKeys; private final boolean mIndependent; + private final boolean mAuthoritative; private transient String mName; private transient Map> mPrimaryKeyProperties; @@ -1131,7 +1134,8 @@ public class StorableIntrospector { Map> properties, StorableKey primaryKey, StorableKey[] altKeys, - boolean independent) + boolean independent, + boolean authoritative) { mType = type; mAliases = aliases; @@ -1140,6 +1144,7 @@ public class StorableIntrospector { mPrimaryKey = primaryKey; mAltKeys = altKeys; mIndependent = independent; + mAuthoritative = authoritative; } public String getName() { @@ -1282,6 +1287,10 @@ public class StorableIntrospector { public final boolean isIndependent() { return mIndependent; } + + public final boolean isAuthoritative() { + return mAuthoritative; + } } private static class SKey implements StorableKey { -- cgit v1.2.3