Interface CostInformation

  • All Superinterfaces:
    Cloneable, DiameterAvp, GroupedAvp

    public interface CostInformation
    extends GroupedAvp
    Defines an interface representing the Cost-Information grouped AVP type. From the Diameter Credit-Control Application (rfc4006.txt) specification:
     8.7.  Cost-Information AVP
     
        The Cost-Information AVP (AVP Code 423) is of type Grouped, and it is
        used to return the cost information of a service, which the credit-
        control client can transfer transparently to the end user.  The
        included Unit-Value AVP contains the cost estimate (always type of
        money) of the service, in the case of price enquiry, or the
        accumulated cost estimation, in the case of credit-control session.
     
        The Currency-Code specifies in which currency the cost was given.
        The Cost-Unit specifies the unit when the service cost is a cost per
        unit (e.g., cost for the service is $1 per minute).
     
        When the Requested-Action AVP with value PRICE_ENQUIRY is included in
        the Credit-Control-Request command, the Cost-Information AVP sent in
        the succeeding Credit-Control-Answer command contains the cost
        estimation of the requested service, without any reservation being
        made.
     
        The Cost-Information AVP included in the Credit-Control-Answer
        command with the CC-Request-Type set to UPDATE_REQUEST contains the
        accumulated cost estimation for the session, without taking any
        credit reservation into account.
     
        The Cost-Information AVP included in the Credit-Control-Answer
        command with the CC-Request-Type set to EVENT_REQUEST or
        TERMINATION_REQUEST contains the estimated total cost for the
        requested service.
     
        It is defined as follows (per the grouped-avp-def of
        RFC 3588 [DIAMBASE]):
     
                       Cost-Information ::= < AVP Header: 423 >
                                            { Unit-Value }
                                            { Currency-Code }
                                            [ Cost-Unit ] 
     
    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

      • hasUnitValue

        boolean hasUnitValue()
        Returns true if the Unit-Value AVP is present in the Cost-Information AVP.
      • getUnitValue

        UnitValue getUnitValue()
        Returns the value of the Unit-Value AVP, of type Grouped.
        Returns:
        the value of the Unit-Value AVP, or null if it has not been set.
      • setUnitValue

        void setUnitValue​(UnitValue unitValue)
        Sets the value of the Unit-Value AVP, of type Grouped.
        Throws:
        NullPointerException - if unitValue is null.
      • removeUnitValue

        void removeUnitValue()
        Removes the Unit-Value AVP from the Cost-Information AVP. If the Unit-Value AVP is not present, this method returns silently.
      • hasCurrencyCode

        boolean hasCurrencyCode()
        Returns true if the Currency-Code AVP is present in the Cost-Information 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 Cost-Information AVP. If the Currency-Code AVP is not present, this method returns silently.
      • hasCostUnit

        boolean hasCostUnit()
        Returns true if the Cost-Unit AVP is present in the Cost-Information AVP.
      • getCostUnit

        String getCostUnit()
        Returns the value of the Cost-Unit AVP, of type UTF8String.
        Returns:
        the value of the Cost-Unit AVP, or null if it has not been set.
      • setCostUnit

        void setCostUnit​(String costUnit)
        Sets the value of the Cost-Unit AVP, of type UTF8String.
        Throws:
        NullPointerException - if costUnit is null.
      • removeCostUnit

        void removeCostUnit()
        Removes the Cost-Unit AVP from the Cost-Information AVP. If the Cost-Unit AVP is not 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 Cost-Information 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 Cost-Information 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 Cost-Information AVP. If no extension AVPs are present, this method returns silently.