1 /* 2 * Copyright (C) 2009 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.pim.vcard; 18 19 import android.content.ContentValues; 20 21 /** 22 * ContentValues-like class which enables users to chain put() methods and restricts 23 * the other methods. 24 */ 25 /* package */ class ContentValuesBuilder { 26 private final ContentValues mContentValues; 27 28 public ContentValuesBuilder(final ContentValues contentValues) { 29 mContentValues = contentValues; 30 } 31 32 public ContentValuesBuilder put(String key, String value) { 33 mContentValues.put(key, value); 34 return this; 35 } 36 37 public ContentValuesBuilder put(String key, Byte value) { 38 mContentValues.put(key, value); 39 return this; 40 } 41 42 public ContentValuesBuilder put(String key, Short value) { 43 mContentValues.put(key, value); 44 return this; 45 } 46 47 public ContentValuesBuilder put(String key, Integer value) { 48 mContentValues.put(key, value); 49 return this; 50 } 51 52 public ContentValuesBuilder put(String key, Long value) { 53 mContentValues.put(key, value); 54 return this; 55 } 56 57 public ContentValuesBuilder put(String key, Float value) { 58 mContentValues.put(key, value); 59 return this; 60 } 61 62 public ContentValuesBuilder put(String key, Double value) { 63 mContentValues.put(key, value); 64 return this; 65 } 66 67 public ContentValuesBuilder put(String key, Boolean value) { 68 mContentValues.put(key, value); 69 return this; 70 } 71 72 public ContentValuesBuilder put(String key, byte[] value) { 73 mContentValues.put(key, value); 74 return this; 75 } 76 77 public ContentValuesBuilder putNull(String key) { 78 mContentValues.putNull(key); 79 return this; 80 } 81 } 82