1 /* 2 * Copyright 2019 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 androidx.camera.core.impl; 18 19 import org.jspecify.annotations.NonNull; 20 import org.jspecify.annotations.Nullable; 21 22 /** 23 * MutableConfig is a {@link Config} that can be modified. 24 * 25 * <p>MutableConfig is the interface used to create immutable Config objects. 26 */ 27 public interface MutableConfig extends Config { 28 29 /** 30 * Inserts a Option/Value pair into the configuration 31 * 32 * @param opt The option to be added or modified 33 * @param value The value to insert for this option. 34 * @param <ValueT> The type of the value being inserted. 35 */ insertOption(@onNull Option<ValueT> opt, @Nullable ValueT value)36 <ValueT> void insertOption(@NonNull Option<ValueT> opt, @Nullable ValueT value); 37 38 /** 39 * Inserts a Option/Value pair into the configuration by the rules of {@link OptionPriority}. 40 * 41 * @param opt The option to be added or modified 42 * @param value The value to insert for this option. 43 * @param <ValueT> The type of the value being inserted. 44 * @throws IllegalArgumentException if there is a conflict that cannot be resolved. 45 */ insertOption(@onNull Option<ValueT> opt, @NonNull OptionPriority priority, @Nullable ValueT value)46 <ValueT> void insertOption(@NonNull Option<ValueT> opt, @NonNull OptionPriority priority, 47 @Nullable ValueT value); 48 49 /** 50 * Removes an option from the configuration if it exists. 51 * 52 * @param opt The option to remove from the configuration. 53 * @param <ValueT> The type of the value being removed. 54 * @return The value that previously existed for <code>opt</code>, or <code>null</code> if the 55 * option did not exist in this configuration. 56 */ removeOption(@onNull Option<ValueT> opt)57 <ValueT> @Nullable ValueT removeOption(@NonNull Option<ValueT> opt); 58 } 59