Class WinLossBeaconHandler
-
- All Implemented Interfaces:
-
com.inmobi.ads.core.WinLossNotifier
public final class WinLossBeaconHandler implements WinLossNotifier
Concrete implementation of WinLossNotifier that handles Win/Loss beacon firing.
This class follows SOLID principles:
Single Responsibility: Only handles Win/Loss beacon firing logic
Open/Closed: Open for extension through interface, closed for modification
Liskov Substitution: Can be substituted anywhere WinLossNotifier is expected
Interface Segregation: Implements focused WinLossNotifier interface
Dependency Inversion: Depends on Ad abstraction, not concrete implementations
-
-
Constructor Summary
Constructors Constructor Description WinLossBeaconHandler(Ad ad, InMobiLogger logger, String tag)
-
Method Summary
-
-
Constructor Detail
-
WinLossBeaconHandler
WinLossBeaconHandler(Ad ad, InMobiLogger logger, String tag)
-
-
Method Detail
-
notifyWin
String notifyWin(Double minBidToWin)
Notify that the bid for this ad was won.
This method:
Ensures it's called only once via atomic flag
Retrieves WIN_BEACON trackers from the ad
Replaces auction macros with actual values
Fires beacons via ClickManager
Validates parameters
- Parameters:
minBidToWin- The minimum bid amount required to win the auction- Returns:
An error message string if the notification failed, null if successful
-
notifyLoss
String notifyLoss(Integer lossReason, Double auctionPrice)
Notify that the bid for this ad was lost.
This method:
Ensures it's called only once via atomic flag
Retrieves LOSS_BEACON trackers from the ad
Replaces auction macros with actual values
Fires beacons via ClickManager
Validates parameters
- Parameters:
lossReason- The reason code for losing the auctionauctionPrice- The price of the winning bid in the auction- Returns:
An error message string if the notification failed, null if successful
-
-
-
-