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