Interface CurrentTariff

  • All Superinterfaces:
    Cloneable, DiameterAvp, GroupedAvp

    public interface CurrentTariff
    extends GroupedAvp
    Defines an interface representing the Current-Tariff grouped AVP type. From the Diameter Rf Reference Point Protocol Details (3GPP TS 32.299 V10.0.0) specification:
     7.2.47  Current-Tariff AVP
     
     The Current-Tariff AVP (AVP code 2056) is of type Grouped and holds tariff information. 
     The Tariff is a formula for cost calculation given the Used-Service-Unit AVP. 
     The calculated cost is given in the Currency-Code AVP. The formula sums all the rating elements and 
     multiplies the sum by the Scale-Factor AVP. 
     It has the following ABNF grammar:
     
         Current-Tariff ::=  < AVP Header: 2056 >
                             [ Currency-Code ]
                             [ Scale-Factor ]
                            *[ Rate-Element ]
     
    Note:
    The support for extension AVPs is present even thou the ABNF grammar for this AVP does not contain the "* [ AVP ]" line. Be aware that adding any extension AVPs may result in interoperability problems with products that strongly validate the incoming diameter message for it's adherence to the specification.
    • Method Detail

      • hasCurrencyCode

        boolean hasCurrencyCode()
        Returns true if the Currency-Code AVP is present in the Current-Tariff AVP.
      • getCurrencyCode

        long getCurrencyCode()
        Returns the value of the Currency-Code AVP, of type Unsigned32. Use hasCurrencyCode() to check the existence of this AVP.
        Returns:
        the value of the Currency-Code AVP
        Throws:
        IllegalStateException - if the Currency-Code AVP has not been set.
      • setCurrencyCode

        void setCurrencyCode​(long currencyCode)
        Sets the value of the Currency-Code AVP, of type Unsigned32.
      • removeCurrencyCode

        void removeCurrencyCode()
        Removes the Currency-Code AVP from the Current-Tariff AVP. If the Currency-Code AVP is not present, this method returns silently.
      • hasScaleFactor

        boolean hasScaleFactor()
        Returns true if the Scale-Factor AVP is present in the Current-Tariff AVP.
      • getScaleFactor

        ScaleFactor getScaleFactor()
        Returns the value of the Scale-Factor AVP, of type Grouped.
        Returns:
        the value of the Scale-Factor AVP, or null if it has not been set.
      • setScaleFactor

        void setScaleFactor​(ScaleFactor scaleFactor)
        Sets the value of the Scale-Factor AVP, of type Grouped.
        Throws:
        NullPointerException - if scaleFactor is null.
      • removeScaleFactor

        void removeScaleFactor()
        Removes the Scale-Factor AVP from the Current-Tariff AVP. If the Scale-Factor AVP is not present, this method returns silently.
      • getRateElements

        RateElement[] getRateElements()
        Returns the set of Rate-Element AVPs. The returned array contains the AVPs in the order they appear in the Current-Tariff AVP. A return value of null implies that no Rate-Element AVPs have been set. The elements in the given array are RateElement objects.
      • setRateElement

        void setRateElement​(RateElement rateElement)
        Sets a single Rate-Element AVP in the Current-Tariff AVP, of type Grouped.
        Throws:
        NullPointerException - if rateElement is null.
      • setRateElements

        void setRateElements​(RateElement[] rateElements)
        Sets the set of Rate-Element AVPs, with all the values in the given array. The AVPs will be added to the Current-Tariff AVP in the order in which they appear in the array. Note: the array must not be altered by the caller following this call, and getRateElements() is not guaranteed to return the same array instance, e.g. an "==" check would fail.
        Throws:
        NullPointerException - if rateElements is null.
      • removeRateElements

        void removeRateElements()
        Removes all Rate-Element AVPs from the Current-Tariff AVP. If no Rate-Element AVPs are present, this method returns silently.
      • getExtensionAvps

        DiameterAvp[] getExtensionAvps()
        Returns the set of extension AVPs. The returned array contains the extension AVPs in the order they appear in the Current-Tariff AVP. A return value of null implies that no extensions AVPs have been set.
      • setExtensionAvps

        void setExtensionAvps​(DiameterAvp[] avps)
                       throws AvpNotAllowedException
        Sets the set of extension AVPs with all the values in the given array. The AVPs will be added to Current-Tariff AVP in the order in which they appear in the array. Note: the array must not be altered by the caller following this call, and getExtensionAvps() is not guaranteed to return the same array instance, e.g. an "==" check would fail.
        Throws:
        AvpNotAllowedException - if an AVP is encountered of a type already known to this class (i.e. an AVP for which get/set methods already appear in this class)
        NullPointerException - if avps is null.
      • removeExtensionAvps

        void removeExtensionAvps()
        Removes all extension AVPs from the Current-Tariff AVP. If no extension AVPs are present, this method returns silently.