1 /* 2 * Copyright (C) 2018 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.example.android.autofill.service.model; 18 19 import android.arch.persistence.room.ColumnInfo; 20 import android.arch.persistence.room.Embedded; 21 import android.arch.persistence.room.Entity; 22 import android.support.annotation.NonNull; 23 24 import static com.example.android.autofill.service.data.source.local.db.Converters.IntList; 25 26 @Entity(primaryKeys = {"typeName"}) 27 public class FieldType { 28 @NonNull 29 @ColumnInfo(name = "typeName") 30 private final String mTypeName; 31 32 @NonNull 33 @ColumnInfo(name = "autofillTypes") 34 private final IntList mAutofillTypes; 35 36 @NonNull 37 @ColumnInfo(name = "saveInfo") 38 private final Integer mSaveInfo; 39 40 @NonNull 41 @ColumnInfo(name = "partition") 42 private final Integer mPartition; 43 44 @NonNull 45 @Embedded 46 private final FakeData mFakeData; 47 FieldType(@onNull String typeName, @NonNull IntList autofillTypes, @NonNull Integer saveInfo, @NonNull Integer partition, @NonNull FakeData fakeData)48 public FieldType(@NonNull String typeName, @NonNull IntList autofillTypes, 49 @NonNull Integer saveInfo, @NonNull Integer partition, @NonNull FakeData fakeData) { 50 mTypeName = typeName; 51 mAutofillTypes = autofillTypes; 52 mSaveInfo = saveInfo; 53 mPartition = partition; 54 mFakeData = fakeData; 55 } 56 57 @NonNull getTypeName()58 public String getTypeName() { 59 return mTypeName; 60 } 61 62 @NonNull getAutofillTypes()63 public IntList getAutofillTypes() { 64 return mAutofillTypes; 65 } 66 67 @NonNull getSaveInfo()68 public Integer getSaveInfo() { 69 return mSaveInfo; 70 } 71 72 @NonNull getPartition()73 public Integer getPartition() { 74 return mPartition; 75 } 76 77 @NonNull getFakeData()78 public FakeData getFakeData() { 79 return mFakeData; 80 } 81 }