CaptureRequestOptions

@ExperimentalCamera2Interop
@RequiresApi(value = 21)
class CaptureRequestOptions


A bundle of Camera2 capture request options.

Summary

Nested types

Builder for creating CaptureRequestOptions instance.

Public functions

Boolean

Returns whether this configuration contains the supplied option.

Unit
findOptions(idSearchString: String, matcher: Config.OptionMatcher)

Search the configuration for Options whose id match the supplied search string.

ValueT?

Returns a value for the given CaptureRequest.Key or null if it hasn't been set.

Config.OptionPriority

Returns the current priority of the value for the specified option.

(Mutable)Set<Config.OptionPriority!>

Returns a Set of all priorities set for the specified option.

java-static Boolean
hasConflict(
    priority1: Config.OptionPriority,
    priority2: Config.OptionPriority
)

Returns if values with these OptionPriority conflict or not.

(Mutable)Set<Config.Option<Any!>!>

Lists all options contained within this configuration.

java-static Config
mergeConfigs(extendedConfig: Config?, baseConfig: Config?)

Merges two configs.

java-static Unit
mergeOptionValue(
    mergedConfig: MutableOptionsBundle,
    baseConfig: Config,
    extendedConfig: Config,
    opt: Config.Option<Any!>
)

Merges a specific option value from two configs.

ValueT?
<ValueT> retrieveOption(id: Config.Option<ValueT!>)

Retrieves the value for the specified option if it exists in the configuration.

abstract ValueT?
<ValueT> retrieveOption(id: Config.Option<ValueT!>, valueIfMissing: ValueT?)

Retrieves the value for the specified option if it exists in the configuration.

ValueT?
<ValueT> retrieveOption(id: Config.Option<ValueT!>, valueIfMissing: ValueT?)

Retrieves the value for the specified option if it exists in the configuration.

ValueT?
<ValueT> retrieveOptionWithPriority(
    id: Config.Option<ValueT!>,
    priority: Config.OptionPriority
)

Retrieves the value for the specified option and specified priority if it exists in the configuration.

Public functions

containsOption

fun containsOption(id: Config.Option<Any!>): Boolean

Returns whether this configuration contains the supplied option.

Parameters
id: Config.Option<Any!>

The Option to search for in this configuration.

Returns
Boolean

true if this configuration contains the supplied option; false otherwise.

findOptions

fun findOptions(idSearchString: String, matcher: Config.OptionMatcher): Unit

Search the configuration for Options whose id match the supplied search string.

Parameters
idSearchString: String

The id string to search for. This could be a fully qualified id such as \"camerax.core.example.option\" or the stem for an option such as \"camerax.core.example\".

matcher: Config.OptionMatcher

A callback used to receive results of the search. Results will be sent to onOptionMatched in the order in which they are found inside this configuration. Subsequent results will continue to be sent as long as onOptionMatched returns true.

getCaptureRequestOption

Added in 1.0.0
fun <ValueT> getCaptureRequestOption(key: CaptureRequest.Key<ValueT!>): ValueT?

Returns a value for the given CaptureRequest.Key or null if it hasn't been set.

Parameters
<ValueT>

The type of the value.

key: CaptureRequest.Key<ValueT!>

The key to retrieve.

Returns
ValueT?

The stored value or null if the value does not exist in this configuration.

getOptionPriority

fun getOptionPriority(opt: Config.Option<Any!>): Config.OptionPriority

Returns the current priority of the value for the specified option.

If there are multiple values of various priorities for the specified options, the highest priority will be returned. If the option does not exist, an IllegalArgumentException will be thrown.

getPriorities

fun getPriorities(option: Config.Option<Any!>): (Mutable)Set<Config.OptionPriority!>

Returns a Set of all priorities set for the specified option.

hasConflict

java-static fun hasConflict(
    priority1: Config.OptionPriority,
    priority2: Config.OptionPriority
): Boolean

Returns if values with these OptionPriority conflict or not.

Currently it is not allowed the same option to have different values with priority REQUIRED.

listOptions

fun listOptions(): (Mutable)Set<Config.Option<Any!>!>

Lists all options contained within this configuration.

Returns
(Mutable)Set<Config.Option<Any!>!>

A Set of Options contained within this configuration.

mergeConfigs

java-static fun mergeConfigs(extendedConfig: Config?, baseConfig: Config?): Config

Merges two configs.

Parameters
extendedConfig: Config?

the extended config. The options in the extendedConfig will be applied on top of the baseConfig based on the option priorities.

baseConfig: Config?

the base config.

Returns
Config

a MutableOptionsBundle of the merged config.

mergeOptionValue

java-static fun mergeOptionValue(
    mergedConfig: MutableOptionsBundle,
    baseConfig: Config,
    extendedConfig: Config,
    opt: Config.Option<Any!>
): Unit

Merges a specific option value from two configs.

Parameters
mergedConfig: MutableOptionsBundle

the final output config.

baseConfig: Config

the base config contains the option value which might be overridden by the corresponding option value in the extend config.

extendedConfig: Config

the extended config contains the option value which might override the corresponding option value in the base config.

opt: Config.Option<Any!>

the option to merge.

retrieveOption

fun <ValueT> retrieveOption(id: Config.Option<ValueT!>): ValueT?

Retrieves the value for the specified option if it exists in the configuration.

If the option does not exist, an exception will be thrown. If there are multiple values being set with multiple OptionPriority, it will return the value of highest priority.

Parameters
<ValueT>

The type for the value associated with the supplied Option.

id: Config.Option<ValueT!>

The Option to search for in this configuration.

Returns
ValueT?

The value stored in this configuration.

Throws
java.lang.IllegalArgumentException

if the given option does not exist in this configuration.

retrieveOption

abstract fun <ValueT> retrieveOption(id: Config.Option<ValueT!>, valueIfMissing: ValueT?): ValueT?

Retrieves the value for the specified option if it exists in the configuration.

If the option does not exist, valueIfMissing will be returned. If there are multiple values being set with multiple OptionPriority, it will return the value of highest priority.

Parameters
<ValueT>

The type for the value associated with the supplied Option.

id: Config.Option<ValueT!>

The Option to search for in this configuration.

valueIfMissing: ValueT?

The value to return if the specified Option does not exist in this configuration.

Returns
ValueT?

The value stored in this configuration, or valueIfMissing if it does not exist.

retrieveOption

fun <ValueT> retrieveOption(id: Config.Option<ValueT!>, valueIfMissing: ValueT?): ValueT?

Retrieves the value for the specified option if it exists in the configuration.

If the option does not exist, valueIfMissing will be returned. If there are multiple values being set with multiple OptionPriority, it will return the value of highest priority.

Parameters
<ValueT>

The type for the value associated with the supplied Option.

id: Config.Option<ValueT!>

The Option to search for in this configuration.

valueIfMissing: ValueT?

The value to return if the specified Option does not exist in this configuration.

Returns
ValueT?

The value stored in this configuration, or valueIfMissing if it does not exist.

retrieveOptionWithPriority

fun <ValueT> retrieveOptionWithPriority(
    id: Config.Option<ValueT!>,
    priority: Config.OptionPriority
): ValueT?

Retrieves the value for the specified option and specified priority if it exists in the configuration.

If the option does not exist, an exception will be thrown.

Parameters
<ValueT>

The type for the value associated with the supplied Option.

id: Config.Option<ValueT!>

The Option to search for in this configuration.

Throws
java.lang.IllegalArgumentException

if the given option with specified priority does not exist in this configuration.