Interface NextTariff
-
- All Superinterfaces:
Cloneable
,DiameterAvp
,GroupedAvp
public interface NextTariff extends GroupedAvp
Defines an interface representing the Next-Tariff grouped AVP type. From the Diameter Rf Reference Point Protocol Details (3GPP TS 32.299 V12.11.0) specification:7.2.112 Next-Tariff AVP The Next-Tariff AVP (AVP code 2057) 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: Next-Tariff ::= < AVP Header: 2057 > [ 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.
-
-
Field Summary
-
Fields inherited from interface org.jainslee.resources.diameter.base.DiameterAvp
FLAG_RULE_MAY, FLAG_RULE_MUST, FLAG_RULE_MUSTNOT
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
getCurrencyCode()
Returns the value of the Currency-Code AVP, of type Unsigned32.DiameterAvp[]
getExtensionAvps()
Returns the set of extension AVPs.RateElement[]
getRateElements()
Returns the set of Rate-Element AVPs.ScaleFactor
getScaleFactor()
Returns the value of the Scale-Factor AVP, of type Grouped.boolean
hasCurrencyCode()
Returns true if the Currency-Code AVP is present in the Next-Tariff AVP.boolean
hasScaleFactor()
Returns true if the Scale-Factor AVP is present in the Next-Tariff AVP.void
removeCurrencyCode()
Removes the Currency-Code AVP from the Next-Tariff AVP.void
removeExtensionAvps()
Removes all extension AVPs from the Next-Tariff AVP.void
removeRateElements()
Removes all Rate-Element AVPs from the Next-Tariff AVP.void
removeScaleFactor()
Removes the Scale-Factor AVP from the Next-Tariff AVP.void
setCurrencyCode(long currencyCode)
Sets the value of the Currency-Code AVP, of type Unsigned32.void
setExtensionAvps(DiameterAvp[] avps)
Sets the set of extension AVPs with all the values in the given array.void
setRateElement(RateElement rateElement)
Sets a single Rate-Element AVP in the Next-Tariff AVP, of type Grouped.void
setRateElements(RateElement[] rateElements)
Sets the set of Rate-Element AVPs, with all the values in the given array.void
setScaleFactor(ScaleFactor scaleFactor)
Sets the value of the Scale-Factor AVP, of type Grouped.-
Methods inherited from interface org.jainslee.resources.diameter.base.DiameterAvp
byteArrayValue, clone, doubleValue, floatValue, getCode, getMandatoryRule, getName, getProtectedRule, getType, getVendorID, groupedAvpValue, intValue, longValue, stringValue
-
-
-
-
Method Detail
-
hasCurrencyCode
boolean hasCurrencyCode()
Returns true if the Currency-Code AVP is present in the Next-Tariff AVP.
-
getCurrencyCode
long getCurrencyCode()
Returns the value of the Currency-Code AVP, of type Unsigned32. UsehasCurrencyCode()
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 Next-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 Next-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
- ifscaleFactor
isnull
.
-
removeScaleFactor
void removeScaleFactor()
Removes the Scale-Factor AVP from the Next-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 Next-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 Next-Tariff AVP, of type Grouped.- Throws:
NullPointerException
- ifrateElement
isnull
.
-
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 Next-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
- ifrateElements
isnull
.
-
removeRateElements
void removeRateElements()
Removes all Rate-Element AVPs from the Next-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 Next-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 Next-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
- ifavps
isnull
.
-
removeExtensionAvps
void removeExtensionAvps()
Removes all extension AVPs from the Next-Tariff AVP. If no extension AVPs are present, this method returns silently.
-
-