Interface Payload
- All Superinterfaces:
PayloadProductType
,Serializable
- All Known Subinterfaces:
PayloadBlock
Class exposes API for populating fields and blocks inside a Payload. This class is used by
various builders when creating requests and responses. Support API for creation of iterators
that are used to traverse the Payloads blocks.
-
Method Summary
Modifier and TypeMethodDescriptionmethod to create an iterator that will do a depth first traversal of all sub-blocks below this Payload.createIterator
(String blockName) method to create an iterator that will do a depth first traversal of all sub-blocks below this PayloadBlock that match the supplied blockName.createIterator
(String blockName, String attrName) method to create an iterator that will do a depth first traversal of all sub-blocks below this PayloadBlock that match the supplied blockName and attribute name.createIterator
(String blockName, String attrName, String value) method to create an iterator that will do a depth first traversal of all sub-blocks below this PayloadBlock that match the supplied blockName. attribute name and attribute value.<T> T
getAttribute
(String name) method returns the attribute value for the provided attribute name.method returns meta data about attributes in this Payload.getAttributeInfo
(String attributeName) method returns meta data about the attribute info for the given fully qualified attribute.getSubBlock
(String name, int index) method gets the sub-block matching the supplied name and index.method returns meta data about PayloadBlocks in this Payload.getSubBlockOrDefault
(String blockName, int index) boolean
hasAttribute
(String name) setAttribute
(String name, int value) method assigns an integer value to the specified attribute in this PayloadBlock.setAttribute
(String name, long value) method assigns an String value to the specified attribute in this PayloadBlock.setAttribute
(String name, String value) method assigns an String value to the specified attribute in this PayloadBlock.setAttribute
(String name, BigDecimal value) method assigns an decimal value to the specified attribute in this PayloadBlock.setAttribute
(String name, ZonedDateTime value) method assigns a ZonedDateTime value to the specified attribute in this PayloadBlock.setAttribute
(String name, Data unit, BigDecimal amount) method assigns an Data value to the specified attribute in this PayloadBlock.setAttribute
(String name, Duration unit, BigDecimal amount) method assigns an Duration value to the specified attribute in this PayloadBlock.setAttribute
(String name, Occurrence unit, Integer amount) method assigns an Occurrence value to the specified attribute in this PayloadBlock.method will produce a detailed representation of a payloadMethods inherited from interface oracle.communication.brm.charging.config.servicespec.PayloadProductType
getProductType, setProductType
-
Method Details
-
setAttribute
method assigns an integer value to the specified attribute in this PayloadBlock. Any previously existing value will be replaced with this supplied value. Dot notation addressing is supported in the supplied name.- Parameters:
name
- the name of the attribute (eg. ABC[2].XYZ[1].TIME)value
- the integer value of the attribute- Returns:
- the modified payload to support chaining construct.
- Throws:
NoSuchElementException
- if the caller attempts to set an attribute which is unknown to the associated PayloadSpec.
-
setAttribute
method assigns an String value to the specified attribute in this PayloadBlock. Any previously existing value will be replaced with this supplied value. Dot notation addressing is supported in the supplied name.- Parameters:
name
- the name of the attribute (eg. ABC[2].XYZ[1].TIME)value
- the string value of the attribute- Returns:
- the modified payload to support chaining construct.
- Throws:
NoSuchElementException
- if the caller attempts to set an attribute which is unknown to the associated PayloadSpec.
-
setAttribute
method assigns an decimal value to the specified attribute in this PayloadBlock. Any previously existing value will be replaced with this supplied value. BigDecimal is used to represent the decimal. Dot notation addressing is supported in the supplied name.- Parameters:
name
- the name of the attribute (eg. ABC[2].XYZ[1].TIME)value
- the BigDecimal value of the attribute- Returns:
- the modified payload to support chaining construct.
- Throws:
NoSuchElementException
- if the caller attempts to set an attribute which is unknown to the associated PayloadSpec.
-
setAttribute
method assigns an String value to the specified attribute in this PayloadBlock. Any previously existing value will be replaced with this supplied value. Dot notation addressing is supported in the supplied name.- Parameters:
name
- the name of the attribute (eg. ABC[2].XYZ[1].TIME)value
- the long value of the attribute- Returns:
- the modified payload to support chaining construct.
- Throws:
NoSuchElementException
- if the caller attempts to set an attribute which is unknown to the associated PayloadSpec.
-
setAttribute
method assigns a ZonedDateTime value to the specified attribute in this PayloadBlock. Any previously existing value will be replaced with this supplied value. Dot notation addressing is supported in the supplied name.- Parameters:
name
- the name of the attribute (eg. ABC[2].XYZ[1].TIME)value
- the ZonedDateTime value to set into the payload field.- Returns:
- the modified payload to support chaining construct.
- Throws:
NoSuchElementException
- if the caller attempts to set an attribute which is unknown to the associated PayloadSpec.
-
setAttribute
method assigns an Duration value to the specified attribute in this PayloadBlock. Any previously existing value will be replaced with this supplied value. Dot notation addressing is supported in the supplied name.- Parameters:
name
- the name of the attribute (eg. ABC[2].XYZ[1].TIME)unit
- the duration unit to use.amount
- the amount of units to set, value cannot be null- Returns:
- the modified payload to support chaining construct.
- Throws:
NoSuchElementException
- if the caller attempts to set an attribute which is unknown to the associated PayloadSpec.
-
setAttribute
method assigns an Data value to the specified attribute in this PayloadBlock. Any previously existing value will be replaced with this supplied value. Dot notation addressing is supported in the supplied name.- Parameters:
name
- the name of the attribute (eg. ABC[2].XYZ[1].TIME)unit
- the data unit to be usedamount
- the amount of data, value cannot be null- Returns:
- the modified payload to support chaining construct.
- Throws:
NoSuchElementException
- if the caller attempts to set an attribute which is unknown to the associated PayloadSpec.
-
setAttribute
method assigns an Occurrence value to the specified attribute in this PayloadBlock. Any previously existing value will be replaced with this supplied value. Dot notation addressing is supported in the supplied name.- Parameters:
name
- the name of the attribute (eg. ABC[2].XYZ[1].TIME)unit
- the duration unit to use.amount
- the amount of units to set, value cannot be null- Returns:
- the modified payload to support chaining construct.
- Throws:
NoSuchElementException
- if the caller attempts to set an attribute which is unknown to the associated PayloadSpec.
-
getAttribute
method returns the attribute value for the provided attribute name. ClassCastException will be thrown if caller attempts to retrieve the attribute as the incorrect data type. Dot notation addressing is supported in the supplied name.- Type Parameters:
T
- the type of the expected attribute- Parameters:
name
- the name of the attribute to be retrieved (eg. ABC[2].XYZ[1].TIME)- Returns:
- the attribute value corresponding to the supplied name. Will return null if the attribute does not exist on the Payload.
- Throws:
NoSuchElementException
- if the caller attempts to get an attribute which is unknown to the associated PayloadSpec during the builder phase (ie. prior to calling usageRequestBuilder.build()).
-
createIterator
PayloadBlockIterator<PayloadBlock> createIterator()method to create an iterator that will do a depth first traversal of all sub-blocks below this Payload.- Returns:
- iterator for all sub-blocks of this PayloadBlock.
-
createIterator
method to create an iterator that will do a depth first traversal of all sub-blocks below this PayloadBlock that match the supplied blockName.- Parameters:
blockName
- block name to match. A trailing '*' suffix can be used to do wildcard helps. (eg. CUSTOMER.BALANCE*)- Returns:
- iterator to traverse all sub-blocks of this Payloadblock that match the supplied blockName.
-
createIterator
method to create an iterator that will do a depth first traversal of all sub-blocks below this PayloadBlock that match the supplied blockName and attribute name.- Parameters:
blockName
- block name to match. A trailing '*' suffix can be used to do wildcard helps. (eg. CUSTOMER.BALANCE*)attrName
- attr name to match.- Returns:
- iterator to traverse all sub-blocks of this Payloadblock that match the supplied blockName and attr name.
-
createIterator
method to create an iterator that will do a depth first traversal of all sub-blocks below this PayloadBlock that match the supplied blockName. attribute name and attribute value.- Parameters:
blockName
- block name to match. A trailing '*' suffix can be used to do wildcard helps. (eg. CUSTOMER.BALANCE*)attrName
- attr name to match.value
- attr value to match.- Returns:
- iterator to traverse all sub-blocks of this Payloadblock that match the supplied blockName, attr name and attr value.
-
getSubBlock
method gets the sub-block matching the supplied name and index. Block is implicitly created if not already existing in the payload.- Parameters:
name
- name of the block to get. Dot notation is NOT supported, this is a non-qualified block name that represents a block with is a direct descendant of this payload.index
- the index of the block to get.- Returns:
- the matching block
-
getAttributeInfo
List<PayloadAttributeInfo> getAttributeInfo()method returns meta data about attributes in this Payload.- Returns:
- meta data about attributes in this Payload
-
getAttributeInfo
method returns meta data about the attribute info for the given fully qualified attribute.- Parameters:
attributeName
- name of the attribute for which the attribute info will be returned- Returns:
- meta data about all available attributes in this Payload
-
getSubBlockInfo
List<PayloadBlockInfo> getSubBlockInfo()method returns meta data about PayloadBlocks in this Payload.- Returns:
- meta data about PayloadBlocks in this Payload
-
toDebugString
String toDebugString()method will produce a detailed representation of a payload- Returns:
- engineer view of the payload
-
hasAttribute
-
getSubBlockOrDefault
-