com.ibm.diameter.charging.util
Class UnitValue

java.lang.Object
  extended by com.ibm.diameter.charging.util.UnitValue

public class UnitValue
extends java.lang.Object

UnitValue is a lightweight representation of the Grouped [Unit-Value] Avp. It specifies the number of units as a decimal value with an exponent.

The [Unit-Value] Avp is defined in RFC 4006 - Diameter Credit-Control Application.


Constructor Summary
UnitValue()
          Constructs an empty UnitValue object representing the [Unit-Value] Avp.
UnitValue(java.util.List<Avp> avps)
          Constructs a UnitValue object representing the Grouped [Unit-Value] Avp.
 
Method Summary
 java.lang.Integer getExponent()
          Gets the value corresponding to the payload of the [Exponent] Avp.
 java.lang.Long getValueDigits()
          Gets the value corresponding to the payload of the [Value-Digits] Avp.
 void setExponent(java.lang.Integer exponent)
          Sets the value corresponding to the payload of the [Exponent] Avp.
 void setValueDigits(java.lang.Long valueDigits)
          Sets the value corresponding to the payload of the [Value-Digitse] Avp.
 Avp toAvp()
          Transforms a UnitValue object into a Grouped [Unit-Value] Avp.
 void validate()
          Validates the members of the UnitValue object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnitValue

public UnitValue()
Constructs an empty UnitValue object representing the [Unit-Value] Avp.


UnitValue

public UnitValue(java.util.List<Avp> avps)
          throws AvpTransformationException
Constructs a UnitValue object representing the Grouped [Unit-Value] Avp.

The method takes a List of Avps as an input. If an Avp code inside the list corresponds to a member of UnitValue, the member will be populated with the Avp value during construction. If an Avp code is unknown, the value will be silently discarded.

Parameters:
avps - a list of Avps that can appear in the Grouped [Unit-Value] Avp.
Throws:
AvpTransformationException - if the Avp value is in an unexpected format.
Method Detail

getExponent

public java.lang.Integer getExponent()
Gets the value corresponding to the payload of the [Exponent] Avp.

Returns:
the value corresponding to the payload of the [Exponent] Avp.

setExponent

public void setExponent(java.lang.Integer exponent)
Sets the value corresponding to the payload of the [Exponent] Avp.

Parameters:
exponent - the value corresponding to the payload of the [Exponent] Avp.

getValueDigits

public java.lang.Long getValueDigits()
Gets the value corresponding to the payload of the [Value-Digits] Avp.

Returns:
the value corresponding to the payload of the [Value-Digits] Avp.

setValueDigits

public void setValueDigits(java.lang.Long valueDigits)
Sets the value corresponding to the payload of the [Value-Digitse] Avp.

Parameters:
valueDigits - the value corresponding to the payload of the [Value-Digits] Avp.

validate

public void validate()
              throws ChargingValidationException
Validates the members of the UnitValue object. The charging Web Services call this method before transforming the object into a Grouped Avp. This ensures that improperly formed Avps are not sent to the Diameter peer.

Throws:
ChargingValidationException - if a member of UnitValue is in an unexpected format.

toAvp

public Avp toAvp()
          throws AvpTransformationException
Transforms a UnitValue object into a Grouped [Unit-Value] Avp.

All non-null members of UnitValue will be transformed into Avps nested inside of the [Unit-Value] Avp.

Returns:
the [Unit-Value] Avp.
Throws:
AvpTransformationException - if a member of UnitValue is in an unexpected format.


Copyright © 2006 IBM Corp. All Rights Reserved.