summaryrefslogtreecommitdiffstats
path: root/core/java/android/content/ContentProviderOperation.java
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2009-07-28 20:39:35 -0700
committerJeff Sharkey <jsharkey@android.com>2009-07-28 20:39:35 -0700
commitbc25407b9299ae433023ddf147fe633f3b3b640c (patch)
tree3dd97e753fd3410c1912f7795c1a750a04d5bd16 /core/java/android/content/ContentProviderOperation.java
parentf256c4001bfd65169158af854672df0eea234d54 (diff)
downloadframeworks_base-bc25407b9299ae433023ddf147fe633f3b3b640c.zip
frameworks_base-bc25407b9299ae433023ddf147fe633f3b3b640c.tar.gz
frameworks_base-bc25407b9299ae433023ddf147fe633f3b3b640c.tar.bz2
Expose type constants and accessor for unit tests.
Internally, ContentProviderOperation maintains a "type", which correspond to builder methods, such as "newInsert()". Unit tests often need to assert which operations are being built, so this change adds a getType() accessor and esposes the internal constants used. They are marked with @hide so they are not exposed in the public API.
Diffstat (limited to 'core/java/android/content/ContentProviderOperation.java')
-rw-r--r--core/java/android/content/ContentProviderOperation.java21
1 files changed, 15 insertions, 6 deletions
diff --git a/core/java/android/content/ContentProviderOperation.java b/core/java/android/content/ContentProviderOperation.java
index 8b0b6ab..c0db01a 100644
--- a/core/java/android/content/ContentProviderOperation.java
+++ b/core/java/android/content/ContentProviderOperation.java
@@ -26,10 +26,14 @@ import java.util.Map;
import java.util.HashMap;
public class ContentProviderOperation implements Parcelable {
- private final static int TYPE_INSERT = 1;
- private final static int TYPE_UPDATE = 2;
- private final static int TYPE_DELETE = 3;
- private final static int TYPE_COUNT = 4;
+ /** @hide exposed for unit tests */
+ public final static int TYPE_INSERT = 1;
+ /** @hide exposed for unit tests */
+ public final static int TYPE_UPDATE = 2;
+ /** @hide exposed for unit tests */
+ public final static int TYPE_DELETE = 3;
+ /** @hide exposed for unit tests */
+ public final static int TYPE_COUNT = 4;
private final int mType;
private final Uri mUri;
@@ -65,7 +69,7 @@ public class ContentProviderOperation implements Parcelable {
mSelectionArgs = source.readInt() != 0 ? source.readStringArray() : null;
mExpectedCount = source.readInt() != 0 ? source.readInt() : null;
mValuesBackReferences = source.readInt() != 0
-
+
? ContentValues.CREATOR.createFromParcel(source)
: null;
mSelectionArgsBackReferences = source.readInt() != 0
@@ -167,6 +171,11 @@ public class ContentProviderOperation implements Parcelable {
return mUri;
}
+ /** @hide exposed for unit tests */
+ public int getType() {
+ return mType;
+ }
+
public boolean isWriteOperation() {
return mType == TYPE_DELETE || mType == TYPE_INSERT || mType == TYPE_UPDATE;
}
@@ -492,7 +501,7 @@ public class ContentProviderOperation implements Parcelable {
}
return this;
}
-
+
/**
* The selection and arguments to use. An occurrence of '?' in the selection will be
* replaced with the corresponding occurence of the selection argument. Any of the