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

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      String notifyWin(Double minBidToWin) Notify that the bid for this ad was won.
      String notifyLoss(Integer lossReason, Double auctionPrice) Notify that the bid for this ad was lost.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 auction
        auctionPrice - The price of the winning bid in the auction
        Returns:

        An error message string if the notification failed, null if successful