StreamItemEntryBuilder.java revision a21993720988a5fc0b48594d1ff0ce6f932780b7
1/*
2 * Copyright (C) 2011 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
17package com.android.contacts.util;
18
19/**
20 * Builder for {@link StreamItemEntry}s to make writing tests easier.
21 */
22public class StreamItemEntryBuilder {
23    private long mId;
24    private String mText;
25    private String mComment;
26    private long mTimestamp;
27    private String mAction;
28    private String mActionUri;
29    private String mResPackage;
30    private int mIconRes;
31    private int mLabelRes;
32
33    public StreamItemEntryBuilder() {}
34
35    public StreamItemEntryBuilder setText(String text) {
36        mText = text;
37        return this;
38    }
39
40    public StreamItemEntryBuilder setComment(String comment) {
41        mComment = comment;
42        return this;
43    }
44
45    public StreamItemEntryBuilder setAction(String action) {
46        mAction = action;
47        return this;
48    }
49
50    public StreamItemEntryBuilder setActionUri(String actionUri) {
51        mActionUri = actionUri;
52        return this;
53    }
54
55    public StreamItemEntry build() {
56        return new StreamItemEntry(mId, mText, mComment, mTimestamp, mAction, mActionUri,
57                mResPackage, mIconRes, mLabelRes);
58    }
59}