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.queryable.queries; 18 19 import android.os.Parcelable; 20 21 import androidx.annotation.CheckResult; 22 23 import com.android.queryable.Queryable; 24 25 import java.io.Serializable; 26 27 /** Query for a single key in a metadata. */ 28 public interface MetadataKeyQuery<E extends Queryable> extends Queryable, Serializable, Parcelable { 29 30 /** Require that the key exists. */ exists()31 E exists(); 32 33 /** Require that the key does not exist. */ doesNotExist()34 E doesNotExist(); 35 36 /** 37 * The string value of the key/ 38 */ 39 @CheckResult stringValue()40 StringQuery<E> stringValue(); 41 42 /** 43 * The integer value of the key/ 44 */ 45 @CheckResult integerValue()46 IntegerQuery<E> integerValue(); 47 48 /** 49 * The long value of the key/ 50 */ 51 @CheckResult longValue()52 LongQuery<E> longValue(); 53 54 /** 55 * The boolean value of the key/ 56 */ 57 @CheckResult booleanValue()58 BooleanQuery<E> booleanValue(); 59 60 /** 61 * The resource value of the key/ 62 */ 63 @CheckResult resourceValue()64 ResourceQuery<E> resourceValue(); 65 66 } 67