1package com.xtremelabs.robolectric.shadows;
2
3import java.util.Map;
4
5import android.content.ContentProviderOperation;
6import android.content.ContentProviderOperation.Builder;
7import android.net.Uri;
8
9import com.xtremelabs.robolectric.Robolectric;
10import com.xtremelabs.robolectric.internal.Implementation;
11import com.xtremelabs.robolectric.internal.Implements;
12import com.xtremelabs.robolectric.internal.RealObject;
13
14@Implements(ContentProviderOperation.Builder.class)
15public class ShadowContentProviderOperationBuilder {
16    @RealObject private Builder realBuilder;
17    private ContentProviderOperation contentProviderOperation;
18    private ShadowContentProviderOperation shadowContentProviderOperation;
19
20    public void __constructor__() {
21        contentProviderOperation = Robolectric.newInstanceOf(ContentProviderOperation.class);
22        shadowContentProviderOperation = Robolectric.shadowOf(contentProviderOperation);
23    }
24
25    @Implementation
26    public Builder withValue(String key, Object value) {
27        shadowContentProviderOperation.getValues().put(key, value);
28        return realBuilder;
29    }
30
31    @Implementation
32    public Builder withSelection(String selection, String[] selectionArgs) {
33        shadowContentProviderOperation.getSelections().put(selection, selectionArgs);
34        return realBuilder;
35    }
36
37    @Implementation
38    public Builder withValueBackReference(String key, int previousResult) {
39        shadowContentProviderOperation.setWithValueBackReference(key, previousResult);
40        return realBuilder;
41    }
42
43    @Implementation
44    public ContentProviderOperation build() {
45        return contentProviderOperation;
46    }
47
48    public Uri getUri() {
49        return shadowContentProviderOperation.getUri();
50    }
51
52    public void setUri(Uri uri) {
53        shadowContentProviderOperation.setUri(uri);
54    }
55
56    public Map<String, Object> getValues() {
57        return shadowContentProviderOperation.getValues();
58    }
59
60    public Map<String, String[]> getSelections() {
61        return shadowContentProviderOperation.getSelections();
62    }
63
64    public boolean isInsert() {
65        return shadowContentProviderOperation.isInsert();
66    }
67
68    public void setInsert(boolean value) {
69        shadowContentProviderOperation.setInsert(value);
70    }
71
72    public boolean isUpdate() {
73        return shadowContentProviderOperation.isUpdate();
74    }
75
76    public void setUpdate(boolean value) {
77        shadowContentProviderOperation.setUpdate(value);
78    }
79
80    public boolean isDelete() {
81        return shadowContentProviderOperation.isDelete();
82    }
83
84    public void setDelete(boolean value) {
85        shadowContentProviderOperation.setDelete(value);
86    }
87
88    public int getWithValueBackReference(String key) {
89        return shadowContentProviderOperation.getWithValueBackReference(key);
90    }
91}