KeyedFrequencyCap.Builder

public static final class KeyedFrequencyCap.Builder
extends Object

java.lang.Object
   ↳ android.adservices.common.KeyedFrequencyCap.Builder


Builder for creating KeyedFrequencyCap objects.

Summary

Public constructors

Builder()

Public methods

KeyedFrequencyCap build()

Builds and returns a KeyedFrequencyCap instance.

KeyedFrequencyCap.Builder setAdCounterKey(String adCounterKey)

Sets the ad counter key the frequency cap applies to.

KeyedFrequencyCap.Builder setInterval(Duration interval)

Sets the interval, as a Duration which will be truncated to the nearest second, over which the frequency cap is calculated.

KeyedFrequencyCap.Builder setMaxCount(int maxCount)

Sets the maximum count within the time interval for the frequency cap.

Inherited methods

Public constructors

Public methods

build

public KeyedFrequencyCap build ()

Builds and returns a KeyedFrequencyCap instance.

Returns
KeyedFrequencyCap This value cannot be null.

Throws
NullPointerException if the ad counter key or interval are null
IllegalArgumentException if the ad counter key, max count, or interval are invalid

setAdCounterKey

public KeyedFrequencyCap.Builder setAdCounterKey (String adCounterKey)

Sets the ad counter key the frequency cap applies to.

See KeyedFrequencyCap.getAdCounterKey() for more information.

Parameters
adCounterKey String: This value cannot be null.

Returns
KeyedFrequencyCap.Builder This value cannot be null.

setInterval

public KeyedFrequencyCap.Builder setInterval (Duration interval)

Sets the interval, as a Duration which will be truncated to the nearest second, over which the frequency cap is calculated.

See KeyedFrequencyCap.getInterval() for more information.

Parameters
interval Duration: This value cannot be null.

Returns
KeyedFrequencyCap.Builder This value cannot be null.

setMaxCount

public KeyedFrequencyCap.Builder setMaxCount (int maxCount)

Sets the maximum count within the time interval for the frequency cap.

See KeyedFrequencyCap.getMaxCount() for more information.

Parameters
maxCount int

Returns
KeyedFrequencyCap.Builder This value cannot be null.