Home | History | Annotate | Download | only in util
      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 
     17 package com.android.contacts.util;
     18 
     19 /**
     20  * Builder for {@link StreamItemEntry}s to make writing tests easier.
     21  */
     22 public class StreamItemEntryBuilder {
     23     private long mId;
     24     private String mText;
     25     private String mComment;
     26     private long mTimestamp;
     27     private String mAccountType;
     28     private String mAccountName;
     29     private String mDataSet;
     30     private String mResPackage;
     31     private String mIconRes;
     32     private String mLabelRes;
     33 
     34     public StreamItemEntryBuilder() {}
     35 
     36     public StreamItemEntryBuilder setText(String value) {
     37         mText = value;
     38         return this;
     39     }
     40 
     41     public StreamItemEntryBuilder setComment(String value) {
     42         mComment = value;
     43         return this;
     44     }
     45 
     46     public StreamItemEntryBuilder setAccountType(String value) {
     47         mAccountType = value;
     48         return this;
     49     }
     50 
     51     public StreamItemEntryBuilder setAccountName(String value) {
     52         mAccountName = value;
     53         return this;
     54     }
     55 
     56     public StreamItemEntryBuilder setDataSet(String value) {
     57         mDataSet = value;
     58         return this;
     59     }
     60 
     61     public StreamItemEntry build() {
     62         return new StreamItemEntry(mId, mText, mComment, mTimestamp, mAccountType, mAccountName,
     63                 mDataSet, mResPackage, mIconRes, mLabelRes);
     64     }
     65 }