1 /* 2 * Copyright (C) 2023 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.adservices.service.measurement; 18 19 import com.google.auto.value.AutoOneOf; 20 21 import java.util.List; 22 23 /** POJO for filter value. */ 24 @AutoOneOf(FilterValue.Kind.class) 25 public abstract class FilterValue { 26 27 public enum Kind { 28 STRING_LIST_VALUE, 29 LONG_VALUE 30 } 31 32 /** Returns the type of the filter value. */ kind()33 public abstract Kind kind(); 34 35 /** Returns the string list value. */ stringListValue()36 public abstract List<String> stringListValue(); 37 38 /** Returns the long value. */ longValue()39 public abstract long longValue(); 40 41 /** Returns an instance for a string list value. */ ofStringList(List<String> stringList)42 public static FilterValue ofStringList(List<String> stringList) { 43 return AutoOneOf_FilterValue.stringListValue(stringList); 44 } 45 46 /** Returns an instance for a long value. */ ofLong(long longValue)47 public static FilterValue ofLong(long longValue) { 48 return AutoOneOf_FilterValue.longValue(longValue); 49 } 50 } 51