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(int adCounterKey, int maxCount, Duration interval)

Public methods

KeyedFrequencyCap build()

Builds and returns a KeyedFrequencyCap instance.

KeyedFrequencyCap.Builder setAdCounterKey(int 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

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Public constructors

Builder

public Builder (int adCounterKey, 
                int maxCount, 
                Duration interval)

Parameters
adCounterKey int

maxCount int

interval Duration: This value cannot be null.

Public methods

build

public KeyedFrequencyCap build ()

Builds and returns a KeyedFrequencyCap instance.

Returns
KeyedFrequencyCap This value cannot be null.

setAdCounterKey

public KeyedFrequencyCap.Builder setAdCounterKey (int adCounterKey)

Sets the ad counter key the frequency cap applies to.

See KeyedFrequencyCap.getAdCounterKey() for more information.

Parameters
adCounterKey int

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.