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 */
16package com.android.vcard.tests.testutils;
17
18import android.content.ContentValues;
19
20/**
21 * ContentValues-like class which enables users to chain put() methods and restricts
22 * the other methods.
23 */
24public class ContentValuesBuilder {
25    private final ContentValues mContentValues;
26
27    public ContentValuesBuilder(final ContentValues contentValues) {
28        mContentValues = contentValues;
29    }
30
31    public ContentValuesBuilder put(String key, String value) {
32        mContentValues.put(key, value);
33        return this;
34    }
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    /*
53    public ContentValuesBuilder put(String key, Long value) {
54        mContentValues.put(key, value);
55        return this;
56    }
57
58    public ContentValuesBuilder put(String key, Float value) {
59        mContentValues.put(key, value);
60        return this;
61    }
62
63    public ContentValuesBuilder put(String key, Double value) {
64        mContentValues.put(key, value);
65        return this;
66    }
67
68    public ContentValuesBuilder put(String key, Boolean value) {
69        mContentValues.put(key, value);
70        return this;
71    }*/
72
73    public ContentValuesBuilder put(String key, byte[] value) {
74        mContentValues.put(key, value);
75        return this;
76    }
77
78    public ContentValuesBuilder putNull(String key) {
79        mContentValues.putNull(key);
80        return this;
81    }
82}
83