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.android.dialer.spam.status; 18 19 import com.google.auto.value.AutoValue; 20 import com.google.common.base.Optional; 21 22 /** 23 * Holds information which can be used to determine a number's spam status. 24 * 25 * @see SpamStatus 26 */ 27 @AutoValue 28 public abstract class SpamMetadata { 29 30 /** Returns an empty spam metadata, no optional data is set. */ empty()31 public static SpamMetadata empty() { 32 return builder().build(); 33 } 34 builder()35 public static SpamMetadata.Builder builder() { 36 return new AutoValue_SpamMetadata.Builder(); 37 } 38 globalSpamListStatus()39 public abstract Optional<GlobalSpamListStatus> globalSpamListStatus(); 40 userSpamListStatus()41 public abstract Optional<UserSpamListStatus> userSpamListStatus(); 42 43 /** Creates instances of SpamMetadata. */ 44 @AutoValue.Builder 45 public abstract static class Builder { setGlobalSpamListStatus(GlobalSpamListStatus globalSpamListStatus)46 public abstract Builder setGlobalSpamListStatus(GlobalSpamListStatus globalSpamListStatus); 47 setUserSpamListStatus(UserSpamListStatus userSpamListStatus)48 public abstract Builder setUserSpamListStatus(UserSpamListStatus userSpamListStatus); 49 build()50 public abstract SpamMetadata build(); 51 } 52 } 53