Interface UnitValue
-
- All Superinterfaces:
Cloneable
,DiameterAvp
,GroupedAvp
public interface UnitValue extends GroupedAvp
Defines an interface representing the Unit-Value grouped AVP type. From the Diameter Credit-Control Application (rfc4006.txt) specification:8.8. Unit-Value AVP Unit-Value AVP is of type Grouped (AVP Code 445) and specifies the units as decimal value. The Unit-Value is a value with an exponent; i.e., Unit-Value = Value-Digits AVP * 10^Exponent. This representation avoids unwanted rounding off. For example, the value of 2,3 is represented as Value-Digits = 23 and Exponent = -1. The absence of the exponent part MUST be interpreted as an exponent equal to zero. It is defined as follows (per the grouped-avp-def of RFC 3588 [DIAMBASE]): Unit-Value ::= < AVP Header: 445 > { Value-Digits } [ Exponent ]
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 int
getExponent()
Returns the value of the Exponent AVP, of type Integer32.DiameterAvp[]
getExtensionAvps()
Returns the set of extension AVPs.long
getValueDigits()
Returns the value of the Value-Digits AVP, of type Integer64.boolean
hasExponent()
Returns true if the Exponent AVP is present in the Unit-Value AVP.boolean
hasValueDigits()
Returns true if the Value-Digits AVP is present in the Unit-Value AVP.void
removeExponent()
Removes the Exponent AVP from the Unit-Value AVP.void
removeExtensionAvps()
Removes all extension AVPs from the Unit-Value AVP.void
removeValueDigits()
Removes the Value-Digits AVP from the Unit-Value AVP.void
setExponent(int exponent)
Sets the value of the Exponent AVP, of type Integer32.void
setExtensionAvps(DiameterAvp[] avps)
Sets the set of extension AVPs with all the values in the given array.void
setValueDigits(long valueDigits)
Sets the value of the Value-Digits AVP, of type Integer64.-
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
-
hasValueDigits
boolean hasValueDigits()
Returns true if the Value-Digits AVP is present in the Unit-Value AVP.
-
getValueDigits
long getValueDigits()
Returns the value of the Value-Digits AVP, of type Integer64. UsehasValueDigits()
to check the existence of this AVP.- Returns:
- the value of the Value-Digits AVP
- Throws:
IllegalStateException
- if the Value-Digits AVP has not been set.
-
setValueDigits
void setValueDigits(long valueDigits)
Sets the value of the Value-Digits AVP, of type Integer64.
-
removeValueDigits
void removeValueDigits()
Removes the Value-Digits AVP from the Unit-Value AVP. If the Value-Digits AVP is not present, this method returns silently.
-
hasExponent
boolean hasExponent()
Returns true if the Exponent AVP is present in the Unit-Value AVP.
-
getExponent
int getExponent()
Returns the value of the Exponent AVP, of type Integer32. UsehasExponent()
to check the existence of this AVP.- Returns:
- the value of the Exponent AVP
- Throws:
IllegalStateException
- if the Exponent AVP has not been set.
-
setExponent
void setExponent(int exponent)
Sets the value of the Exponent AVP, of type Integer32.
-
removeExponent
void removeExponent()
Removes the Exponent AVP from the Unit-Value AVP. If the Exponent 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 Unit-Value 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 Unit-Value 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 Unit-Value AVP. If no extension AVPs are present, this method returns silently.
-
-