com.ibm.diameter.charging.util
Class CostInformation

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

public class CostInformation
extends java.lang.Object

CostInformation is a lightweight representation of the Grouped [Cost-Information] Avp.

The [Cost-Information] Avp is defined in RFC 4006 - Diameter Credit-Control Application.


Constructor Summary
CostInformation()
          Constructs an empty CostInformation object representing the [Cost-Information] Avp.
CostInformation(java.util.List<Avp> avps)
          Constructs an CostInformation object representing the Grouped [Cost-Information] Avp.
 
Method Summary
 java.lang.String getCostUnit()
          Gets the value corresponding to the payload of the [Cost-Unit] Avp.
 java.lang.Integer getCurrencyCode()
          Gets the value corresponding to the payload of the {Currency-Code} Avp.
 UnitValue getUnitValue()
          Gets the value corresponding to the payload of the {Unit-Value} Avp.
 void setCostUnit(java.lang.String costUnit)
          Sets the value corresponding to the payload of the [Cost-Unit] Avp.
 void setCurrencyCode(java.lang.Integer currencyCode)
          Sets the value corresponding to the payload of the {Currency-Code} Avp.
 void setUnitValue(UnitValue unitValue)
          Sets the value corresponding to the payload of the {Unit-Value} Avp.
 Avp toAvp()
          Transforms an CostInformation object into a Grouped [Cost-Information] Avp.
 void validate()
          Validates the members of the CostInformation object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CostInformation

public CostInformation()
Constructs an empty CostInformation object representing the [Cost-Information] Avp.


CostInformation

public CostInformation(java.util.List<Avp> avps)
                throws AvpTransformationException
Constructs an CostInformation object representing the Grouped [Cost-Information] Avp.

The method takes a List of Avps as an input. If an Avp code inside the list corresponds to a member of CostInformation, 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 [Cost-Information] Avp.
Throws:
AvpTransformationException - if the Avp value is in an unexpected format.
Method Detail

getCostUnit

public java.lang.String getCostUnit()
Gets the value corresponding to the payload of the [Cost-Unit] Avp.

Returns:
the value corresponding to the payload of the [Cost-Unit] Avp.

setCostUnit

public void setCostUnit(java.lang.String costUnit)
Sets the value corresponding to the payload of the [Cost-Unit] Avp.

Parameters:
costUnit - the value corresponding to the payload of the [Cost-Unit] Avp.

getCurrencyCode

public java.lang.Integer getCurrencyCode()
Gets the value corresponding to the payload of the {Currency-Code} Avp.

Returns:
the value corresponding to the payload of the {Currency-Code} Avp.

setCurrencyCode

public void setCurrencyCode(java.lang.Integer currencyCode)
Sets the value corresponding to the payload of the {Currency-Code} Avp.

Parameters:
currencyCode - the value corresponding to the payload of the {Currency-Code} Avp.

getUnitValue

public UnitValue getUnitValue()
Gets the value corresponding to the payload of the {Unit-Value} Avp.

Returns:
the value corresponding to the payload of the {Unit-Value} Avp.

setUnitValue

public void setUnitValue(UnitValue unitValue)
Sets the value corresponding to the payload of the {Unit-Value} Avp.

Parameters:
unitValue - the value corresponding to the payload of the {Unit-Value} Avp.

validate

public void validate()
              throws ChargingValidationException
Validates the members of the CostInformation 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 CostInformation is in an unexpected format.

toAvp

public Avp toAvp()
          throws AvpTransformationException
Transforms an CostInformation object into a Grouped [Cost-Information] Avp.

All non-null members of CostInformation will be transformed into Avps nested inside of the [Cost-Information] Avp.

Returns:
the [Cost-Information] Avp.
Throws:
AvpTransformationException - if a member of CostInformation is in an unexpected format.


Copyright © 2006 IBM Corp. All Rights Reserved.