1 /* 2 * Copyright (C) 2021 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 /** 20 * A {@link Query} for a nullable type. 21 * 22 * 23 * @param <E> Type of query 24 * @param <F> Type of object being queried 25 */ 26 public interface NullableQuery<E, F> extends Query<F> { 27 /** Require the {@link F} is equal to {@code string}. */ isEqualTo(F value)28 E isEqualTo(F value); 29 30 /** Require the {@link F} is not equal to {@code string}. */ isNotEqualTo(F value)31 E isNotEqualTo(F value); 32 33 /** Require the {@link F} is null. */ isNull()34 default E isNull() { 35 return isEqualTo(null); 36 } 37 38 /** Require the {@link F} is not null. */ isNotNull()39 default E isNotNull() { 40 return isNotEqualTo(null); 41 } 42 } 43