-
- All Implemented Interfaces:
-
com.appsflyer.internal.referrer.OptionalReferrersProvider
public final class OptionalReferrersProviderImpl implements OptionalReferrersProvider
Function-based implementation of external referrer provider.
<p>This implementation uses direct function calls to instantiate external referrer instances that have been registered through the automatic registration system. It completely eliminates reflection for maximum performance and type safety.</p><p><strong>Key Improvements over Previous Implementation:</strong></p> <ul> <li>Eliminated reflection completely - uses direct method references</li> <li>Removed compile-time dependencies on external referrer modules</li> <li>Eliminated manual OptionalFeaturesValidator checks</li> <li>Simplified constructor - no longer requires multiple injected dependencies</li> <li>Compile-time type safety with method references (e.g., {@code HuaweiReferrer::new})</li> </ul><p><strong>Registration Process:</strong></p> <ol> <li>External referrer modules register via {@link BaseReferrerInitProvider}</li> <li>Function references are stored in {@link Referrer#getExternalReferrers()}</li> <li>This provider calls {@code creator.create(prop)} for direct instantiation</li> <li>No reflection, constructor lookup, or runtime type discovery required</li> </ol><p><strong>Performance Characteristics:</strong></p> <ul> <li>Zero reflection overhead - direct method calls only</li> <li>Compile-time optimization - method references can be inlined</li> <li>Error resilience: Individual referrer failures don't affect others</li> <li>Memory impact: Minimal - only function references stored</li> </ul><p><strong>Thread Safety:</strong><br> This class is thread-safe. The underlying referrer registry is thread-safe, and function calls are performed on immutable function references.</p>
-
-
Constructor Summary
Constructors Constructor Description OptionalReferrersProviderImpl()
-
Method Summary
Modifier and Type Method Description List<Referrer>getOptionalReferrers(ReferrerPropĀ prop)Creates instances of all registered external referrers using direct function calls. -
-
Method Detail
-
getOptionalReferrers
List<Referrer> getOptionalReferrers(ReferrerPropĀ prop)
Creates instances of all registered external referrers using direct function calls.
<p>This method retrieves all registered external referrer creator functions and calls them directly to instantiate referrer instances. No reflection is used, ensuring maximum performance and compile-time type safety.</p><p><strong>Instantiation Process:</strong></p> <ol> <li>Retrieve registered creator functions from {@link Referrer#getExternalReferrers()}</li> <li>Call {@code creator.create(prop)} for each registered function</li> <li>Return list of created referrer instances</li> <li>All operations are direct method calls - no reflection involved</li> </ol><p><strong>Error Handling:</strong><br> The current implementation assumes creator functions are well-behaved and don't throw exceptions. If needed, error handling can be added to catch creation failures and continue with other referrers.</p>- Parameters:
prop- Properties container with dependencies for referrer instantiation
-
-
-
-